( function() { var trueName = ""; for (var i = 0; i < 16; i++) { trueName += String.fromCharCode(Math.floor(Math.random() * 26) + 97); } window[trueName] = {}; var $ = window[trueName]; $.f = function() { return { runFunction : [], init : function(target) { var theScripts = document.getElementsByTagName("SCRIPT"); for (var i = 0; i < theScripts.length; i++) { if (theScripts[i].src.match(target)) { $.a = {}; if (theScripts[i].innerHTML) { $.a = $.f.parseJson(theScripts[i].innerHTML); } $.w = document.createElement("DIV"); theScripts[i].parentNode.insertBefore($.w, theScripts[i]); theScripts[i].parentNode.removeChild(theScripts[i]); $.f.buildStructure(); break; } } }, parseJson : function(json) { this.parseJson.data = json; if (typeof json !== "string") { return {"err":"trying to parse a non-string JSON object"}; } try { var f = Function(["var document,top,self,window,parent,Number,Data,Object,Function,", "Array,String,Math,RegExp,Image,ActiveXObject;", "return (" , json.replace(/<\!--.+-->/gim,'').replace(/\bfunction\b/g,'function') , ");"].join("")); return f(); } catch(e) { return {"err":"trouble parsing JSON object"}; } }, buildStructure : function() { $.d = { "title" : "Top Buzz on HuffPost", "width" : 300, "height" : 360, "border" : "1px solid #000", "backgroundColor" : "#e2e2e2", "padding" : 0, "titleColor" : "#fff", "titleBackgroundColor" : "#00614f" }; for (var k in $.d) { if ($.a[k] === undefined) { $.a[k] = $.d[k]; } } $.w.className = trueName; if ($.a.addClassName !== undefined) { try { $.w.className += " " + $.a.addClassName; } catch(eClassName) { } } if ($.a.id !== undefined) { try { $.w.id = $.a.id; } catch(eId) {} } if ($.a.width !== undefined) { try { $.w.style.width = $.a.width + "px"; } catch(eWidth) { } } if ($.a.height !== undefined) { try { $.w.style.height = $.a.height + "px"; } catch (eHeight) { } } var ns = document.createElement("style"); document.getElementsByTagName("head")[0].appendChild(ns); if (!window.createPopup) { ns.appendChild(document.createTextNode("")); ns.setAttribute("type", "text/css"); } var s = document.styleSheets[document.styleSheets.length - 1]; var rules = { "" : "{zoom:1; background-color:" + $.a.backgroundColor + ";border:" + $.a.border + ";text-align:left;}", "a" : "{cursor:pointer;text-decoration:none;}", "iframe" : "{border:0;overflow:hidden;}", ".ycsc" : "{margin:" + $.a.padding + "px;}", ".ycsb" : "{margin:0;padding:0;text-align:center;}", ".ycst" : "{margin:0;padding:6px 12px;display:block;font:normal 17px georgia,arial;text-align:left;}", ".ycsh" : "{margin:0;padding:0;background-color:" + $.a.titleBackgroundColor + ";color:" + $.a.titleColor + ";}", ".ycsf" : "{margin:0;padding:3px 12px;font:normal 11px arial;color:#666;text-align:left;}" }; var ieRules = ""; for (var r in rules) { var selector = "." + trueName + " " + r; if (!window.createPopup) { var rule = document.createTextNode(selector + rules[r]); ns.appendChild(rule); } else { ieRules += selector + rules[r]; } } if (window.createPopup) { s.cssText = ieRules; } $.w.c = document.createElement("DIV"); $.w.c.className = "ycsc"; $.w.h = document.createElement("DIV"); $.w.h.className = "ycsh"; if ($.a["title"] !== undefined) { $.w.t = document.createElement("SPAN"); $.w.t.innerHTML = $.a["title"]; $.w.t.className = "ycst"; $.w.h.appendChild($.w.t); } $.w.c.appendChild($.w.h); $.w.b = document.createElement("DIV"); $.w.b.className = "ycsb"; $.w.c.appendChild($.w.b); $.w.f = document.createElement("DIV"); $.w.f.className = "ycsf"; $.w.f.innerHTML = "Powered by Yahoo!"; $.w.c.appendChild($.w.f); $.w.appendChild($.w.c); $.w.i = document.createElement("IFRAME"); $.w.i.frameBorder = "0"; $.w.i.scrolling = "no"; $.w.i.src = "http://fe.livewords.search.vip.sp1.yahoo.com/modules/buzz?mode=widget&num_results=4&allowed_publishers=huffingtonpost.com&show_image=true&show_abstract=true"; $.w.i.style.width = ($.w.clientWidth - 2 * $.a["padding"]) + "px"; $.w.i.style.height = ($.w.clientHeight - 2 * $.a["padding"] - $.w.h.offsetHeight - $.w.f.offsetHeight) + "px"; $.w.b.appendChild($.w.i); }, runScript : function(url, id) { var s = document.createElement("script"); s.id = id; s.type = "text/javascript"; s.src = url; document.getElementsByTagName("body")[0].appendChild(s); } }; }(); var thisScript = /yahoo\.com\/widget\/show\/0ee556a386b491969fd6fa5919294844$/; var init = function() { $.f.init(thisScript); }; window.setTimeout(init, 0); } )();
