Hello,
I was wondering:
If obfuscation isn't all that good, why does Google obfuscate its
search results' code? Okay, I realize they're a commercial entity and
need to do it. How do they do it?
Could anyone out there decipher and normalize code for a Google search
result page? And despite the obfuscation, why is Google so fast?
I also get the feeling sites like Google and Facebook manage to create
better thumbnails on the fly. Any idea how?
Thanks!
Hello,
I was wondering:
If obfuscation isn't all that good, why does Google obfuscate its
search results' code? Okay, I realize they're a commercial entity and
need to do it. How do they do it?
Could anyone out there decipher and normalize code for a Google search
result page? And despite the obfuscation, why is Google so fast?
I also get the feeling sites like Google and Facebook manage to create
better thumbnails on the fly. Any idea how?
Thanks!
Thanks to everyone who've posted replies. I really appreciate it. Now,
here's some code from a Google search result page:
< script ><!-- (function() {
window.google = {
kEI: "SRhbRoOdH6GesAKi98mnBQ",
kEXPI: "17050,17469",
kHL: "en"
};
})
(); (function() {
window.ss = function() {
window.status = "";
return true
};
})
(); (function() {
window.rwt = function(b, d, f, j, k, g, l) {
var a = window.encodeURIComponent ? encodeURIComponent:
escape,
h = "",
i = "",
c = b.href.split("#"),
e = "";
if (d) {
h = "&oi=" + a(d)
}
if (f) {
i = "&cad=" + a(f)
}
if (g) {
e = "&usg=" + g
}
b.href = "/url ? sa = t " + h + i + " & ct = " + a(j) + " & cd
= " + a(k) + " & url = " + a(c[0]).replace(/\+/g, " % 2B ") + " & ei =
SRhbRoOdH6GesAKi98mnBQ " + e + l + (c[1] ? " # " + c[1]: "");
b.onmousedown = "";
return true
};
})
();
window.gbar = {}; (function() {
function n(a, b, c) {
var e = "on " + b;
if (a.addEventListener) {
a.addEventListener(b, c, false)
} else if (a.attachEvent) {
a.attachEvent(e, c)
} else {
var d = a[e];
a[e] = function() {
var f = d.apply(this, arguments),
g = c.apply(this, arguments);
return f == undefined ? g: (g == undefined ? f: g &&
f)
}
}
};
var h = window.gbar,
l = ["affdom ", "channel ", "client ", "hl ", "hs ", "ie ", "lr ",
"ned ", "oe ", "og ", "rls ", "rlz "];
function i(a) {
return a == "c " || a == "o " || a == "m "
}
h.getHtml = function(a) {
var b;
for (var c = 0; c < a.length; c ++ ) {
if (a[c][2] == "") {
b = a[c][0]
}
}
var e = i(b) ? "target = _blank ": "",
d = " < td nowrap > ",
f = " < table border = 0 cellpadding = 0 cellspacing = 0 style
= margin - left: " + h.getPad(true) + "px >< tr > " + d;
for (var c = 0; c < a.length; c ++ ) {
if (a[c][0] == b) {
f += a[c][1].bold() + d
} else {
f += " < a href = ";
if (a[c][3] == 3) {
f += '# onclick="this.blur();return
gbar.toggle(event)" style=text-decoration:none' + e + " >< u > " + a[c]
[1] + " < /u> <span style=font-size:11px>▼</span >< /a><tr><td
colspan=" + c + "><td><iframe class=gbard id=gbarif style=border:0;z-
index:999></iframe >< div class = gbard id = gbardd onclick =
gbar.stopB(event) > ";
d = ""
} else {
f += m(b, a[c][0], a[c][2]) + e + "onclick =
gbar.close(event) > " + a[c][1] + " < /a>" + d
}
}
}
f += "</div >< /table>";
return f
};
h.getPad = function(a) {
var b =- 1,
c = a ? 10: 4,
e = document.body.currentStyle,
d = document.defaultView;
if (e) {
b = a ? e.marginLeft: e.marginTop
} else if (d) {
b = a ? d.getComputedStyle(document.body, "").marginLeft:
d.getComputedStyle(document.body, "").marginTop
}
b = parseInt(b, 10);
return b >= 0 && b < c ? c - b: 1
};
function m(a, b, c) {
var e = window.location.search.substring(1),
d = e.match("q=[^&]*"),
f = e.match("near=([^&]*)"),
g = c + (c.match("[?]") ? "&": "?");
g += "tab=" + a + b;
if (i(b) && window.location.protocol == "https:") {
g = g.replace("http:", "https:")
}
if ( ! i(b) &&! i(a)) {
for (var j = 0; j < l.length; j ++ ) {
var k = e.match(l[j] + "=[^&]*");
if (k) {
g += "&" + k[0]
}
}
if (d && f && a == "l" && b != "l") {
g += "&" + d[0] + "+" + f[0]
} else if (d) {
g += "&" + d[0]
}
}
return g
}
h.toggle = function(a) {
h.stopB(a);
var b = document.getElementById("gbardd"),
c = document.getElementById("gbarif");
if (b && c) {
b.style.display = b.style.display == "block" ? "none":
"block";
c.width = b.offsetWidth;
c.height = b.offsetHeight;
c.style.display = b.style.display
}
return false
};
h.close = function(a) {
var b = document.getElementById("gbardd");
if (b && b.style.display == "block") {
h.toggle(a)
}
};
h.stopB = function(a) {
if ( ! a) {
a = window.event
}
a.cancelBubble = true
};
n(document, "click", h.close);
})
();
/ / -->< /script>/
I'm not really an expert in JavaScript (and neither do I have any
intentions of pilfering Google code). But for educational purposes
only, could someone out there please explain these lines of code? I
know all this is really taxing and thanks in advance..
Secondly, no one really answered the bit on the thumbnail part... on
how on-the-fly thumbnails seem to be done better in Google Images or
Facebook..
Finally (for now), does anyone know how to design Unicode fonts? The
Unicode groups on Usenet don't really seem that inviting so I'm
posting this here.
Once again, thanks in advance for everything.