Skip to content

Instantly share code, notes, and snippets.

@igrigorik
Created May 19, 2010 19:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save igrigorik/406725 to your computer and use it in GitHub Desktop.
Save igrigorik/406725 to your computer and use it in GitHub Desktop.
(function () {
var _UDS_CONST_LOCALE = 'en';
var _UDS_CONST_SHORT_DATE_PATTERN = 'MDY';
var _UDS_MSG_SEARCHER_IMAGE = ('Image');
var _UDS_MSG_SEARCHER_WEB = ('Web');
var _UDS_MSG_SEARCHER_BLOG = ('Blog');
var _UDS_MSG_SEARCHER_VIDEO = ('Video');
var _UDS_MSG_SEARCHER_LOCAL = ('Local');
var _UDS_MSG_SEARCHCONTROL_SAVE = ('save');
var _UDS_MSG_SEARCHCONTROL_KEEP = ('keep');
var _UDS_MSG_SEARCHCONTROL_INCLUDE = ('include');
var _UDS_MSG_SEARCHCONTROL_COPY = ('copy');
var _UDS_MSG_SEARCHCONTROL_CLOSE = ('close');
var _UDS_MSG_SEARCHCONTROL_SPONSORED_LINKS = ('Sponsored Links');
var _UDS_MSG_SEARCHCONTROL_SEE_MORE = ('see more...');
var _UDS_MSG_SEARCHCONTROL_WATERMARK = ('clipped from Google');
var _UDS_MSG_SEARCHER_CONFIG_SET_LOCATION = ('Search location');
var _UDS_MSG_SEARCHER_CONFIG_DISABLE_ADDRESS_LOOKUP = ('Disable address lookup');
var _UDS_MSG_SEARCHER_NEWS = ('News');
function _UDS_MSG_MINUTES_AGO(AGE_MINUTES_AGO) {
return ('' + AGE_MINUTES_AGO + ' minutes ago');
}
var _UDS_MSG_ONE_HOUR_AGO = ('1 hour ago');
function _UDS_MSG_HOURS_AGO(AGE_HOURS_AGO) {
return ('' + AGE_HOURS_AGO + ' hours ago');
}
function _UDS_MSG_NEWS_ALL_N_RELATED(NUMBER) {
return ('all ' + NUMBER + ' related');
}
var _UDS_MSG_NEWS_RELATED = ('Related Articles');
var _UDS_MSG_BRANDING_STRING = ('powered by Google');
var _UDS_MSG_SORT_BY_DATE = ('Sort by date');
var _UDS_MSG_MONTH_ABBR_JAN = ('Jan');
var _UDS_MSG_MONTH_ABBR_FEB = ('Feb');
var _UDS_MSG_MONTH_ABBR_MAR = ('Mar');
var _UDS_MSG_MONTH_ABBR_APR = ('Apr');
var _UDS_MSG_MONTH_ABBR_MAY = ('May');
var _UDS_MSG_MONTH_ABBR_JUN = ('Jun');
var _UDS_MSG_MONTH_ABBR_JUL = ('Jul');
var _UDS_MSG_MONTH_ABBR_AUG = ('Aug');
var _UDS_MSG_MONTH_ABBR_SEP = ('Sep');
var _UDS_MSG_MONTH_ABBR_OCT = ('Oct');
var _UDS_MSG_MONTH_ABBR_NOV = ('Nov');
var _UDS_MSG_MONTH_ABBR_DEC = ('Dec');
var _UDS_MSG_DIRECTIONS = ('directions');
var _UDS_MSG_CLEAR_RESULTS = ('clear results');
var _UDS_MSG_SHOW_ONE_RESULT = ('show one result');
var _UDS_MSG_SHOW_MORE_RESULTS = ('show more results');
var _UDS_MSG_SHOW_ALL_RESULTS = ('show all results');
var _UDS_MSG_SETTINGS = ('settings');
var _UDS_MSG_SEARCH = ('search');
var _UDS_MSG_SEARCH_UC = ('Search');
var _UDS_MSG_POWERED_BY = ('powered by');
function _UDS_MSG_LOCAL_ATTRIBUTION(LOCAL_RESULTS_PROVIDER) {
return ('Business listings provided by ' + LOCAL_RESULTS_PROVIDER + '');
}
var _UDS_MSG_SEARCHER_BOOK = ('Book');
function _UDS_MSG_FOUND_ON_PAGE(FOUND_ON_PAGE) {
return ('Page ' + FOUND_ON_PAGE + '');
}
function _UDS_MSG_TOTAL_PAGE_COUNT(PAGE_COUNT) {
return ('' + PAGE_COUNT + ' pages');
}
var _UDS_MSG_SEARCHER_BY = ('by');
var _UDS_MSG_SEARCHER_CODE = ('Code');
var _UDS_MSG_UNKNOWN_LICENSE = ('Unknown License');
var _UDS_MSG_SEARCHER_GSA = ('Search Appliance');
var _UDS_MSG_SEARCHCONTROL_MORERESULTS = ('More results');
var _UDS_MSG_SEARCHCONTROL_PREVIOUS = ('Previous');
var _UDS_MSG_SEARCHCONTROL_NEXT = ('Next');
var _UDS_MSG_GET_DIRECTIONS = ('Get directions');
var _UDS_MSG_GET_DIRECTIONS_TO_HERE = ('To here');
var _UDS_MSG_GET_DIRECTIONS_FROM_HERE = ('From here');
var _UDS_MSG_CLEAR_RESULTS_UC = ('Clear results');
var _UDS_MSG_SEARCH_THE_MAP = ('search the map');
var _UDS_MSG_SCROLL_THROUGH_RESULTS = ('scroll through results');
var _UDS_MSG_EDIT_TAGS = ('edit tags');
var _UDS_MSG_TAG_THIS_SEARCH = ('tag this search');
var _UDS_MSG_SEARCH_STRING = ('search string');
var _UDS_MSG_OPTIONAL_LABEL = ('optional label');
var _UDS_MSG_DELETE = ('delete');
var _UDS_MSG_DELETED = ('deleted');
var _UDS_MSG_CANCEL = ('cancel');
var _UDS_MSG_UPLOAD_YOUR_VIDEOS = ('upload your own video');
var _UDS_MSG_IM_DONE_WATCHING = ('i\047m done watching this');
var _UDS_MSG_CLOSE_VIDEO_PLAYER = ('close video player');
var _UDS_MSG_NO_RESULTS = ('No Results');
var _UDS_MSG_LINKEDCSE_ERROR_RESULTS = ('This Custom Search Engine is loading. Try again in a few seconds.');
var _UDS_MSG_COUPONS = ('Coupons');
var _UDS_MSG_BACK = ('back');
var _UDS_MSG_SUBSCRIBE = ('Subscribe');
var _UDS_MSG_SEARCHER_PATENT = ('Patent');
var _UDS_MSG_USPAT = ('US Pat.');
var _UDS_MSG_USPAT_APP = ('US Pat. App');
var _UDS_MSG_PATENT_FILED = ('Filed');
var _UDS_MSG_ADS_BY_GOOGLE = ('Ads by Google');
var _UDS_MSG_SET_DEFAULT_LOCATION = ('Set default location');
var _UDS_MSG_NEWSCAT_TOPSTORIES = ('Top Stories');
var _UDS_MSG_NEWSCAT_WORLD = ('World');
var _UDS_MSG_NEWSCAT_NATION = ('Nation');
var _UDS_MSG_NEWSCAT_BUSINESS = ('Business');
var _UDS_MSG_NEWSCAT_SCITECH = ('Sci/Tech');
var _UDS_MSG_NEWSCAT_ENTERTAINMENT = ('Entertainment');
var _UDS_MSG_NEWSCAT_HEALTH = ('Health');
var _UDS_MSG_NEWSCAT_SPORTS = ('Sports');
var _UDS_MSG_NEWSCAT_POLITICS = ('Politics');
var d = true,
e = null,
g = false,
i = encodeURIComponent,
k = window,
l = Object,
n = google,
aa = navigator,
o = document;
function q(a, b) {
return a.onreadystatechange = b
}
function r(a, b) {
return a.className = b
}
var s = "appendChild",
u = "push",
v = "test",
w = "replace",
x = "indexOf",
y = "status",
z = "readyState",
A = "createElement",
B = "ServiceBase",
C = "toString",
E = "length",
G = "propertyIsEnumerable",
H = "prototype",
I = "className",
J = "userAgent",
K = "style",
ba = "sendMessage",
ca = "call",
L = "loader",
M = "feeds",
da = "console",
N = "navigator",
O = "postMessage",
P = "CurrentLocale",
Q = "getElementsByTagNameNS",
ea = "event",
fa = this,
R = function (a, b, c) {
a = a.split(".");
c = c || fa;
!(a[0] in c) && c.execScript && c.execScript("var " + a[0]);
for (var f; a[E] && (f = a.shift());) if (!a[E] && b !== undefined) c[f] = b;
else c = c[f] ? c[f] : (c[f] = {})
},
ga = function (a) {
var b = typeof a;
if (b == "object") if (a) {
if (a instanceof Array || !(a instanceof l) && l[H][C][ca](a) == "[object Array]" || typeof a[E] == "number" && typeof a.splice != "undefined" && typeof a[G] != "undefined" && !a[G]("splice")) return "array";
if (!(a instanceof l) && (l[H][C][ca](a) == "[object Function]" || typeof a[ca] != "undefined" && typeof a[G] != "undefined" && !a[G]("call"))) return "function"
} else return "null";
else if (b == "function" && typeof a[ca] == "undefined") return "object";
return b
};
function ja(a) {
this.H = [];
this.ba = g;
this.I = a.onmessage;
if (a) {
this.i = a.Ja || e;
this.Ba = a.Aa || e
}
if (this.i) {
this.l = "parent";
if (ka()) q(this.i, la(this));
else this.i.onload = la(this);
this.Ba[s](this.i)
} else {
this.l = "child";
ma(this)
}
}
var na = function (a) {
return function () {
a.ba = d;
a[ba]()
}
},
la = function (a) {
return function () {
if (ka()) {
if (a.i[z] == "loaded" || a.i[z] == "complete") {
q(a.i, e);
ma(a)
}
} else ma(a)
}
};
ja[H].sendMessage = function (a) {
a && this.H[u](a);
if (this.ba) {
for (a = 0; a < this.H[E]; a++) this.X[ba](this.H[a]);
this.H = []
}
};
var ma = function (a) {
if (k[O] || k.document[O]) {
a.X = a.l == "parent" ? new oa(a.I, a.i) : new oa(a.I);
na(a)()
} else {
var b;
b = (b = k[N] ? k[N][J] : e) ? pa(b) == 6 : g;
if (!(b = b)) b = (b = k[N] ? k[N][J] : e) ? pa(b) == 7 : g;
if (b = b) {
b = (b = k[N] ? k[N][J] : e) ? /trident\/\d/i [v](b) && pa(b) == 7 : g;
b = !b
}
if (b) {
a.X = a.l == "parent" ? new S(a.I, "parent", a.i) : new S(a.I, "child");
qa(a.X, na(a))
}
}
};
function oa(a, b) {
this.u = b ? b.contentWindow : k.parent;
ra(this, a ||
function () {})
}
oa[H].sendMessage = function (a) {
var b = this.u[O] ? this.u : this.u.document[O] ? this.u.document : e;
b && b[O](a, "*")
};
var ra = function (a, b) {
var c = function (f) {
f = f ? f : k[ea];
f.source == a.u && b(f.data)
};
if (k.attachEvent) k.attachEvent("onmessage", c);
else k.addEventListener && k.addEventListener("message", c, g)
};
var S = function (a, b, c) {
this.Na = a;
this.l = b;
this.n = g;
this.ea = c || e;
this.console = k[da] || {
log: function () {}
};
if (!this.ea && this.l == "parent") this[da].log("You forgot to pass an iframe.");
else {
if (!k.UDS_IEXDC_SETUP_COMPLETE) try {
k.execScript("Class UDS_GCXPC____NIXVBS_wrapper\n Private UDS_M_TRANSPORT\nPublic Sub UDS_SET_TRANSPORT(transport)\nIf isEmpty(UDS_M_TRANSPORT) Then\nSet UDS_M_TRANSPORT = transport\nEnd If\nEnd Sub\nPublic Sub UDS_SEND_MESSAGE_(payload)\n Call UDS_M_TRANSPORT.UDS_GCXPC____NIXJS_handle_message(payload)\nEnd Sub\nPublic Sub UDS_CREATE_CHANNEL(channel)\n Call UDS_M_TRANSPORT.UDS_GCXPC____NIXJS_create_channel(channel)\nEnd Sub\nPublic Sub UDS_GCXPC____NIXVBS_container()\n End Sub\nEnd Class\n Function UDS_GCXPC____NIXVBS_get_wrapper(transport)\nDim wrap\nSet wrap = New UDS_GCXPC____NIXVBS_wrapper\nwrap.UDS_SET_TRANSPORT transport\nSet UDS_GCXPC____NIXVBS_get_wrapper = wrap\nEnd Function", "vbscript");
k.UDS_IEXDC_SETUP_COMPLETE = d
} catch (f) {}
this.UDS_GCXPC____NIXJS_handle_message = this.Ia;
this.UDS_GCXPC____NIXJS_create_channel = this.Ca
}
},
ka = function () {
var a = k[N] ? k[N][J] : e;
return a ? a[x]("Opera") != 0 && a[x]("MSIE") != -1 : g
},
sa = /MSIE\s+([^\);]+)(\)|;)/,
pa = function (a) {
return (a = sa.exec(a)) ? a[1] : ""
};
S[H].Ia = function (a) {
this.l == "parent" && a == "connected" ? this.la() : this.Na(a)
};
S[H].Ca = function (a) {
this.G = a
};
var ta = function (a, b) {
return function () {
if (!b.n) {
var c = b.ea;
try {
c.contentWindow.opener = k.UDS_GCXPC____NIXVBS_get_wrapper(b);
b.n = d
} catch (f) {
this[da].log("Exception caught while attempting Google IE XDC: " + f.message)
}
b.n || k.setTimeout(ta(b, b), 100)
}
}
},
ua = function (a, b) {
return function () {
if (!b.n) {
try {
var c = k.opener;
if (c && "UDS_GCXPC____NIXVBS_container" in c) {
b.G = c;
b.G.UDS_CREATE_CHANNEL(k.UDS_GCXPC____NIXVBS_get_wrapper(b));
b.n = d;
b.send("connected");
b.la()
}
} catch (f) {
return
}
b.n || k.setTimeout(ua(b, b), 100)
}
}
};
S[H].send = function (a) {
var b = g;
try {
this.G[C]()
} catch (c) {
b = d
}
b ? this.G.UDS_SEND_MESSAGE_(a) : this[da].log("Cross-domain channel has been modified.")
};
S[H].sendMessage = function (a) {
this.send(a)
};
var qa = function (a, b) {
a.la = b ||
function () {};
a.l == "parent" ? ta(a, a)() : ua(a, a)()
};
var va = function () {},
xa = function (a, b) {
var c = [];
wa(a, b, c);
return c.join("")
},
wa = function (a, b, c) {
switch (typeof b) {
case "string":
ya(a, b, c);
break;
case "number":
c[u](isFinite(b) && !isNaN(b) ? b : "null");
break;
case "boolean":
c[u](b);
break;
case "undefined":
c[u]("null");
break;
case "object":
if (b == e) {
c[u]("null");
break
}
if (ga(b) == "array") {
var f = b[E];
c[u]("[");
for (var h = "", j = 0; j < f; j++) {
c[u](h);
wa(a, b[j], c);
h = ","
}
c[u]("]");
break
}
c[u]("{");
f = "";
for (h in b) if (b.hasOwnProperty(h)) {
j = b[h];
if (typeof j != "function") {
c[u](f);
ya(a, h, c);
c[u](":");
wa(a, j, c);
f = ","
}
}
c[u]("}");
break;
case "function":
break;
default:
throw Error("Unknown type: " + typeof b);
}
},
za = {
'"': '\\"',
"\\": "\\\\",
"/": "\\/",
"\u0008": "\\b",
"\u000c": "\\f",
"\n": "\\n",
"\r": "\\r",
"\t": "\\t",
"\u000b": "\\u000b"
},
Aa = /\uffff/ [v]("\uffff") ? /[\\\"\x00-\x1f\x7f-\uffff]/g : /[\\\"\x00-\x1f\x7f-\xff]/g,
ya = function (a, b, c) {
c[u]('"', b[w](Aa, function (f) {
if (f in za) return za[f];
var h = f.charCodeAt(0),
j = "\\u";
if (h < 16) j += "000";
else if (h < 256) j += "00";
else if (h < 4096) j += "0";
return za[f] =
j + h[C](16)
}), '"')
};
var T = {};
T.blank = "&nbsp;";
T.image = _UDS_MSG_SEARCHER_IMAGE;
T.web = _UDS_MSG_SEARCHER_WEB;
T.blog = _UDS_MSG_SEARCHER_BLOG;
T.video = _UDS_MSG_SEARCHER_VIDEO;
T.local = _UDS_MSG_SEARCHER_LOCAL;
T.news = _UDS_MSG_SEARCHER_NEWS;
T.book = _UDS_MSG_SEARCHER_BOOK;
T.patent = "Patent";
T["ads-by-google"] = _UDS_MSG_ADS_BY_GOOGLE;
T.cse = "Custom Search Control";
T.save = _UDS_MSG_SEARCHCONTROL_SAVE;
T.keep = _UDS_MSG_SEARCHCONTROL_KEEP;
T.include = _UDS_MSG_SEARCHCONTROL_INCLUDE;
T.copy = _UDS_MSG_SEARCHCONTROL_COPY;
T.close = _UDS_MSG_SEARCHCONTROL_CLOSE;
T["sponsored-links"] = _UDS_MSG_SEARCHCONTROL_SPONSORED_LINKS;
T["see-more"] = _UDS_MSG_SEARCHCONTROL_SEE_MORE;
T.watermark = _UDS_MSG_SEARCHCONTROL_WATERMARK;
T["search-location"] = _UDS_MSG_SEARCHER_CONFIG_SET_LOCATION;
T["disable-address-lookup"] = _UDS_MSG_SEARCHER_CONFIG_DISABLE_ADDRESS_LOOKUP;
T["sort-by-date"] = _UDS_MSG_SORT_BY_DATE;
T.pbg = _UDS_MSG_BRANDING_STRING;
T["n-minutes-ago"] = _UDS_MSG_MINUTES_AGO;
T["n-hours-ago"] = _UDS_MSG_HOURS_AGO;
T["one-hour-ago"] = _UDS_MSG_ONE_HOUR_AGO;
T["all-n-related"] = _UDS_MSG_NEWS_ALL_N_RELATED;
T["related-articles"] = _UDS_MSG_NEWS_RELATED;
T["page-count"] = _UDS_MSG_TOTAL_PAGE_COUNT;
var U = [];
U[0] = _UDS_MSG_MONTH_ABBR_JAN;
U[1] = _UDS_MSG_MONTH_ABBR_FEB;
U[2] = _UDS_MSG_MONTH_ABBR_MAR;
U[3] = _UDS_MSG_MONTH_ABBR_APR;
U[4] = _UDS_MSG_MONTH_ABBR_MAY;
U[5] = _UDS_MSG_MONTH_ABBR_JUN;
U[6] = _UDS_MSG_MONTH_ABBR_JUL;
U[7] = _UDS_MSG_MONTH_ABBR_AUG;
U[8] = _UDS_MSG_MONTH_ABBR_SEP;
U[9] = _UDS_MSG_MONTH_ABBR_OCT;
U[10] = _UDS_MSG_MONTH_ABBR_NOV;
U[11] = _UDS_MSG_MONTH_ABBR_DEC;
T["month-abbr"] = U;
T.directions = _UDS_MSG_DIRECTIONS;
T["clear-results"] = _UDS_MSG_CLEAR_RESULTS;
T["show-one-result"] = _UDS_MSG_SHOW_ONE_RESULT;
T["show-more-results"] = _UDS_MSG_SHOW_MORE_RESULTS;
T["show-all-results"] = _UDS_MSG_SHOW_ALL_RESULTS;
T.settings = _UDS_MSG_SETTINGS;
T.search = _UDS_MSG_SEARCH;
T["search-uc"] = _UDS_MSG_SEARCH_UC;
T["powered-by"] = _UDS_MSG_POWERED_BY;
T.sa = _UDS_MSG_SEARCHER_GSA;
T.by = _UDS_MSG_SEARCHER_BY;
T.code = _UDS_MSG_SEARCHER_CODE;
T["unknown-license"] = _UDS_MSG_UNKNOWN_LICENSE;
T["more-results"] = _UDS_MSG_SEARCHCONTROL_MORERESULTS;
T.previous = _UDS_MSG_SEARCHCONTROL_PREVIOUS;
T.next = _UDS_MSG_SEARCHCONTROL_NEXT;
T["get-directions"] = _UDS_MSG_GET_DIRECTIONS;
T["to-here"] = _UDS_MSG_GET_DIRECTIONS_TO_HERE;
T["from-here"] = _UDS_MSG_GET_DIRECTIONS_FROM_HERE;
T["clear-results-uc"] = _UDS_MSG_CLEAR_RESULTS_UC;
T["search-the-map"] = _UDS_MSG_SEARCH_THE_MAP;
T["scroll-results"] = _UDS_MSG_SCROLL_THROUGH_RESULTS;
T["edit-tags"] = _UDS_MSG_EDIT_TAGS;
T["tag-search"] = _UDS_MSG_TAG_THIS_SEARCH;
T["search-string"] = _UDS_MSG_SEARCH_STRING;
T["optional-label"] = _UDS_MSG_OPTIONAL_LABEL;
T["delete"] = _UDS_MSG_DELETE;
T.deleted = _UDS_MSG_DELETED;
T.cancel = _UDS_MSG_CANCEL;
T["upload-video"] = _UDS_MSG_UPLOAD_YOUR_VIDEOS;
T["im-done"] = _UDS_MSG_IM_DONE_WATCHING;
T["close-player"] = _UDS_MSG_CLOSE_VIDEO_PLAYER;
T["no-results"] = _UDS_MSG_NO_RESULTS;
T["linked-cse-error-results"] = _UDS_MSG_LINKEDCSE_ERROR_RESULTS;
T.back = _UDS_MSG_BACK;
T.subscribe = _UDS_MSG_SUBSCRIBE;
T["us-pat"] = "US Pat.";
T["us-pat-app"] = "US Pat. App";
T["us-pat-filed"] = "Filed";
var _json_cache_defeater_ = (new Date).getTime(),
_json_request_require_prep = d;
function Ba(a, b) {
var c;
if (c = Ea("msie")) c = "msie 6.0" in Fa ? Fa["msie 6.0"] : (Fa["msie 6.0"] = aa.appVersion.toLowerCase()[x]("msie 6.0") != -1);
c ? k.setTimeout(Ga(this, Ha, [a, b]), 0) : Ha(a, b)
}
function Ha(a, b) {
var c = o.getElementsByTagName("head")[0];
c || (c = o.body.parentNode[s](o[A]("head")));
var f = o[A]("script");
f.type = "text/javascript";
f.charset = "utf-8";
var h = _json_request_require_prep ? a + "&key=" + n[L].ApiKey + "&v=" + b : a;
if (Ea("msie") || Ea("safari") || Ea("konqueror")) h = h + "&nocache=" + _json_cache_defeater_++;
f.src = h;
var j = function () {
f.onload = e;
f.parentNode.removeChild(f);
delete f
};
h = function (m) {
m = (m ? m : k[ea]).target ? (m ? m : k[ea]).target : (m ? m : k[ea]).srcElement;
if (m[z] == "loaded" || m[z] == "complete") {
q(m, e);
j()
}
};
if (aa.product == "Gecko") f.onload = j;
else q(f, h);
c[s](f)
}
function Ia(a, b) {
return function () {
return b.apply(a, arguments)
}
}
function Ga(a, b, c) {
return function () {
return b.apply(a, c)
}
}
function Ja(a) {
for (; a.firstChild;) a.removeChild(a.firstChild)
}
function V(a, b) {
try {
a[s](b)
} catch (c) {}
return b
}
function W(a, b) {
var c = o[A]("div");
if (a) c.innerHTML = a;
if (b) r(c, b);
return c
}
function X(a) {
var b = o[A]("div");
if (a) r(b, a);
return b
}
function Ka(a, b, c) {
(a = a.insertRow(-1)) || alert(a);
for (var f = 0; f < b; f++) La(a, c);
return a
}
function La(a, b) {
var c = a.insertCell(-1);
if (b) r(c, b);
return c
}
function Y(a, b) {
var c;
a: {
if (!(a == e || a[I] == e)) {
c = a[I].split(" ");
for (var f = 0; f < c[E]; f++) if (c[f] == b) {
c = d;
break a
}
}
c = g
}
c || (a.className += " " + b)
}
function Ma(a, b) {
if (a[I] != e) {
for (var c = a[I].split(" "), f = [], h = g, j = 0; j < c[E]; j++) if (c[j] != b) c[j] && f[u](c[j]);
else h = d;
if (h) r(a, f.join(" "))
}
}
function Ea(a) {
if (a in Na) return Na[a];
return Na[a] = aa[J].toLowerCase()[x](a) != -1
}
var Na = {},
Fa = {},
Oa, Pa;
if (k.Ra) {
Oa = d;
if (k.XMLHttpRequest) Pa = d
}
function Qa(a) {
this.R = a + "branding";
this.K = a + "branding-vertical";
this.Sa = a + "branding-img";
this.Ua = a + "branding-user-defined";
this.fa = a + "branding-img-noclear";
this.za = a + "branding-clickable";
this.text = a + "branding-text"
}
var Ra = {
"zh-CN": {
month: " \u6708 ",
year: " \u5e74 ",
day: " \u65e5 "
},
"zh-TW": {
month: " \u6708 ",
year: " \u5e74 ",
day: " \u65e5 "
},
ja: {
month: "\u6708",
year: "\u5e74",
day: "\u65e5"
},
ko: {
month: " \uc6d4 ",
year: " \ub144 ",
day: " \uc77c "
}
};
function Sa(a, b, c) {
var f = (new Date).getTime(),
h = a.getTime();
if (f < h) return T["n-minutes-ago"](2);
f = f - h;
if (f < 36E5) {
b = Math.floor(f / 6E4);
return T["n-minutes-ago"](b <= 1 ? 2 : b)
}
if (f < 864E5) {
b = Math.floor(f / 36E5);
if (b <= 1) return T["one-hour-ago"];
else return T["n-hours-ago"](b)
}
f = a.getFullYear();
h = a.getMonth();
var j = T["month-abbr"][h];
a = a.getDate();
if (a < 10) a = "0" + a;
switch (b) {
case "MDY":
b = j + " " + a + ", " + f;
break;
case "YMD":
if (c && (c == "zh-CN" || c == "zh-TW" || c == "ja" || c == "ko")) {
b = Ra[c];
b = f + b.year + (h + 1) + b.month + a + b.day
} else b = f + " " + j + " " + a;
break;
default:
case "DMY":
b = a + " " + j + " " + f;
break
}
return b
};
n[M].ua = "_top";
R("google.feeds.LINK_TARGET_TOP", n[M].ua, void 0);
n[M].Z = "_self";
R("google.feeds.LINK_TARGET_SELF", n[M].Z, void 0);
n[M].ta = "_parent";
R("google.feeds.LINK_TARGET_PARENT", n[M].ta, void 0);
n[M].ra = "_blank";
R("google.feeds.LINK_TARGET_BLANK", n[M].ra, void 0);
n[M].a = function (a) {
this.f = a;
this.ka = n[M].a.Y;
this.r = n[M].a.D;
this.ga = g
};
R("google.feeds.Feed", n[M].a, void 0);
n[M].a.wa = -1;
n[M].a.MAX_ENTRIES = n[M].a.wa;
n[M].a.Y = 4;
n[M].a.DEFAULT_NUM_ENTRIES = n[M].a.Y;
n[M].a.Q = "xml";
n[M].a.XML_FORMAT = n[M].a.Q;
n[M].a.D = "json";
n[M].a.JSON_FORMAT = n[M].a.D;
n[M].a.O = "json_xml";
n[M].a.MIXED_FORMAT = n[M].a.O;
n[M].a.w = [];
n[M].a.C = function (a, b) {
var c = g,
f = e;
if (a[E]) for (var h = 0; h < a[E]; h++) if (a[h] == e) {
a[h] = b;
f = h;
c = d;
break
}
if (!c) {
f = a[E];
a[u](b)
}
return f
};
n[M].a.AllocateCompletionMapContext = n[M].a.C;
n[M].a.P = function (a, b, c, f, h) {
var j = 0;
if (a) j = parseInt(a, 10);
a = n[M].a.w[j];
n[M].a.w[j] = e;
a.V(b, c, f, h)
};
n[M].a.RawCompletion = n[M].a.P;
n[M].a[H].load = function (a) {
var b = new n[M].t;
b.j = a;
b.r = this.r;
a = n[M].a.C(n[M].a.w, b);
a = n[L][B] + "/Gfeeds?callback=google.feeds.Feed.RawCompletion&context=" + a + "&num=" + this.ka + "&hl=" + n[M][P] + "&output=" + this.r;
if (this.f) a += "&q=" + i(this.f);
if (this.ga) a += "&scoring=h";
Ba(a, n[M].Version)
};
n[M].a[H].load = n[M].a[H].load;
n[M].a[H].A = function (a) {
this.ka = a
};
n[M].a[H].setNumEntries = n[M].a[H].A;
n[M].a[H].Pa = function (a) {
switch (a) {
case n[M].a.Q:
case n[M].a.O:
case n[M].a.D:
this.r = a;
break;
default:
this.r = n[M].a.D;
break
}
};
n[M].a[H].setResultFormat = n[M].a[H].Pa;
n[M].a[H].v = function () {
this.ga = d
};
n[M].a[H].includeHistoricalEntries = n[M].a[H].v;
n[M].t = function () {};
R("google.feeds.Result", n[M].t, void 0);
n[M].t[H].V = function (a, b, c) {
this.status = {
code: b
};
if (c) this[y].message = c;
if (b != 200) {
this.error = this[y];
switch (this.r) {
case n[M].a.Q:
this.xmlDocument = e;
break;
case n[M].a.O:
this.xmlDocument = e;
default:
this.feed = {};
this.feed.entries = [];
break
}
} else {
if (a.feed) this.feed = a.feed;
if (a.xmlString) {
a = a.xmlString;
if (a != e) {
if (typeof DOMParser != "undefined") a = (new DOMParser).parseFromString(a, "application/xml");
else if (typeof ActiveXObject != "undefined") {
b = new ActiveXObject("Microsoft.XMLDOM");
b.loadXML(a);
a = b
} else {
b =
new XMLHttpRequest;
b.open("GET", "data:text/xml;charset=utf-8," + i(a), g);
b.send(e);
a = b.responseXML
}
this.xmlDocument = a;
a: if (!(this.xmlDocument == e || this.feed == e)) {
a = n[M].t.pa(this.feed.type);
if (a != e) {
b = this.xmlDocument;
if (a.e) {
b = n[M][Q](this.xmlDocument, a.o, a.e);
if (b == e || b[E] == 0) break a;
b = b[0]
}
a = n[M][Q](b, a.o, a.m);
if (!(a == e || a[E] == 0)) if (a[E] == this.feed.entries[E]) for (b = 0; b < a[E]; b++) this.feed.entries[b].xmlNode = a[b]
}
}
}
}
}
this.j && this.j(this)
};
n[M].t.pa = function (a) {
var b = e;
switch (a) {
case "rss":
case "rss091":
case "rss091u":
case "rss091n":
case "rss092":
case "rss093":
case "rss094":
case "rss20":
b = {
e: "channel",
m: "item",
o: ""
};
break;
case "rss090":
b = {
e: "",
m: "item",
o: "http://my.netscape.com/rdf/simple/0.9/"
};
break;
case "rss10":
b = {
e: "",
m: "item",
o: "http://purl.org/rss/1.0/"
};
break;
case "atom03":
b = {
e: "feed",
m: "entry",
o: "http://purl.org/atom/ns#"
};
break;
case "atom":
case "atom10":
b = {
e: "feed",
m: "entry",
o: "http://www.w3.org/2005/Atom"
};
break
}
return b
};
n[M].$ = 1;
R("google.feeds.VERTICAL_BRANDING", n[M].$, void 0);
n[M].qa = 2;
R("google.feeds.HORIZONTAL_BRANDING", n[M].qa, void 0);
n[M].xa = T;
R("google.feeds.Strings", n[M].xa, void 0);
n[M].CurrentLocale = _UDS_CONST_LOCALE;
R("google.feeds.CurrentLocale", n[M][P], void 0);
n[M].ShortDatePattern = _UDS_CONST_SHORT_DATE_PATTERN;
R("google.feeds.ShortDatePattern", n[M].ShortDatePattern, void 0);
n[M].Ha = function (a, b, c) {
var f = b && b == n[M].$,
h = new Qa("gf-");
b = X(h.R);
var j = h.R,
m = o[A]("table");
m.setAttribute("cellSpacing", 0);
m.setAttribute("cellPadding", 0);
if (j) r(m, j);
V(b, m);
f = !f;
if (!f) {
Y(b, h.K);
Y(m, h.K)
}
var p = Ka(m, 0),
t;
if (f) t = j = p;
else {
j = p;
t = Ka(m, 0)
}
var F = "/css/small-logo.png",
D = 51;
p = 15;
if (c) if (typeof c == "string") if (c.match(/^http:\/\/www\.youtube\.com/)) {
F = "/css/youtube-logo-55x24.png";
D = 55;
p = 24;
Y(b, h.R + "-youtube");
if (!f) {
Y(b, h.K + "-youtube");
Y(m, h.K + "-youtube")
}
}
f = La(j, h.text);
m = La(t, h.fa);
j =
W(T["powered-by"], h.text);
F = n[L][B] + F;
D = D;
p = p;
t = h.fa;
if (Oa && !Pa) {
t = X(t);
t[K].filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + F + '")';
t[K].width = D + "px";
t[K].height = p + "px"
} else {
p = o[A]("img");
p.src = F;
if (t) r(p, t);
t = p
}
p = t;
V(f, j);
if (c) {
f = "http://www.google.com";
if (typeof c == "string" && (c.match(/^http:\/\/[a-z]*\.google\.com/) || c.match(/^http:\/\/www\.youtube\.com/))) f = c;
c = f;
f = o[A]("a");
f.href = c;
f.target = "_BLANK";
r(f, h.za);
V(f, p);
V(m, f)
} else V(m, p);
if (a) {
a = typeof a == "string" ? o.getElementById(a) : a;
Ja(a);
V(a, b)
}
return b
};
R("google.feeds.getBranding", n[M].Ha, void 0);
n[M].getElementsByTagNameNS = function (a, b, c) {
if (b == e) b = "";
if (a[Q]) a = a[Q](b, c);
else {
var f = a.getElementsByTagName("*");
a = [];
for (var h = 0; h < f[E]; h++) {
var j = f[h].tagName;
j = j.substring(j.lastIndexOf(":") + 1);
j == c && f[h].namespaceURI == b && a[u](f[h])
}
}
return a
};
R("google.feeds.getElementsByTagNameNS", n[M][Q], void 0);
n[M].Ga = function (a, b) {
var c = new n[M].M;
c.j = b;
c = n[M].a.C(n[M].a.w, c);
c = n[L][B] + "/GfindFeeds?callback=google.feeds.Feed.FindRawCompletion&context=" + c + "&hl=" + n[M][P];
if (a) c += "&q=" + i(a);
Ba(c, n[M].Version)
};
R("google.feeds.findFeeds", n[M].Ga, void 0);
n[M].a.oa = n[M].a.P;
n[M].a.FindRawCompletion = n[M].a.oa;
n[M].M = function () {};
R("google.feeds.FindResult", n[M].M, void 0);
n[M].M[H].V = function (a, b, c) {
this.status = {
code: b
};
if (c) this[y].message = c;
if (b != 200) {
this.error = this[y];
this.m = []
} else {
if (a.entries) this.entries = a.entries;
if (a.query) this.query = a.query
}
this.j && this.j(this)
};
n[M].La = function (a, b) {
var c = new n[M].N;
c.j = b;
c = n[M].a.C(n[M].a.w, c);
c = n[L][B] + "/GlookupFeed?callback=google.feeds.Feed.LookupRawCompletion&context=" + c + "&hl=" + n[M][P];
if (a) c += "&q=" + i(a);
Ba(c, n[M].Version)
};
R("google.feeds.lookupFeed", n[M].La, void 0);
n[M].a.va = n[M].a.P;
n[M].a.LookupRawCompletion = n[M].a.va;
n[M].N = function () {};
R("google.feeds.LookupResult", n[M].N, void 0);
n[M].N[H].V = function (a, b, c) {
this.status = {
code: b
};
if (c) this[y].message = c;
if (b != 200) {
this.error = this[y];
this.url = e
} else {
if (a.url) this.url = a.url;
if (a.query) this.query = a.query
}
this.j && this.j(this)
};
n[M].b = function () {
this.Ta = e;
this.d = [];
this.ia = n[M].Z;
this.F = n[M].b.L;
this.B = this.J = this.p = e
};
R("google.feeds.FeedControl", n[M].b, void 0);
n[M].b.s = "tabbed";
n[M].b.DRAW_MODE_TABBED = n[M].b.s;
n[M].b.L = "linear";
n[M].b.DRAW_MODE_LINEAR = n[M].b.L;
n[M].b[H].ya = function (a, b, c) {
this.d[u](new Ta(new n[M].a(a), b, this, c))
};
n[M].b[H].addFeed = n[M].b[H].ya;
n[M].b[H].Da = function (a, b) {
if (b) if (b.drawMode) if (b.drawMode == n[M].b.s || b.drawMode == n[M].b.L) this.F = b.drawMode;
this.e = X(Ua);
this.J = X(Va);
if (this.F == n[M].b.s) {
this.B = X(Wa);
V(this.e, this.B);
this.c = [];
for (var c = this.g = 0; c < this.d[E]; c++) {
var f = {};
f.h = W(this.d[c].ha);
f.k = e;
f.h.onclick = Ga(this, n[M].b[H].Qa, [c]);
this.c[c] = f;
V(this.B, f.h)
}
}
V(this.e, this.J);
for (c = 0; c < this.d[E]; c++) {
this.d[c].e = X(Xa);
if (this.F == n[M].b.s) this.c[c].k = this.d[c].e;
f = X(Ya);
var h = W(this.d[c].ha, Za);
V(f, h);
this.d[c].W = X($a);
V(this.J, this.d[c].e);
V(this.d[c].e, f);
V(this.d[c].e, this.d[c].W)
}
if (this.F == n[M].b.s) for (c = 0; c < this.d[E]; c++) {
Y(this.c[c].h, ab);
Y(this.c[c].k, bb);
if (c == this.g) {
Y(this.c[c].h, cb);
Y(this.c[c].k, db)
} else {
Y(this.c[c].h, eb);
Y(this.c[c].k, fb)
}
}
c = this.e;
if (a) try {
Ja(a);
a[s](c)
} catch (j) {}
r(this.J, gb);
if (this.B) r(this.B, hb);
for (c = 0; c < this.d[E]; c++) {
f = this.d[c];
this.p != e && f.p == e && f.da.A(this.p);
f.da.load(f.Ka)
}
};
n[M].b[H].draw = n[M].b[H].Da;
n[M].b[H].A = function (a) {
this.p = a
};
n[M].b[H].setNumEntries = n[M].b[H].A;
n[M].b[H].Oa = function (a) {
this.ia = a
};
n[M].b[H].setLinkTarget = n[M].b[H].Oa;
n[M].b[H].ca = function (a) {
var b = X(ib),
c;
c = a.link;
var f = a.title,
h = this.ia,
j = jb,
m = W(e, j),
p = o[A]("a");
p.href = c;
p.innerHTML = f;
if (j) r(p, j);
if (h) p.target = h;
m[s](p);
V(b, m);
if (a.author) {
c = W(T.by + "&nbsp;" + a.author, kb);
V(b, c);
c = "";
if (a.publishedDate) c = "-";
c = W(c, lb);
V(b, c)
}
if (a.publishedDate) {
c = W(Sa(new Date(a.publishedDate), n[M].ShortDatePattern, n[M][P]), mb);
V(b, c)
}
c = W(a.contentSnippet, nb);
V(b, c);
V(b, c);
a.html = b
};
n[M].b[H].createHtml = n[M].b[H].ca;
n[M].b[H].S = function (a, b) {
var c, f;
Ja(b.W);
for (var h = 0; h < a.feed.entries[E]; h++) {
c = a.feed.entries[h];
c.html || this.ca(c);
if (c.html) {
f = X(ob);
c = c.html.cloneNode(d);
V(f, c);
V(b.W, f)
}
}
};
n[M].b[H].Qa = function (a) {
if (this.g != a) {
Ma(this.c[this.g].h, cb);
Ma(this.c[this.g].k, db);
Y(this.c[this.g].h, eb);
Y(this.c[this.g].k, fb);
this.g = a;
Y(this.c[this.g].h, cb);
Y(this.c[this.g].k, db);
Ma(this.c[this.g].h, eb);
Ma(this.c[this.g].k, fb)
}
};
function Ta(a, b, c, f) {
this.da = a;
this.ha = b;
this.p = e;
if (f) {
if (f.numEntries) {
a.A(f.numEntries);
this.p = f.numEntries
}
f.includeHistoricalEntries && a.v()
}
this.Fa = c;
this.Ka = Ia(this, Ta[H].S)
}
Ta[H].S = function (a) {
a.error || this.Fa.S(a, this)
};
var ib = "gf-result",
lb = "gf-spacer",
jb = "gf-title",
nb = "gf-snippet",
kb = "gf-author",
mb = "gf-relativePublishedDate",
Ua = "gfc-control",
Xa = "gfc-resultsRoot",
$a = "gfc-results",
ob = "gfc-result",
Ya = "gfc-resultsHeader",
Va = "gfc-resultsbox-invisible",
gb = "gfc-resultsbox-visible",
Za = "gfc-title",
hb = "gfc-tabsArea",
Wa = "gfc-tabsAreaInvisible",
ab = "gfc-tabHeader",
cb = "gfc-tabhActive",
eb = "gfc-tabhInactive",
db = "gfc-tabdActive",
fb = "gfc-tabdInactive",
bb = "gfc-tabData";
function Z(a) {
if (!a) throw "google.feeds.push.Feed: Must specify a feed URL.";
this.f = a;
this.q = [];
if (!pb) {
a = o[A]("iframe");
a.src = qb;
a.width = "0px";
a.height = "0px";
a[K].display = "none";
rb = a;
sb = new ja({
Ja: rb,
Aa: o.body,
onmessage: tb()
});
pb = d
}
}
var rb, sb, $, ub, vb, wb, xb = k.google ? n[L].GoogleApisBase + "/services/feed/load?" : "http://ajax.googleapis.com/services/feed/load?",
qb = k.google ? n[L].GoogleApisBase + "/static/modules/feeds/iframe.html?key=" + n[L].ApiKey : "",
pb = g,
yb = function (a, b) {
for (var c = 0; c < b[E]; c++) {
var f = b[c];
f.z = f.z || [];
f.z[u](a);
if (f.Ma) {
for (var h = 0; h < f.z[E]; h++) {
var j = a = f.z[h],
m = f.T;
for (var p in m) j[p] = m[p];
j = j;
m = j.feed.entries;
f.Ea = f.Ea || {};
for (var t = [], F = 0; F < m[E]; F++) {
for (var D = m[F], Ca = f.q[E] == 0, Da = 0; Da < f.q[E]; Da++) {
var ha = f.q[Da];
if (ha.title == D.title) for (var ia in ha) {
if (!D[ia] && ha[ia] || D[ia] != ha[ia]) {
Ca = d;
break
}
} else Ca = d
}
if (Ca) {
t[u](D);
f.q[u](D);
f.q[E] > 100 && f.q.splice(0, 1)
}
}
j.feed.entries = t;
a = j;
a.feed.entries[E] > 0 && f.aa(a)
}
f.z = []
}
}
},
tb = function () {
return function (a) {
var b;
a: {
a = String(a);
if (/^\s*$/ [v](a) ? g : /^[\],:{}\s\u2028\u2029]*$/ [v](a[w](/\\["\\\/bfnrtu]/g, "@")[w](/"[^"\\\n\r\u2028\u2029\x00-\x08\x10-\x1f\x80-\x9f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]")[w](/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g, ""))) try {
b =
eval("(" + a + ")");
break a
} catch (c) {}
throw Error("Invalid JSON string: " + a);
}
var f = b.cmd;
a = b.msg;
if (f == "new") yb(a, $[a.feed.feedUrl]);
else if (f == "b" && vb) vb();
else if (f == "err" || f == "ub") {
b = ub && (ub == "err" || ub == "ub");
wb && !b && wb(a)
}
ub = f
}
},
zb = function (a, b) {
if (b && b.feed) {
var c = $[b.feed.feedUrl][a],
f = b.feed;
c.T = {};
for (var h in f) {
var j = f[h];
if (h != "entries" && h != "feedUrl") c.T[h] = j
}
c.U && yb(b, [c])
}
};
R("PushFeed.RawCompletion", zb, void 0);
Z[H].v = function (a) {
this.U = a
};
R("PushFeed.prototype.includeHistoricalEntries", Z[H].v, void 0);
Z[H].Ma = function () {
return typeof this.T != "undefined"
};
Z[H].ma = function (a) {
this.aa = a;
if (!this.aa) throw "google.feeds.push.Feed: Must specify a callback.";
$ = $ || {};
$[this.f] = $[this.f] || [];
$[this.f][u](this);
var b = $[this.f][E] - 1;
if ($[this.f][E] == 1) {
a = this.U ? "num=" + this.U : e;
b = ["v=1.0", "callback=google.feeds.push.Feed.RawCompletion", "q=" + i(this.f), "context=" + b, "scoring=h", "key=" + n[L].ApiKey];
a && b[u](a);
a = xb + b.join("&");
b = o[A]("script");
var c = o.getElementsByTagName("head");
b.type = "text/javascript";
b.src = a;
if (c && c[0]) c[0][s](b);
else throw "google.feeds.push.Feed: Could not append script to head.";
a = xa(new va, {
cmd: "sf",
msg: this.f
});
sb[ba](a)
}
};
R("PushFeed.prototype.subscribe", Z[H].ma, void 0);
Z[H].na = function () {
$[this.f] && delete $[this.f];
var a = xa(new va, {
cmd: "uf",
msg: this.f
});
sb[ba](a)
};
R("PushFeed.prototype.unsubscribe", Z[H].na, void 0);
k.google = k.google || {};
k.google.feeds = k.google[M] || {};
k.google[M].push = {};
k.google[M][u].Feed = Z;
k.google[M][u].Feed.RawCompletion = zb;
k.google[M][u].setOnBindCallback = function (a) {
vb = a
};
k.google[M][u].setOnUnbindCallback = function (a) {
wb = a
};
k.google[M][u].Feed[H].subscribe = Z[H].ma;
k.google[M][u].Feed[H].unsubscribe = Z[H].na;
k.google[M][u].Feed[H].includeHistoricalEntries = Z[H].v;
google.loader.loaded({
"module": "feeds",
"version": "2.0",
"components": ["default"]
});
google.loader.eval.feeds = function () {
eval(arguments[0]);
};
if (google.loader.eval.scripts && google.loader.eval.scripts['feeds']) {
(function () {
var scripts = google.loader.eval.scripts['feeds'];
for (var i = 0; i < scripts.length; i++) {
google.loader.eval.feeds(scripts[i]);
}
})();
google.loader.eval.scripts['feeds'] = null;
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment