Skip to content

Instantly share code, notes, and snippets.

@jonleighton
Created July 26, 2014 10:19
Show Gist options
  • Save jonleighton/562da353853cd7f2e701 to your computer and use it in GitHub Desktop.
Save jonleighton/562da353853cd7f2e701 to your computer and use it in GitHub Desktop.
(function() {
function m() {
n = location.protocol + "//" + location.host + "/";
r = t.ExtGuid;
i = t.Version;
s = t.PartnerId;
o = t.NameShort4;
c = t.AdServer;
u = t.AdCacheBuster;
f = t.cacheVersion || f;
l = t.hostDomain || l;
h = t.CountryCode || h;
a = "//" + t.AdHostDomain + "/au"
}
function g(e) {
return document.createElement(e)
}
function y(e, t) {
e.appendChild(t)
}
function b(e, t, n, r) {
if (e.addEventListener) {
e.addEventListener(t, function(e) {
n(e, r)
}, false)
} else if (e.attachEvent) {
e.attachEvent("on" + t, function(e) {
n(e, r)
})
} else {
e["on" + t] = function(e) {
n(e, r)
}
}
}
function w() {
C("3539")
}
function E(e) {
var t = "";
switch (e) {
case "300x250":
default:
t = "ad-300-c";
break;
case "728x90":
t = "ad-728-c";
break;
case "160x600":
t = "ad-160-c";
break
}
return t
}
function S(e) {
var n = "";
switch (e) {
case "ad-300-c":
default:
n = t.Ad300;
break;
case "ad-728-c":
n = t.Ad728;
break;
case "ad-160-c":
n = t.Ad160;
break
}
return n
}
function x(e) {
p++;
return a + "/" + e + ".html?ccg=" + r + "&ccv=" + i + "&pid=" + s + "&hu=" + encodeURIComponent(n) + "&ns=" + o + "&me=NA" + "&cv=" + f + "&cc=" + h + "&inc=" + p + "&epk=" + S(e) + "&as=" + c
}
function T(e, t, n, r, i, s, o) {
var u = r;
u.innerHTML = "";
r.style.cssText = "margin: 0; height: " + s + "px; width: " + o + "px;" + "text-align: left; background-color: #ffffff; padding: 0; border: 1px solid #33adff;" + "font-size: 10px; font-weight: normal; font-family: Arial;" + "-webkit-box-shadow: inset 3px -3px 25px 0 #33adff, inset -1px 1px 4px 0 #c2f3ff;" + "-moz-box-shadow: inset 3px -3px 25px 0 #33adff, inset -1px 1px 4px 0 #c2f3ff;" + "-ms-box-shadow: inset 3px -3px 25px 0 #33adff, inset -1px 1px 4px 0 #c2f3ff;" + "box-shadow: inset 3px -3px 25px 0 #33adff, inset -1px 1px 4px 0 #c2f3ff;";
var a = g("div");
var f = i == "728x90" ? "0" : "25";
a.style.cssText = "margin:0;padding:0;padding-bottom:" + f + "px;height:8px;width:100%;";
y(u, a);
var l = g("div");
l.innerHTML = "X";
l.style.cssText = "margin: 0px; padding: 0px; background-color: transparent; height: 12px;" + "width:" + (o - 5) + "px; font-size: 8px; color: #808080; text-align: right;" + "cursor: pointer;";
y(a, l);
b(l, "click", function() {
d.EventHelper.StopEvent(e);
t.onCloseClick(e, t);
d.EventHelper.RemoveEvent(n, "click", arguments.callee)
});
var c = g("div");
c.style.cssText = "position:relative;float:left;";
y(u, c);
var h = g("div");
h.style.cssText = "width:100%; height:15px;margin-top:5px;margin-bottom:5px;";
y(c, h);
var p = g("div");
p.style.cssText = "padding-left: 10px; height: 12px;float:left;";
y(h, p);
var v = g("input");
v.name = "offensive";
v.type = "checkbox";
v.style.cssText = "font-size: 11px; color: #000000; margin:0;";
y(p, v);
var m = g("span");
m.innerHTML = " I found this ad offensive";
m.style.cssText = "font-size: 11px; color: #000000";
y(p, m);
var w = g("div");
var E = i == "160x600" ? "padding: 4px 4px 4px 10px;" : "padding-left: 15px;";
w.style.cssText = E + "height: 12px; float:left;";
y(h, w);
var S = g("input");
S.name = "annoying";
S.type = "checkbox";
S.style.cssText = "font-size: 11px; color: #000000; margin:0;";
y(w, S);
var x = g("span");
x.innerHTML = " I found this ad annoying";
x.style.cssText = "font-size: 11px; color: #000000;";
y(w, x);
var T = g("div");
T.style.cssText = "padding: 5px; margin-left:13px; height: 12px; font-size: 10px;";
y(c, T);
var k = g("span");
k.innerHTML = "Describe your experience:";
k.style.cssText = "font-size: 11px; color: #000000;";
y(T, k);
var L = g("input");
L.name = "experience";
L.maxLength = 100;
L.style.cssText = "margin-left:5px; border: solid 1px #99e699; width: 80px; height: 12px;" + "font-size: 11px; background-color:#c2f3ff;";
y(T, L);
var A = g("input");
A.type = "button";
A.value = "Send";
A.style.cssText = "margin-left: 5px; background-color: #99e699; border: solid 0px #cccccc; " + "width: 40px; height: 14x; font-size: 11px; cursor: pointer;" + "-webkit-box-shadow: inset 1px -1px 4px 0 #000, inset -1px 1px 4px 0 #fff;" + "-moz-box-shadow: inset 1px -1px 4px 0 #000, inset -1px 1px 4px 0 #fff;" + "-ms-box-shadow: inset 1px -1px 4px 0 #000, inset -1px 1px 4px 0 #fff;" + "box-shadow: inset 1px -1px 4px 0 #000, inset -1px 1px 4px 0 #fff;" + "-webkit-border-radius: 5px 5px;-moz-border-radius: 5px 5px;" + "-ms-border-radius: 5px 5px;border-radius: 5px 5px;";
y(T, A);
b(A, "click", function() {
C("3537", "&pm=3000=" + v.checked + ";3010=" + S.checked + ";3020=" + encodeURIComponent(L.value) + ";3030=" + i);
d.EventHelper.StopEvent(e);
t.onCloseClick(e, t);
d.EventHelper.RemoveEvent(n, "click", arguments.callee)
});
var O = g("div");
var M = i == "160x600" ? "15" : "0";
var _ = i == "728x90" ? "50" : "0";
O.style.cssText = "height:90px;position:relative;float:left; padding-top:" + M + "px; margin-left:" + _ + "px;";
y(u, O);
var D = g("div");
D.innerHTML = "Ready for an even better experience?";
var P = i == "300x250" ? "7" : "0";
var H = i == "728x90" ? "0" : "10";
D.style.cssText = "font-size:16px;width:100%; text-align:center;font-style:italic;" + 'font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;' + "font-weight:bold;color:#29a329;padding-top:" + H + "px; padding-left:" + P + "px;";
y(O, D);
var B = g("div");
B.innerHTML = " Upgrade to Ad-Free!";
var j = i == "728x90" ? "left" : "none";
B.style.cssText = "font-size: 14px; color: #000000; text-align:center;padding:5px;" + 'font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; float:' + j + ";";
y(O, B);
var F = g("input");
F.value = "Upgrade!";
F.type = "button";
var I = i == "160x600" ? "50" : "120";
I = i == "728x90" ? "0" : I;
var q = i == "728x90" ? "left" : "none";
F.style.cssText = "margin-left: " + I + "px; background-color: #99e699; padding-bottom:3px; " + "border: solid 0px #cccccc; width: 65px; display:block; float:" + j + ";" + "height: 24x; font-size: 12px; cursor: pointer;padding-top:3px;" + 'font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;' + "-webkit-box-shadow: inset 1px -1px 4px 0 #000, inset -1px 1px 4px 0 #fff;" + "-moz-box-shadow: inset 1px -1px 4px 0 #000, inset -1px 1px 4px 0 #fff;" + "-ms-box-shadow: inset 1px -1px 4px 0 #000, inset -1px 1px 4px 0 #fff;" + "box-shadow: inset 1px -1px 4px 0 #000, inset -1px 1px 4px 0 #fff;" + "-webkit-border-radius: 5px 5px;-moz-border-radius: 5px 5px;" + "-ms-border-radius: 5px 5px;border-radius: 5px 5px;";
y(O, F);
b(F, "click", function() {
N();
d.EventHelper.StopEvent(e);
t.onCloseClick(e, t);
d.EventHelper.RemoveEvent(n, "click", arguments.callee)
});
var R = g("div");
R.innerHTML = "50% Discount!";
var U = i == "728x90" ? "left" : "none";
R.style.cssText = "font-size: 14px; color: #000000; text-align:center; float:" + j + ";" + 'padding:5px;font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;';
y(O, R)
}
function N() {
window.open("http://www." + l + "/upgrade.html?userid=" + r + "&pr=1")
}
function C(e, t) {
var u = new Image;
var a = "http://l." + l + "/l" + "?e=" + r + "&ns=" + o + "&p=" + s + "&v=" + i + "&hu=" + encodeURIComponent(n) + "&c=" + e;
if (t) a = a + t;
u.src = a
}
function k() {
if (!t) {
return
}
if (A()) {
return
}
m();
L();
setInterval(L, 5e3)
}
function L() {
_.run()
}
function A() {
return d.BrowserHelper.Browser.msie && (document.documentMode == 7 || document.documentMode == 5)
}
function D(e, t, n, r, i, s, o, u, a, f, l) {
this.adHeight = r;
this.adWidth = e;
this.widthUpperBound = t;
this.widthLowerBound = n;
this.heightUpperBound = i;
this.heightLowerBound = s;
this.adIndex = o;
this.adType = u;
this.placementWidth = a;
this.placementHeight = f;
this.maxAdsToBeShown = l;
this.numberOfAdsDisplayed = 0
}
function P() {
var e = this;
this.mainClass = null;
this.adType = "";
this.additionalAd = {};
this.nativeAd = {};
this.parent = {};
this.type = null;
this.frameType = null;
this.isClosed = false;
this.isPlaced = false;
this.isRemoved = false;
this.deleteCssFuncs = [];
this.intervalForCorrectingAdditionalAdPos = 2e3;
this.intervalIdForCorrectingAdditionalAdPos = null;
this.place = function() {};
this.placeAdditionalAd = function() {};
this.createWrapper = function() {};
this.fixNativeAd = function() {};
this.runCheckStateOfNativeAd = function() {};
this.reviewParentStyles = function() {};
this.deleteAdditionalAd = function() {};
this.defineNativeAdPosition = function() {
var e = d.CSSHelper.GetOffset(this.nativeAd.el),
t = parseInt(d.CSSHelper.CurCSS(this.nativeAd.el, "padding-top")),
n = parseInt(d.CSSHelper.CurCSS(this.nativeAd.el, "padding-left"));
t = isNaN(t) ? 0 : t;
n = isNaN(n) ? 0 : n;
this.nativeAd.position = {};
this.nativeAd.position.top = e.top + t;
this.nativeAd.position.left = e.left + n
};
this.checkNativeAdOutsideThePage = function(e) {
var t = e.nativeAd.position,
n = e.frameType.placementWidth,
r = d.BrowserHelper.GetScreenSize();
if (t.left + n > r.width || t.left < 0) {
e.deleteAdditionalAd(e)
}
};
this.checkNativeAdHasSuitablePos = function(e) {
var t = true,
n = 10,
r = e.nativeAd.el,
i = "";
while (r && r.nodeName != "BODY" && n) {
--n;
i = d.CSSHelper.CurCSS(r, "position");
if (i == "fixed") {
t = false;
break
}
r = r.parentNode
}
if (!t) {
e.deleteAdditionalAd(e)
}
};
this.checkNativeAdClassesMissed = function(e) {
var t = null,
n = true;
if (e.nativeAd.el.className) {
t = e.nativeAd.el.className.split(" ");
for (var r = 0; r < e.nativeAd.classes.length; r++) {
for (var i = 0; i < t.length; i++) {
if (e.nativeAd.classes[r] == t[i]) {
n = false;
break
}
}
if (!r) {
break
}
}
}
if (n) {
e.restoreNativeAdClasses(e)
}
};
this.restoreNativeAdClasses = function(e) {
for (var t = 0; t < e.nativeAd.classes.length; t++) {
e.nativeAd.el.className += " " + e.nativeAd.classes[t]
}
};
this.createAdditionalAd = function(t, r, i) {
var s = this.createWrapper.call(this, t, r, i),
o = this.createWrapperInner(t, r),
u = this.createIframe(t, r, this.adType),
a = this.createLink(t, r),
f = this.createCloseBtn("top"),
l = this.createCloseBtn("bottom");
s.appendChild(o);
o.appendChild(u);
o.appendChild(a);
o.appendChild(f);
o.appendChild(l);
this.additionalAd.el = s;
this.correctAdditionalAdPosition(this.nativeAd.position);
d.EventHelper.AddEvent(f, "click", function(i) {
var s = n;
s = s.replace(/\=/g, "<:eq:>").replace(/\&/g, "<:amp:>").replace(/\;/g, "<:sc:>");
C("3538", "&pm=3040=" + s);
T(i, e, f, o, e.adType, r, t)
});
d.EventHelper.AddEvent(l, "click", function(i) {
var s = n;
s = s.replace(/\=/g, "<:eq:>").replace(/\&/g, "<:amp:>").replace(/\;/g, "<:sc:>");
C("3538", "&pm=3040=" + s);
T(i, e, l, o, e.adType, r, t)
});
d.EventHelper.AddEvent(o, "mouseover", function(t) {
e.onIframeHover(t, f)
});
d.EventHelper.AddEvent(o, "mouseout", function(t) {
e.onIframeOut(t, f)
});
d.EventHelper.AddEvent(o, "mouseover", function(t) {
e.onIframeHover(t, l)
});
d.EventHelper.AddEvent(o, "mouseout", function(t) {
e.onIframeOut(t, l)
})
};
this.createWrapperInner = function(e, t) {
var n = document.createElement("div");
n.style.cssText += ";" + "width: " + e + "px !important;" + "height: " + (t + 20) + "px !important;" + "padding: 0px !important;" + "margin: 0px !important;" + "position: relative !important;" + "top: 0px !important;" + "left: 0px !important;";
return n
};
this.createIframe = function(e, t, n) {
var r = document.createElement("iframe");
r.src = x(E(n));
r.setAttribute("width", e);
r.setAttribute("height", t);
r.setAttribute("scrolling", "no");
r.setAttribute("frameborder", 0);
r.setAttribute("border", 0);
r.setAttribute("fro", 1);
r.setAttribute("marginwidth", 0);
r.setAttribute("marginheight", 0);
r.setAttribute("allowtransparency", "true");
r.setAttribute(this.mainClass.attributes.viewed, "true");
r.setAttribute(this.mainClass.attributes.suitable, "false");
r.style.cssText += ";" + "border: 0px !important;" + "position: absolute !important;" + "top: 0px !important;" + "left: 0px !important;" + "padding: 0px !important;" + "margin: 0px !important;" + +"z-index: " + (this.nativeAd.el ? d.CSSHelper.CurCSS(this.nativeAd.el, "z-index") : 500) + " !important;" + "background: rgb(255, 255, 255);";
return r
};
this.createLink = function(e, n) {
var r = document.createElement("div"),
i = document.createElement("a");
r.style.cssText += ";" + "text-align: right !important;" + "font-family: arial !important;" + "font-size: 10px !important;" + "line-height: 15px !important;" + "margin: 0px 10px 0px 0px !important;" + "width: " + e + "px !important;" + "height: 15px; !important;" + "position: absolute !important;" + "bottom: 0px !important;" + "left: 0px !important;";
i.setAttribute("target", "_blank");
i.href = t.adInfoClick;
i.innerHTML = t.adInfoText;
i.style.cssText += ";" + "text-align: right !important;" + "color: #555555 !important;" + "font-family: arial !important;" + "line-height: 15px !important;" + "text-decoration: none !important;" + "font-size: 9px !important;" + "font-style: normal !important;" + "cursor: pointer !important;" + "border: none !important;" + "padding-right: 5px !important;" + "background: transparent !important;" + "display: inline !important;";
b(i, "click", w);
r.appendChild(i);
return r
};
this.createCloseBtn = function(e) {
var n = document.createElement("div"),
r = document.createElement("div"),
i = 16,
s = 16;
n.style.cssText += ";" + "display: none !important;" + "text-align: right !important;" + "font-family: Verdana !important;" + "font-size: xx-small !important;" + "line-height: 8px !important;" + "width: " + i + "px !important;" + "height: " + s + "px !important;" + "background-color: #FFFFFF !important;" + "color: #33cc00 !important;" + "cursor: pointer !important;" + "font-weight: bold !important;" + "position: absolute !important;" + "right: 0px !important;" + "z-index: 1000000000 !important;";
if (e == "top") {
n.style.top = "0px"
} else if (e == "bottom") {
n.style.bottom = "20px"
}
r.className = "i" + t.ExtGuid;
r.innerHTML = "X";
r.style.cssText += ";" + "width: " + i + "px !important;" + "height: " + s + "px !important;" + "text-align: right !important;" + "font-family: Verdana !important;" + "font-size: xx-small !important;" + "line-height: 8px !important;" + "color: #555555 !important;" + "position: absolute !important;" + "top: 3px !important;" + "right: 4px !important;";
n.appendChild(r);
return n
};
this.incrementCounter = function(e) {
e.numberOfAdsDisplayed += 1
};
this.decrementCounter = function(e) {
e.numberOfAdsDisplayed -= 1
};
this.onIframeHover = function(e, t) {
t.style.cssText += "; display: block !important;"
};
this.onIframeOut = function(e, t) {
t.style.cssText += "; display: none !important;"
};
this.onCloseClick = function(e, t) {
t.deleteAdditionalAd(t);
t.isClosed = true
};
this.deleteAllCSSFixScripts = function(e) {
var t = e.mainClass.allAds,
n = null;
for (var r in t) {
var i = t[r].adsObj;
for (var s in i) {
if (s == "length") {
continue
}
if (i[s].isRemoved || !i[s].isPlaced) {
continue
}
for (var o = 0; o < i[s].deleteCssFuncs.length; o++) {
i[s].deleteCssFuncs[o]()
}
i[s].deleteCssFuncs = [];
n = i[s].nativeAd.nativeStyles;
for (var u in n) {
i[s].nativeAd.el.style.cssText += ";" + u + ": " + n[u] + ";"
}
}
}
};
this.restoreAllCSSFixScripts = function(e) {
var t = e.mainClass.allAds;
for (var n in t) {
var r = t[n].adsObj;
for (var i in r) {
if (i == "length") {
continue
}
if (r[i].isRemoved || !r[i].isPlaced) {
continue
}
r[i].fixNativeAd.call(r[i])
}
}
e.reviewAllParents(e.mainClass.allAds)
};
this.reviewAllParents = function(e) {
var t = e,
n = null;
for (var r in t) {
var i = t[r].adsObj;
for (var s in i) {
if (s == "length") {
continue
}
n = i[s];
if (!n.isRemoved && n.isPlaced) {
n.reviewParentStyles(n.parent.el)
}
}
}
};
this.reviewParentHeight = function(e) {
if (d.CSSHelper.CurCSS(e, "overflow-y") == "auto") {
return
}
var t = parseFloat(d.CSSHelper.CurCSS(e, "padding-top")),
n = parseFloat(d.CSSHelper.CurCSS(e, "padding-bottom")),
r = d.CSSHelper.GetWidthOrHeight(e, "height") - t - n,
i = d.CSSHelper.GetOffset(e),
s = this.getChildsLowerBound(e),
o = 0,
u = null,
a = "";
if (s > i.top + t + r) {
o = s - (i.top + t + r)
}
if (o > 0) {
u = this.random(0, 1e5);
e.className += " " + "fix" + u;
a += ".fix" + u + "{" + "height: " + (r + o + 10) + "px !important;" + "max-height: " + (r + o + 10) + "px !important;" + "min-height: " + (r + o + 10) + "px !important;" + "}";
this.deleteCssFuncs.push(R("", a))
}
};
this.reviewParentMargin = function(e) {
var t = parseInt(d.CSSHelper.CurCSS(e, "margin-top")),
n = null,
r = "";
t = isNaN(t) ? 0 : t;
if (t < 0) {
n = this.random(0, 1e5);
e.className += " " + "fix" + n;
r += ".fix" + n + "{" + "margin-top: 0px !important;" + "}";
this.deleteCssFuncs.push(R("", r))
}
};
this.getChildsLowerBound = function(e) {
var t = null,
n = 0,
r = 0,
i = "",
s = "",
o = 0,
u = 0,
a = 0,
f = 0,
l = d.CSSHelper.GetOffset(e),
c = d.CSSHelper.GetWidthOrHeight(e, "height"),
h = d.CSSHelper.GetWidthOrHeight(e, "width"),
p = parseFloat(d.CSSHelper.CurCSS(e, "padding-bottom"));
p = isNaN(p) ? 0 : p;
for (var v = 0, m = null; v < e.childNodes.length; v++) {
m = e.childNodes[v];
if (m.nodeName == "#text") {
continue
}
if (m.nodeName == "#comment") {
continue
}
if (m.nodeName == "STYLE") {
continue
}
if (m.nodeName == "SCRIPT") {
continue
}
if (m.nodeName == "NOSCRIPT") {
continue
}
if (m.tagName == "TD" || m.tagName == "TR") {
continue
}
i = d.CSSHelper.CurCSS(m, "position");
if (i == "fixed") {
continue
}
if (d.CSSHelper.CurCSS(m, "display") == "none" || d.CSSHelper.CurCSS(m, "visibility") == "hidden") {
continue
}
t = d.CSSHelper.GetOffset(m);
n = d.CSSHelper.GetWidthOrHeight(m, "height") - parseInt(d.CSSHelper.CurCSS(m, "padding-top")) - parseInt(d.CSSHelper.CurCSS(m, "padding-bottom"));
if (n == 0) {
continue
}
if (i == "absolute") {
r = d.CSSHelper.GetWidthOrHeight(m, "width");
if (t.left >= 0 && l.left + h < t.left + r) {
continue
}
o = parseInt(d.CSSHelper.CurCSS(m, "bottom"));
if (p && !isNaN(o) && o + n <= p) {
continue
}
}
s = d.CSSHelper.CurCSS(m, "float");
if (s == "left" || s == "right") {
if (l.top + c <= t.top && c > 0) {
continue
}
}
u = parseInt(d.CSSHelper.CurCSS(m, "margin-bottom"));
a = parseInt(d.CSSHelper.CurCSS(m, "padding-bottom"));
if (u != 0 && a == -1 * u) {
var g = "" + "margin-bottom: 0px !important;" + "padding-bottom: 0px !important;";
this.fixElem(m, g)
}
if (f < t.top + n) {
f = t.top + n
}
}
return f
};
this.fixElem = function(e, t) {
var n = this.random(0, 1e5);
e.className += " " + "fix" + n;
t = ".fix" + n + "{" + t + "}";
this.deleteCssFuncs.push(R("", t))
};
this.getNumOfPlacedAd = function(e) {
var t = 0;
for (var n in e) {
var r = e[n].adsObj;
for (var i in r) {
if (i == "length") {
continue
}
t += r[i].frameType.numberOfAdsDisplayed;
break
}
}
return t
};
this.getNumOfClosedAd = function(e) {
var t = 0;
for (var n in e) {
var r = e[n].adsObj;
for (var i in r) {
if (i == "length") {
continue
}
if (r[i].isClosed) {
t++
}
}
}
return t
};
this.verifyTheNeedAddListenerOnDOMModified = function() {
var e = this.getNumOfPlacedAd(this.mainClass.allAds),
t = this.getNumOfClosedAd(this.mainClass.allAds);
if (!e || e == t) {
this.addListenerOnDOMModified()
}
};
this.verifyTheNeedRemoveListenerOnDOMModified = function() {
var e = this.getNumOfPlacedAd(this.mainClass.allAds),
t = this.getNumOfClosedAd(this.mainClass.allAds);
if (!e || e == t) {
this.removeListenerOnDOMModified()
}
};
this.addListenerOnDOMModified = function() {
this.intervalIdForCorrectingAdditionalAdPos = setInterval(this.onDOMSubtreeModified, this.intervalForCorrectingAdditionalAdPos)
};
this.removeListenerOnDOMModified = function() {
var t = e.mainClass.allAds,
n = null;
for (var r in t) {
var i = t[r].adsObj;
for (var s in i) {
if (s == "length") {
continue
}
if (i[s].intervalIdForCorrectingAdditionalAdPos) {
clearInterval(i[s].intervalIdForCorrectingAdditionalAdPos);
i[s].intervalIdForCorrectingAdditionalAdPos = null;
break
}
}
}
};
this.onDOMSubtreeModified = function(t) {
e.checkForCorrectionAdditionalAdPosition()
};
this.checkForCorrectionAdditionalAdPosition = function() {
var t = e.mainClass.allAds,
n = null;
for (var r in t) {
var i = t[r].adsObj;
for (var s in i) {
if (s == "length") {
continue
}
if (i[s].isRemoved || !i[s].isPlaced) {
continue
}
var o = i[s].nativeAd.lastPosition;
i[s].defineNativeAdPosition();
if (o.top != i[s].nativeAd.position.top || o.left != i[s].nativeAd.position.left) {
n = {};
n.top = i[s].nativeAd.position.top - (i[s].frameType.placementHeight + 20);
n.left = i[s].nativeAd.position.left;
if (n.top < 0 || n.left < 0) {
i[s].deleteAdditionalAd(i[s]);
continue
}
var u = d.BrowserHelper.GetDocumentScroll();
i[s].deleteAllCSSFixScripts(i[s]);
i[s].restoreAllCSSFixScripts(i[s]);
d.BrowserHelper.SetDocumentScroll(u.left, u.top);
i[s].defineNativeAdPosition();
i[s].nativeAd.lastPosition = i[s].nativeAd.position;
i[s].correctAdditionalAdPosition(n)
}
}
}
};
this.correctAdditionalAdPosition = function(e) {
if (!e) {
return
}
this.additionalAd.position = e;
this.additionalAd.el.style.cssText += ";" + "top: " + e.top + "px !important;" + "left: " + e.left + "px !important;"
};
this.random = I;
return this
}
function I(e, t) {
return Math.floor(Math.random() * (t - e + 1) + e)
}
function q(e, t, n, r) {
var i = r,
s = 0;
if (!e) {
return false
}
e = e.parentNode;
if (!e) {
return false
}
if (typeof r === "undefined") {
i = "unlimited"
}
while (e.nodeName !== "#document") {
if (i !== "unlimited" && s == i) {
break
}
s++;
if (t == "display" && n == "none") {
if (d.CSSHelper.CurCSS(e, t) == n && d.CSSHelper.CurCSS(e, "_overflow") != "visible") {
return true
}
} else {
if (d.CSSHelper.CurCSS(e, t) == n) {
return true
}
}
e = e.parentNode
}
return false
}
function R(e, t) {
var n = null,
r = null,
i = function() {};
if (e) {
n = document.getElementsByTagName("head")[0];
if (!n) {
return i
}
r = document.createElement("link");
r.rel = "stylesheet";
r.type = "text/css";
r.href = e;
n.appendChild(r);
i = function() {
n.removeChild(r)
}
} else if (t) {
if (typeof document.createStyleSheet !== "undefined") {
try {
r = document.createStyleSheet();
r.cssText = t;
n = r.owningElement;
i = function() {
n.removeNode(r)
}
} catch (s) {}
} else {
n = document.getElementsByTagName("head")[0];
if (!n) {
return i
}
r = document.createElement("style");
r.type = "text/css";
if (r.styleSheet) {
r.styleSheet.cssText = t
} else {
r.appendChild(document.createTextNode(t))
}
n.appendChild(r);
i = function() {
n.removeChild(r)
}
}
}
return i
}
function U(e, t) {
var n = t.size.width;
var r = t.size.height;
var i = t.pos.x;
var s = t.pos.y;
var o = i;
var u = i + n;
var a = s;
var f = s + r;
var l = e.size.width;
var c = e.size.height;
var h = e.pos.x;
var p = e.pos.y;
if ((h + l >= o && h + l <= u || h <= u && h >= o) && p + c >= a && p <= f) {
return true
}
return false
}
function z(e) {
if (v && typeof console.log != "undefined") {
console.log(e)
}
}
var e = e || window,
t = e.OvadColdetConfig,
n = "",
r = "",
i = "",
s = "",
o = "",
u = "46b758ac",
a = "",
f = 1,
l = "",
c = "",
h = " ",
p = 0,
d = {},
v = false;
var O = function(e) {
function a(e, t, n) {
var i = e.childNodes;
if (typeof arguments.callee.config == "undefined") {
arguments.callee.config = {};
arguments.callee.config.adTemplates = {}
}
if (typeof arguments.callee.config.adTemplates[n] == "undefined") {
arguments.callee.config.adTemplates[n] = []
}
for (var s = 0, o = null; s < i.length; s++) {
if (t.numberOfAdsDisplayed == t.maxAdsToBeShown) {
break
}
o = i[s];
if (!c(o)) {
if (e.config && e.config.adTemplates[n]) {
if (e.config.elems.validNodes[n].getAttribute(r.suitable) != "true") {
e.config.elems.validNodes[n].setAttribute(r.suitable, "true");
arguments.callee.config.adTemplates[n].push({
elem: e.config.elems.validNodes[n],
adTemplate: e.config.adTemplates[n]
});
e.config.adTemplates[n].numberOfAdsDisplayed += 1
}
} else {
continue
}
} else {
if (typeof o.config == "undefined") {
o.config = {};
o.config.elems = {};
o.config.elems.validNodes = {};
o.config.adTemplates = {}
}
o.config.adTemplates[n] = h(t, o);
if (o.config.adTemplates[n]) {
o.config.elems.validNodes[n] = o
}
if (e.config && !o.config.adTemplates[n] && e.config.adTemplates[n]) {
o.config.adTemplates[n] = e.config.adTemplates[n];
o.config.elems.validNodes[n] = e.config.elems.validNodes[n]
}
if (o.getElementsByTagName("*").length) {
arguments.callee(o, t, n)
} else {
if (o.config.adTemplates[n]) {
if (o.config.elems.validNodes[n].getAttribute(r.suitable) != "true") {
o.config.elems.validNodes[n].setAttribute(r.suitable, "true");
arguments.callee.config.adTemplates[n].push({
elem: o.config.elems.validNodes[n],
adTemplate: o.config.adTemplates[n]
});
o.config.adTemplates[n].numberOfAdsDisplayed += 1
}
}
}
}
}
return arguments.callee.config.adTemplates[n]
}
function f(e) {
for (var t = 0; t < e.length; t++) {
l(e[t], s, n)
}
}
function l(e, n, r) {
var i = "",
s = null,
o = e.adTemplate,
u = e.elem;
if (!n[o.adIndex]) {
n[o.adIndex] = {};
n[o.adIndex].adsObj = {};
n[o.adIndex].adsObj.length = 0
}
n[o.adIndex].adsObj.length++;
i = r + "-" + o.adIndex + "-" + n[o.adIndex].adsObj.length;
s = new P;
s.place = m;
s.placeAdditionalAd = y;
s.fixNativeAd = b;
s.createWrapper = w;
s.runCheckStateOfNativeAd = g;
s.deleteAdditionalAd = S;
s.reviewParentStyles = E;
s.mainClass = t;
s.adType = o.adType;
s.parent.el = u;
s.additionalAd.id = i;
s.frameType = o;
n[o.adIndex].adsObj[i] = s;
s.place.call(s, i)
}
function c(e) {
if (e.nodeName == "#text" || e.nodeName == "#comment" || e.nodeName == "STYLE" || e.nodeName == "SCRIPT" || e.nodeName == "NOSCRIPT" || e.nodeName == "HEAD" || e.nodeName == "UL" || e.nodeName == "IMG" || e.nodeName == "IFRAME" || e.nodeName == "OBJECT" || e.nodeName == "EMBED" || e.nodeName == "A" || d.CSSHelper.CurCSS(e, "position") == "absolute" || d.CSSHelper.CurCSS(e, "position") == "fixed" || d.CSSHelper.CurCSS(e, "display") == "none") {
return false
}
return true
}
function h(t, n) {
var r = 0,
i = 0,
o = 0,
u = 0,
a = null,
f = null,
l = null;
if (t.numberOfAdsDisplayed == t.maxAdsToBeShown) {
return null
}
r = d.CSSHelper.GetWidthOrHeight(n, "width");
i = d.CSSHelper.GetWidthOrHeight(n, "height");
o = parseInt(d.CSSHelper.CurCSS(n, "border-left-width"));
o = isNaN(o) ? 0 : o;
u = parseInt(d.CSSHelper.CurCSS(n, "border-right-width"));
u = isNaN(u) ? 0 : u;
r -= o + u;
if ((r >= t.adWidth - t.widthLowerBound || t.widthLowerBound == "unlimited") && (r <= t.adWidth + t.widthUpperBound || t.widthUpperBound == "unlimited")) {
if ((i >= t.adHeight - t.heightLowerBound || t.heightLowerBound == "unlimited") && (i <= t.adHeight + t.heightUpperBound || t.heightUpperBound == "unlimited")) {
a = d.BrowserHelper.GetScreenSize();
f = d.BrowserHelper.GetDocumentScroll();
l = d.CSSHelper.GetOffset(n);
if (f.top + a.height > l.top) {
if (!p(t.placementWidth, t.placementHeight, n, s) && !p(t.placementWidth, t.placementHeight, n, e.overAds.allAds)) {
return t
}
}
}
}
return null
}
function p(e, t, n, r) {
var i = 300,
s = d.CSSHelper.GetOffset(n),
o = d.CSSHelper.GetWidthOrHeight(n, "width"),
u = null,
a = 0,
f = 0,
l = null,
c = {},
h = {};
c.size = {};
c.pos = {};
h.size = {};
h.pos = {};
for (var p in r) {
var v = r[p].adsObj,
m = null;
for (var g in v) {
if (g == "length") {
continue
}
if (v[g].isRemoved) {
continue
}
if (!v[g].isPlaced) {
continue
}
m = v[g].additionalAd.el;
a = v[g].frameType.placementWidth;
f = v[g].frameType.placementHeight;
u = d.CSSHelper.GetOffset(m);
l = {};
l.top = s.top;
l.left = s.left + (o - e) / 2;
if (u.top < l.top) {
c.size.width = e;
c.size.height = t;
c.pos.x = l.left;
c.pos.y = l.top;
h.size.width = a;
h.size.height = f + i;
h.pos.x = u.left;
h.pos.y = u.top
} else {
c.size.width = a;
c.size.height = f;
c.pos.x = u.left;
c.pos.y = u.top;
h.size.width = e;
h.size.height = t + i;
h.pos.x = l.left;
h.pos.y = l.top
} if (U(c, h)) {
return true
}
}
}
return false
}
function v(e) {
var t = "160x600",
n = true;
for (var r = 0; r < e.length; r++) {
if (e[r].adType !== t) {
if (!e[r].numberOfAdsDisplayed > 0) {
n = false;
break
}
}
}
return !n
}
var t = this,
e = e,
n = "ColDet",
r = {
viewed: "viewed",
suitable: "suitable"
},
i = [],
s = {};
t.attributes = r;
t.allAds = s;
var o = function() {
i.push(new D(300, 500 - 300, 0, 400, "unlimited", 0, "300x250", "300x250", 300, 250, 1));
i.push(new D(728, 900 - 728, 0, 400, "unlimited", 0, "728x90", "728x90", 728, 90, 1));
i.push(new D(160, 225 - 160, 0, 400, "unlimited", 0, "160x600", "160x600", 160, 600, 1))
};
var u = function() {
var e = "";
for (var t = 0; t < i.length; t++) {
if (!v(i)) {
return
}
if (i[t].numberOfAdsDisplayed == i[t].maxAdsToBeShown) {
continue
}
e = "r" + I(0, 1e5);
f(a(document.documentElement, i[t], e))
}
};
t.run = u;
var m = function(e) {
this.createAdditionalAd(this.frameType.placementWidth, this.frameType.placementHeight, e);
this.placeAdditionalAd.call(this);
this.fixNativeAd();
this.isPlaced = true;
this.runCheckStateOfNativeAd(this);
this.reviewParentStyles.call(this, this.parent.el)
};
var g = function(e) {
var t = 1e3,
n = null,
r = null,
i = null,
s = function() {
n = e.parent.el;
r = e.additionalAd.el;
if (!d.DOMHelper.Contains(r)) {
o()
} else {
if (q(n, "display", "none", 10) || q(r, "display", "none", 10)) {
o()
}
}
},
o = function() {
e.deleteAdditionalAd(e);
if (!e.isClosed) {
e.decrementCounter(e.frameType);
n.removeAttribute(this.mainClass.attributes.suitable)
}
clearInterval(i);
i = null
};
i = setInterval(s, t)
};
var y = function() {
d.DOMHelper.InsertNode(this.parent.el, this.additionalAd.el, "prepend")
};
var b = function() {
this.nativeAd.classes = [];
this.nativeAd.nativeStyles = {};
if (this.additionalAd.el.nextElementSibling) {
var e = parseInt(d.CSSHelper.CurCSS(this.additionalAd.el.nextElementSibling, "margin-top")),
t = I(0, 1e5),
n = "";
if (e < 0) {
this.additionalAd.el.nextElementSibling.className += " " + "fix" + t;
n += ".fix" + t + "{" + "margin-top: 0px !important;" + "}";
this.deleteCssFuncs.push(R("", n))
}
}
};
var w = function(e, t, n) {
var r = document.createElement("div");
r.id = n;
r.style.cssText += ";" + "width: " + e + "px !important;" + "height: auto !important;" + "padding: 0 !important;" + "margin: 0 auto !important;" + "z-index: 9999999999999;" + "padding: 10px 0 !important;";
return r
};
var E = function(e) {
var t = 10,
n = e;
while (n && n.nodeName != "BODY" && t) {
if (n.nodeName == "A" || n.nodeName == "OBJECT" || n.nodeName == "EMBED") {
n = n.parentNode;
continue
}--t;
this.reviewParentHeight(n);
n = n.parentNode
}
};
var S = function(e) {
if (e.additionalAd.el) {
if (e.additionalAd.el.parentNode) {
e.additionalAd.el.parentNode.removeChild(e.additionalAd.el)
}
}
if (e.isPlaced) {
e.deleteAllCSSFixScripts(e)
}
e.isRemoved = true;
if (e.isPlaced) {
e.restoreAllCSSFixScripts(e)
}
};
o()
};
var M = function(e) {
function h(e, t, n, r) {
var i = 300,
s = d.CSSHelper.GetOffset(n),
o = d.CSSHelper.GetWidthOrHeight(n, "width"),
u = null,
a = 0,
f = 0,
l = null,
c = {},
h = {};
c.size = {};
c.pos = {};
h.size = {};
h.pos = {};
for (var p in r) {
var v = r[p].adsObj,
m = null;
for (var g in v) {
if (g == "length") {
continue
}
if (v[g].isRemoved) {
continue
}
if (!v[g].isPlaced) {
continue
}
m = v[g].additionalAd.el;
a = v[g].frameType.placementWidth;
f = v[g].frameType.placementHeight;
u = d.CSSHelper.GetOffset(m);
l = {};
l.top = s.top;
l.left = s.left + (o - e) / 2;
if (u.top < l.top) {
c.size.width = e;
c.size.height = t;
c.pos.x = l.left;
c.pos.y = l.top;
h.size.width = a;
h.size.height = f + i;
h.pos.x = u.left;
h.pos.y = u.top
} else {
c.size.width = a;
c.size.height = f;
c.pos.x = u.left;
c.pos.y = u.top;
h.size.width = e;
h.size.height = t + i;
h.pos.x = l.left;
h.pos.y = l.top
} if (U(c, h)) {
return true
}
}
}
return false
}
var t = this,
e = e,
n = "OverAds",
r = {
viewed: "viewed",
pusher: "pusher",
adType: "adType",
sideBySide: "sideBySide",
suitable: "suitable"
},
i = [],
s = {},
o = ["iframe", "img", "object", "embed"];
t.attributes = r;
t.allAds = s;
var u = function() {
i.push(new D(300, 5, 5, 250, 5, 5, "300x250", "300x250", 300, 250, 3));
i.push(new D(160, 5, 5, 600, 5, 5, "160x600", "160x600", 160, 600, 1));
i.push(new D(300, 5, 5, 600, 305, 5, "300x600", "300x250", 300, 250, 1))
};
var a = function() {
try {
if (p(i)) {
return
}
for (var e = 0; e < o.length; e++) {
var t = document.getElementsByTagName(o[e]);
f(t, o[e], n)
}
l(s);
c(s)
} catch (r) {
z("run ERROR:" + r)
}
};
t.run = a;
var f = function(e, n, i) {
try {
var o = e.length;
for (var u = 0; u < o; u++) {
var a = w(e[u], n);
if (a != null) {
var f = null,
l = e[u],
c = "";
if (b(l)) {
continue
}
if (l.nodeName == "OBJECT") {
if (l.parentNode.nodeName == "OBJECT") {
if (d.CSSHelper.GetWidthOrHeight(l, "height") <= d.CSSHelper.GetWidthOrHeight(l.parentNode, "height")) {
l.nodeName.setAttribute(r.suitable, "false");
l.nodeName.setAttribute(r.viewed, "true");
continue
} else {
l.parentNode.nodeName.setAttribute(r.suitable, "false");
l.parentNode.nodeName.setAttribute(r.viewed, "true")
}
}
if (l.getElementsByTagName("OBJECT").length > 0) {
if (d.CSSHelper.GetWidthOrHeight(l.getElementsByTagName("OBJECT")[0], "height") <= d.CSSHelper.GetWidthOrHeight(l, "height")) {
l.getElementsByTagName("OBJECT")[0].setAttribute(r.suitable, "false");
l.getElementsByTagName("OBJECT")[0].setAttribute(r.viewed, "true")
} else {
l.setAttribute(r.suitable, "false");
l.setAttribute(r.viewed, "true");
continue
}
}
if (l.getElementsByTagName("EMBED").length > 0) {
if (d.CSSHelper.GetWidthOrHeight(l.getElementsByTagName("EMBED")[0], "height") > d.CSSHelper.GetWidthOrHeight(l, "height")) {
l.setAttribute(r.suitable, "false");
l.setAttribute(r.viewed, "true");
continue
} else {
l.getElementsByTagName("EMBED")[0].setAttribute(r.suitable, "false");
l.getElementsByTagName("EMBED")[0].setAttribute(r.viewed, "true")
}
}
} else if (l.nodeName == "EMBED" && l.parentNode.nodeName == "OBJECT") {
if (d.CSSHelper.GetWidthOrHeight(l, "height") < d.CSSHelper.GetWidthOrHeight(l.parentNode, "height")) {
l.setAttribute(r.suitable, "false");
l.setAttribute(r.viewed, "true");
continue
} else {
l.parentNode.setAttribute(r.suitable, "false");
l.parentNode.setAttribute(r.viewed, "true")
}
}
f = l.parentNode;
if (g(l)) {
continue
}
if (!y(l)) {
continue
}
if (v(l)) {
continue
}
if (m(l)) {
continue
}
if (!s[a.adIndex]) {
s[a.adIndex] = {};
s[a.adIndex].adsObj = {};
s[a.adIndex].adsObj.length = 0
}
s[a.adIndex].adsObj.length++;
c = i + "-" + a.adIndex + "-" + s[a.adIndex].adsObj.length;
var h = new P;
h.place = C;
h.placeAdditionalAd = L;
h.fixNativeAd = A;
h.createWrapper = k;
h.runCheckStateOfNativeAd = O;
h.deleteAdditionalAd = _;
h.reviewParentStyles = M;
h.mainClass = t;
h.adType = a.adType;
h.parent.el = f;
h.nativeAd.el = l;
h.additionalAd.id = c;
h.type = l.nodeName.toLowerCase();
h.frameType = a;
h.defineNativeAdPosition();
h.checkNativeAdOutsideThePage(h);
h.checkNativeAdHasSuitablePos(h);
s[a.adIndex].adsObj[c] = h;
h.nativeAd.el.setAttribute(r.viewed, "true");
h.nativeAd.el.setAttribute(r.pusher, c);
h.nativeAd.el.setAttribute(r.adType, a.adIndex)
}
}
} catch (p) {
z("checkForAdContainer *** error = " + p)
}
};
var l = function(e) {
var t = 200,
n = 10,
i = null,
s = null;
for (var o in e) {
var u = e[o].adsObj;
for (var a in u) {
if (a == "length") {
continue
}
for (var f in u) {
if (f == "length") {
continue
}
if (a == f) {
continue
}
if (u[a].isRemoved || u[f].isRemoved) {
continue
}
if (!d.DOMHelper.Contains(u[a].nativeAd.el)) {
u[a].deleteAdditionalAd(u[a]);
continue
}
if (!d.DOMHelper.Contains(u[f].nativeAd.el)) {
u[f].deleteAdditionalAd(u[f]);
continue
}
if (u[a].isPlaced) {
i = u[a].additionalAd.position;
s = u[f].nativeAd.position
} else if (u[f].isPlaced) {
i = u[a].nativeAd.position;
s = u[f].additionalAd.position
} else {
i = u[a].nativeAd.position;
s = u[f].nativeAd.position
} if (Math.abs(i.top - s.top) <= n && i.left != s.left) {
if (i.left < s.left) {
if (s.left - (i.left + d.CSSHelper.GetWidthOrHeight(u[a].nativeAd.el, "width")) < t) {
if (u[a].nativeAd.el.getAttribute(r.sideBySide)) {
u[f].nativeAd.el.setAttribute(r.sideBySide, u[a].nativeAd.el.getAttribute(r.sideBySide))
} else if (u[f].nativeAd.el.getAttribute(r.sideBySide)) {
u[a].nativeAd.el.setAttribute(r.sideBySide, u[f].nativeAd.el.getAttribute(r.sideBySide))
} else {
attrVal = I(0, 1e4);
u[a].nativeAd.el.setAttribute(r.sideBySide, attrVal);
u[f].nativeAd.el.setAttribute(r.sideBySide, attrVal)
}
}
} else {
if (i.left - (s.left + d.CSSHelper.GetWidthOrHeight(u[f].nativeAd.el, "width")) < t) {
if (u[a].nativeAd.el.getAttribute(r.sideBySide)) {
u[f].nativeAd.el.setAttribute(r.sideBySide, u[a].nativeAd.el.getAttribute(r.sideBySide))
} else if (u[f].nativeAd.el.getAttribute(r.sideBySide)) {
u[a].nativeAd.el.setAttribute(r.sideBySide, u[f].nativeAd.el.getAttribute(r.sideBySide))
} else {
attrVal = I(0, 1e4);
u[a].nativeAd.el.setAttribute(r.sideBySide, attrVal);
u[f].nativeAd.el.setAttribute(r.sideBySide, attrVal)
}
}
}
}
}
}
}
};
var c = function(t) {
for (var n in t) {
var i = t[n].adsObj;
for (var s in i) {
if (s == "length") {
continue
}
if (i[s].nativeAd.el.getAttribute(r.sideBySide)) {
continue
}
if (i[s].frameType.numberOfAdsDisplayed >= i[s].frameType.maxAdsToBeShown) {
continue
}
if (i[s].isPlaced || i[s].isRemoved) {
continue
}
if (!d.DOMHelper.Contains(i[s].nativeAd.el)) {
i[s].deleteAdditionalAd(i[s]);
continue
}
if (!h(i[s].frameType.placementWidth, i[s].frameType.placementHeight, i[s].nativeAd.el, e.columnDetector.allAds)) {
i[s].place.call(i[s], s)
}
}
}
};
var p = function(e) {
var t = false;
for (var n = 0; n < e.length; n++) {
if (e[n].numberOfAdsDisplayed < e[n].maxAdsToBeShown) {
t = false;
break
} else {
t = true
}
}
return t
};
var v = function(e) {
var t = false,
n = 3,
r = e,
i = 5,
s = "",
o = null,
u = d.BrowserHelper.GetDocumentScroll();
while (r && r.nodeName != "BODY" && n) {
--n;
while (r.nodeName == "TD" || r.nodeName == "TR" || r.nodeName == "TBODY" || r.nodeName == "TABLE") {
r = r.parentNode
}
if (r.nodeName == "BODY") {
break
}
if (d.CSSHelper.CurCSS(r, "position") == "absolute") {
o = d.CSSHelper.GetOffset(r);
s = parseInt(d.CSSHelper.CurCSS(r, "top"));
s = isNaN(s) ? 0 : s;
if (o.top == s) {
if (u.top == 0) {
if (s <= i) {
t = true;
break
}
} else {
if (s >= i) {
t = true;
break
}
}
}
}
r = r.parentNode
}
return t
};
var m = function(e) {
var t = false,
n = 5,
r = e;
if (e.nodeName != "EMBED" && e.nodeName != "OBJECT") {
while (r && r.nodeName != "BODY" && n) {
--n;
if (r.nodeName == "EMBED" || r.nodeName == "OBJECT" || r.nodeName == "PARAM") {
t = true;
break
}
r = r.parentNode
}
}
return t
};
var g = function(e) {
var t = false,
n = 9,
r = d.CSSHelper.GetOffset(e);
if (r.top < n) {
t = true
}
return t
};
var y = function(e) {
var t = true;
if (e.nodeName == "IMG" || e.nodeName == "IFRAME") {
if (e.src.indexOf("infolinks") > -1) {
t = false
}
}
return t
};
var b = function(e) {
var t = false,
n = 0,
r = 0,
i = null;
if ((e.nodeName == "OBJECT" || e.nodeName == "EMBED") && d.BrowserHelper.Browser.msie) {
i = e.cloneNode(true);
n = d.CSSHelper.GetWidthOrHeight(i, "width");
r = d.CSSHelper.GetWidthOrHeight(i, "height");
i.style.cssText += " ; " + "background-color: green !important; " + "position: relative !important; " + "top: -10000px !important; " + "left: -10000px !important;";
document.body.appendChild(i);
if (n != d.CSSHelper.GetWidthOrHeight(i, "width") || r != d.CSSHelper.GetWidthOrHeight(i, "height")) {
t = true
}
i.parentNode.removeChild(i);
i = null
}
return t
};
var w = function(e, t) {
var n = "",
i = "";
try {
if (e == null) {
return null
} else if (e.getAttribute(r.viewed) == "true") {
if (e.getAttribute(r.suitable) == "false") {
return null
} else {
n = e.getAttribute(r.pusher);
i = e.getAttribute(r.adType);
if (s[i].adsObj[n].isClosed) {
return null
} else if (!d.DOMHelper.Contains(document.getElementById(n))) {
s[i].adsObj[n].deleteAdditionalAd(s[i].adsObj[n]);
e.removeAttribute(r.viewed);
e.removeAttribute(r.pusher);
e.removeAttribute(r.adType);
e.removeAttribute(r.sideBySide);
return E(e, t)
} else {
return null
}
}
} else {
return E(e, t)
}
} catch (o) {
z("getAdType ERROR: " + o)
}
};
var E = function(e, t) {
var n = null,
r = true,
i = 10,
s = e;
while (s && s.nodeName != "BODY" && s.nodeName !== "#document" && i) {
--i;
if (d.CSSHelper.CurCSS(s, "display") == "none" && d.CSSHelper.CurCSS(s, "_overflow") != "visible") {
r = false;
break
}
s = s.parentNode
}
if (r) {
switch (t) {
case "img":
n = T(e);
break;
case "iframe":
n = x(e);
break;
case "embed":
case "object":
n = S(e);
break;
default:
break
}
}
return n
};
var S = function(e) {
return N(e)
};
var x = function(e) {
return N(e)
};
var T = function(e) {
return N(e)
};
var N = function(e) {
var t = 0,
n = 0;
for (var r = 0; r < i.length; r++) {
if (i[r]) {
if (i[r].numberOfAdsDisplayed == i[r].maxAdsToBeShown) {
continue
}
t = d.CSSHelper.GetWidthOrHeight(e, "width");
n = d.CSSHelper.GetWidthOrHeight(e, "height");
if (t >= i[r].adWidth - i[r].widthLowerBound && t <= i[r].adWidth + i[r].widthUpperBound) {
if (n >= i[r].adHeight - i[r].heightLowerBound && n <= i[r].adHeight + i[r].heightUpperBound) {
return i[r]
} else {
if (e.nodeName == "OBJECT" || e.nodeName == "EMBED") {
n = d.CSSHelper.GetWidthOrHeightByAttr(e, "height");
if (n >= i[r].adHeight - i[r].heightLowerBound && n <= i[r].adHeight + i[r].heightUpperBound) {
return i[r]
}
}
}
} else {
if (e.nodeName == "OBJECT" || e.nodeName == "EMBED") {
t = d.CSSHelper.GetWidthOrHeightByAttr(e, "width");
if (t >= i[r].adWidth - i[r].widthLowerBound && t <= i[r].adWidth + i[r].widthUpperBound) {
if (n >= i[r].adHeight - i[r].heightLowerBound && n <= i[r].adHeight + i[r].heightUpperBound) {
return i[r]
} else {
if (e.nodeName == "OBJECT" || e.nodeName == "EMBED") {
n = d.CSSHelper.GetWidthOrHeightByAttr(e, "height");
if (n >= i[r].adHeight - i[r].heightLowerBound && n <= i[r].adHeight + i[r].heightUpperBound) {
return i[r]
}
}
}
}
}
}
}
}
return null
};
var C = function(e) {
this.createAdditionalAd(this.frameType.placementWidth, this.frameType.placementHeight, e);
this.placeAdditionalAd();
this.fixNativeAd();
this.isPlaced = true;
this.runCheckStateOfNativeAd(this);
this.verifyTheNeedAddListenerOnDOMModified();
this.incrementCounter(this.frameType);
this.defineNativeAdPosition();
this.reviewAllParents(this.mainClass.allAds)
};
var k = function(e, t, n) {
var r = document.createElement("div");
r.id = n;
r.style.cssText += ";" + "width: " + e + "px !important;" + "height: auto !important;" + "padding: 0 !important;" + "margin: 0 !important;" + "z-index: 500 !important;" + "position: absolute !important;" + "display: block !important;";
this.nativeAd.lastPosition = this.nativeAd.position;
return r
};
var L = function() {
d.DOMHelper.InsertNode(document.documentElement, this.additionalAd.el, "append")
};
var A = function() {
var e = d.CSSHelper.CurCSS(this.nativeAd.el, "position"),
t = "",
n = null,
r = null;
this.nativeAd.classes = [];
this.nativeAd.nativeStyles = {};
if (e == "absolute") {
var i = parseInt(d.CSSHelper.CurCSS(this.nativeAd.el, "top"));
i = isNaN(i) ? 0 : i;
n = this.random(0, 1e5);
this.nativeAd.el.className += " " + "fix" + n;
t += ".fix" + n + "{" + "top: " + (i + this.frameType.placementHeight + 20) + "px !important;" + "}";
this.nativeAd.classes.push("fix" + n);
this.deleteCssFuncs.push(R("", t));
r = i;
i = parseInt(d.CSSHelper.CurCSS(this.nativeAd.el, "top"));
i = isNaN(i) ? 0 : i;
if (r == i) {
this.nativeAd.el.style.cssText += ";" + "top: " + (i + this.frameType.placementHeight + 20) + "px !important;";
this.nativeAd.nativeStyles["top"] = r + "px !important"
}
if (this.parent.el.parentNode && this.parent.el.previousSibling && d.CSSHelper.CurCSS(this.parent.el, "position") == "absolute" && d.CSSHelper.CurCSS(this.parent.el.parentNode, "position") == "relative") {
var s = this.parent.el.previousSibling,
o = d.CSSHelper.GetOffset(this.parent.el.parentNode),
u = d.CSSHelper.GetOffset(s),
a = u.top - o.top + d.CSSHelper.GetWidthOrHeight(s, "height");
t = "";
n = this.random(0, 1e5);
this.parent.el.className += " " + "fix" + n;
t += ".fix" + n + "{" + "top: " + a + "px !important;" + "}";
this.deleteCssFuncs.push(R("", t))
}
} else {
var f = parseInt(d.CSSHelper.CurCSS(this.nativeAd.el, "margin-top"));
f = isNaN(f) ? 0 : f;
n = this.random(0, 1e5);
this.nativeAd.el.className += " " + "fix" + n;
t += ".fix" + n + "{" + "margin-top: " + (f + this.frameType.placementHeight + 20) + "px !important;" + "}";
this.nativeAd.classes.push("fix" + n);
this.deleteCssFuncs.push(R("", t));
r = f;
f = parseInt(d.CSSHelper.CurCSS(this.nativeAd.el, "margin-top"));
f = isNaN(f) ? 0 : f;
if (r == f) {
this.nativeAd.el.style.cssText += "; " + "margin-top: " + (f + this.frameType.placementHeight + 20) + "px !important;";
this.nativeAd.nativeStyles["margin-top"] = r + "px !important"
}
}
n = this.random(0, 1e5);
t = "";
this.nativeAd.el.className += " " + "fix" + n;
t += ".fix" + n + "{" + "height: " + this.frameType.adHeight + "px !important;" + "}";
this.nativeAd.classes.push("fix" + n);
this.deleteCssFuncs.push(R("", t))
};
var O = function(e) {
var t = 1e3,
n = null,
r = null,
i = null,
s = 0,
o = 0,
u = function() {
e.checkNativeAdOutsideThePage(e);
e.checkNativeAdHasSuitablePos(e);
e.checkNativeAdClassesMissed(e);
r = e.nativeAd.el;
i = e.additionalAd.el;
if (!d.DOMHelper.Contains(i) || !d.DOMHelper.Contains(r)) {
a()
} else {
s = d.CSSHelper.GetWidthOrHeight(r, "width");
o = d.CSSHelper.GetWidthOrHeight(r, "height");
if (s == 0 || o == 0 || d.CSSHelper.CurCSS(r, "display") == "none" || d.CSSHelper.CurCSS(i, "display") == "none" || q(r, "display", "none", 10) || q(i, "display", "none", 10) || q(r, "visibility", "hidden", 5)) {
a()
}
}
},
a = function() {
if (!e.isClosed) {
e.decrementCounter(e.frameType)
}
e.deleteAdditionalAd(e);
clearInterval(n);
n = null
};
n = setInterval(u, t)
};
var M = function(e) {
var t = 10,
n = e;
while (n && n.nodeName != "BODY" && t) {
if (n.nodeName == "A" || n.nodeName == "OBJECT" || n.nodeName == "EMBED") {
n = n.parentNode;
continue
}--t;
this.reviewParentMargin(n);
this.reviewParentHeight(n);
n = n.parentNode
}
};
var _ = function(e) {
if (e.additionalAd.el) {
if (e.additionalAd.el.parentNode) {
e.additionalAd.el.parentNode.removeChild(e.additionalAd.el)
}
}
if (e.isPlaced) {
e.deleteAllCSSFixScripts(e)
}
e.isRemoved = true;
if (e.isPlaced) {
e.restoreAllCSSFixScripts(e);
e.verifyTheNeedRemoveListenerOnDOMModified()
}
};
u()
};
var _ = new function() {
var e = this,
t = new O(e),
n = new M(e);
e.columnDetector = t;
e.overAds = n;
var r = function() {
t.run();
n.run()
};
e.run = r
};
var H = new function() {
function n(e, n) {
var r = n === "width" ? e.offsetWidth : e.offsetHeight,
i = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
s = new RegExp("^(" + i + ")(?!px)[a-z%]+$", "i");
if (r <= 0 || r == null) {
r = t(e, n);
if (r < 0 || r == null) {
r = e.style[n]
}
if (s.test(r)) {
return r
}
r = parseFloat(r) || 0
}
return r
}
function r(e, t) {
var n = e.getAttribute(t);
if (n) {
if (typeof n == "string") {
if (n.indexOf("%") < 0) {
return parseInt(n)
}
}
}
return 0
}
var e = this;
var t = function() {
var e, t, n = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
r = new RegExp("^(" + n + ")(?!px)[a-z%]+$", "i"),
i = /^margin/,
s = /^(top|right|bottom|left)$/,
o = /^-ms-/,
u = /-([\da-z])/gi,
a = ["Webkit", "O", "Moz", "ms"],
f = {};
var l = function(e, t) {
return t.toUpperCase()
};
var c = function(e) {
return e.replace(o, "ms-").replace(u, l)
};
var h = function(e, t) {
if (t in e) {
return t
}
var n = t.charAt(0).toUpperCase() + t.slice(1),
r = t,
i = a.length;
while (i--) {
t = a[i] + n;
if (t in e) {
return t
}
}
return r
};
if (window.getComputedStyle) {
e = function(e) {
return window.getComputedStyle(e, null)
};
t = function(t, n) {
var s, o, u, a = e(t),
f = a ? a.getPropertyValue(n) || a[n] : undefined,
l = t.style;
if (a) {
if (r.test(f) && i.test(n)) {
s = l.width;
o = l.minWidth;
u = l.maxWidth;
l.minWidth = l.maxWidth = l.width = f;
f = a.width;
l.width = s;
l.minWidth = o;
l.maxWidth = u
}
}
return f
}
} else if (document.documentElement.currentStyle) {
e = function(e) {
return e.currentStyle
};
t = function(t, n) {
var i, o, u, a, l = e(t),
p = c(n);
n = f[p] || (f[p] = h(t.style, p));
a = l ? l[n] : undefined;
style = t.style;
if (a == null && style && style[n]) {
a = style[n]
}
if (r.test(a) && !s.test(n)) {
i = style.left;
o = t.runtimeStyle;
u = o && o.left;
if (u) {
o.left = t.currentStyle.left
}
style.left = n === "fontSize" ? "1em" : a;
a = style.pixelLeft + "px";
style.left = i;
if (u) {
o.left = u
}
}
return a === "" ? "auto" : a
}
}
return t
}();
this.CurCSS = t;
this.GetWidthOrHeight = n;
this.GetWidthOrHeightByAttr = r;
var i = function(e) {
var t, n, r = function(e) {
var t = e.getBoundingClientRect();
var n = document.body;
var r = document.documentElement;
var i = window.pageYOffset || r.scrollTop || n.scrollTop;
var s = window.pageXOffset || r.scrollLeft || n.scrollLeft;
var o = r.clientTop || n.clientTop || 0;
var u = r.clientLeft || n.clientLeft || 0;
var a = t.top + i - o;
var f = t.left + s - u;
return {
top: Math.round(a),
left: Math.round(f)
}
},
i = function(e) {
var t = 0,
n = 0;
while (e) {
t = t + parseInt(e.offsetTop);
n = n + parseInt(e.offsetLeft);
e = e.offsetParent
}
return {
top: t,
left: n
}
};
n = i(e);
if (e.getBoundingClientRect) {
t = r(e);
if (t.top == 0 && n > 0) {
return n
} else {
return t
}
} else {
return n
}
};
this.GetOffset = i
};
d.CSSHelper = H;
var B = new function() {
function n(e, t, n) {
if (e.addEventListener) {
e.addEventListener(t, n, false)
} else if (e.attachEvent) {
if (typeof e.listeners === "undefined") {
e.listeners = new Array
}
var r = function(e) {
n(i(e))
};
r.fn = n;
e.listeners.push(r);
e.attachEvent("on" + t, r)
} else {
e["on" + t] = function(e) {
n(i(e))
}
}
}
function r(e, t, n) {
if (e.removeEventListener) {
e.removeEventListener(t, n, false)
} else if (e.detachEvent) {
if (typeof e.listeners !== "undefined") {
for (var r = 0, i = e.listeners; r < i.length; r++) {
if (i[r].fn == n) {
e.detachEvent("on" + t, i[r]);
i.splice(r, 1);
break
}
}
}
} else {
e["on" + t] = null
}
}
function i(e) {
e = e || window.event;
if (e.srcElement && !e.target) {
e.target = e.srcElement
}
return e
}
function s(e) {
if (e.stopPropogation) e.stopPropogation();
if (e.preventDefault) e.preventDefault();
e.returnValue = false
}
var e = this;
var t = function() {
var e, t = false,
n = [],
r = function(e) {
if (document.addEventListener || e.type === "load" || document.readyState === "complete") {
i();
s()
}
},
i = function() {
if (document.addEventListener) {
document.removeEventListener("DOMContentLoaded", r, false);
window.removeEventListener("load", r, false)
} else {
document.detachEvent("onreadystatechange", r);
window.detachEvent("onload", r)
}
},
s = function() {
if (!document.body) {
return setTimeout(s)
}
if (t) {
return
}
t = true;
if (n) {
var e = null;
while (e = n.shift()) {
e.call(document)
}
n = null
}
};
if (document.readyState === "complete" || document.readyState === "interactive") {
setTimeout(s)
} else if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", r, false);
window.addEventListener("load", r, false)
} else {
document.attachEvent("onreadystatechange", r);
window.attachEvent("onload", r);
var o = false;
try {
o = window.frameElement == null && document.documentElement
} catch (u) {}
if (o && o.doScroll) {
(function a() {
if (!t) {
try {
o.doScroll("left")
} catch (e) {
return setTimeout(a, 50)
}
i();
s()
}
})()
}
}
e = function(e) {
if (t) {
e.call()
} else {
n.push(e)
}
};
return e
}();
this.DomReady = t;
this.AddEvent = n;
this.RemoveEvent = r;
this.StopEvent = s
};
d.EventHelper = B;
var j = new function() {
function t(e) {
return document.body.contains(e) || document.documentElement.contains(e)
}
function n(e, t, n) {
switch (n) {
case "append":
e.appendChild(t);
break;
case "prepend":
if (e.childNodes[0]) {
e.insertBefore(t, e.childNodes[0])
} else if (e.firstChild) {
e.insertBefore(t, e.firstChild)
}
break;
case "after":
if (e.nextSibling) {
if (e.parentNode) e.parentNode.insertBefore(t, e.nextSibling)
} else {
if (e.parentNode) e.parentNode.appendChild(t)
}
break;
case "before":
if (e.parentNode) e.parentNode.insertBefore(t, e);
break
}
}
var e = this;
this.Contains = t;
this.InsertNode = n
};
d.DOMHelper = j;
var F = new function() {
function t() {
var e = 0,
t = 0;
if (typeof window.innerWidth == "number") {
e = window.innerWidth;
t = window.innerHeight
} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
e = document.documentElement.clientWidth;
t = document.documentElement.clientHeight
} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
e = document.body.clientWidth;
t = document.body.clientHeight
}
return {
width: e,
height: t
}
}
function n() {
var e = self.pageYOffset || document.documentElement && document.documentElement.scrollTop || document.body && document.body.scrollTop;
var t = self.pageXOffset || document.documentElement && document.documentElement.scrollLeft || document.body && document.body.scrollLeft;
return {
top: e,
left: t
}
}
function r(e, t) {
window.scrollTo(e, t)
}
var e = this;
this.GetScreenSize = t;
this.GetDocumentScroll = n;
this.SetDocumentScroll = r;
var i = function() {
var e = navigator.userAgent.toLowerCase();
var t = {
webkit: /webkit/.test(e),
mozilla: /mozilla/.test(e) && !/(compatible|webkit)/.test(e),
chrome: /chrome/.test(e),
msie: /msie/.test(e) && !/opera/.test(e) || /trident/.test(e) && !/opera/.test(e),
firefox: /firefox/.test(e),
safari: /safari/.test(e) && !/chrome/.test(e),
opera: /opera/.test(e)
};
t.version = t.safari ? (e.match(/.+(?:ri)[\/: ]([\d.]+)/) || [])[1] : (e.match(/.+(?:ox|me|ra|ie)[\/: ]([\d.]+)/) || [])[1];
return t
}();
this.Browser = i
};
d.BrowserHelper = F;
d.EventHelper.DomReady(k)
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment