Created
October 23, 2011 03:24
-
-
Save cpdean/1306829 to your computer and use it in GitHub Desktop.
disecting that clipboard hijacker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tynt = window.Tynt || []; | |
if (typeof Tynt.TIL == "undefined") { | |
(function() { | |
var Ja = function() { | |
var h = document, | |
l = h.body, | |
p = h.documentElement, | |
aa = eval("/*@cc_on!@*/false"), | |
ba = function(a, b) { | |
for (var c = "", f = 0; f < b; f++) | |
c += a; | |
return c | |
}, | |
B = ba("a", 50), | |
s = (Tynt.e || "") + "ic.tynt.com", | |
t = function() { | |
return (new Date).getTime() | |
}, | |
u = function(a) { | |
return a.replace(/^\s+|\s+$/g, "") | |
}, | |
M = function(a, b) { | |
for (var c in a) | |
if (a.hasOwnProperty(c)) | |
b[c] = a[c] | |
}, | |
w = function(a, b, c) { | |
a = h.createElement(a); | |
M(b, a); | |
M(c, a.style); | |
return a | |
}, | |
q, | |
N; | |
if (window.addEventListener) { | |
q = function(a, b, c) { | |
a.addEventListener(b, c, false) | |
}; | |
N = function(a, b, c) { | |
a.removeEventListener(b, c, false) | |
} | |
} else { | |
q = function(a, b, c) { | |
a.attachEvent("on" + b, c) | |
}; | |
N = function(a, b, c) { | |
a.detachEvent("on" + b, c) | |
} | |
} | |
var O = function(a, b) { | |
var c = location.hostname.split("."), | |
f = 2; | |
do { | |
var d = c.slice(c.length - f, c.length).join("."); | |
h.cookie = a + ";path=/;domain=." + d + ";" + b; | |
f++ | |
} while (h.cookie.indexOf(a) == -1 && f <= c.length); | |
if (h.cookie.indexOf(a) == -1) | |
h.cookie = a + ";path=/;" + b | |
}, | |
P = function(a) { | |
h.readyState == "complete" ? a() : q(window, "load", function() { | |
setTimeout(function() { | |
if (typeof h.readyState == | |
"undefined" && !aa) | |
h.readyState = "complete"; | |
a() | |
}, 10) | |
}) | |
}, | |
n = function(a, b) { | |
var c = [], | |
f = function(d, e) { | |
var i = "http://" + d.replace("id=" + B, "id=" + Tynt.join("~")); | |
if (i.indexOf(s + "/b/p?") > -1 && typeof Tynt.b == "string") | |
i += "&b=" + Tynt.b; | |
var k = new Image(1, 1); | |
if (e) | |
k.onerror = e; | |
k.src = i | |
}; | |
n = function(d, e) { | |
c.push([d, e]) | |
}; | |
P(function() { | |
n = f; | |
for (var d = 0; d < c.length; d++) | |
n(c[d][0], c[d][1]); | |
c = null | |
}); | |
n(a, b) | |
}, | |
ca = function(a) { | |
var b = [], | |
c = "", f; | |
for (f in a) | |
if (a.hasOwnProperty(f)) { | |
b.push(c, f, "=", a[f]); | |
c = "&" | |
} | |
return b.join("") | |
}, | |
Q = function(a) { | |
for (var b = 0, c = a.length < 100 ? a.length : 100, f = 0; f < c; f++) | |
b += a.charCodeAt(f); | |
a = Math.floor(Math.random() * 3844); | |
c = Math.abs(t() - 12281184E5); | |
return da(c, 7) + da((b + a) % 3844, 2) | |
}, | |
ea = function(a) { | |
if (a < 62) | |
return "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".charAt(this); | |
else { | |
var b = Math.floor(a / 62); | |
a = a - b * 62; | |
return b >= 62 ? ea(b) + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".charAt(a) : "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".charAt(b) + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".charAt(a) | |
} | |
}, | |
da = function(a, b) { | |
var c = ea(a); | |
return ba("0", b - c.length) + c | |
}, | |
fa = function(a) { | |
return (a = u(a)) ? a.split(/\s+/i).length : 0 | |
}, | |
R = u((h.title || location.hostname).toString()).replace(RegExp(location.hash, "g"), ""), | |
ga = function() { | |
for (var a = h.getElementsByTagName("link"), b = 0; b < a.length; b++) | |
if (a[b].getAttribute("rel") && a[b].getAttribute("rel").match("canonical")) { | |
a = a[b].getAttribute("href"); | |
b = location.protocol + "//" + location.host + location.pathname; | |
var c = h.getElementsByTagName("base")[0]; | |
if (c) | |
if (c = c.getAttribute("href")) | |
b = | |
c; | |
if (!a.match(/^http/)) { | |
if (a.charAt(0) == "/") { | |
c = b.indexOf("/", 9); | |
if (c > -1) | |
b = b.slice(0, c) | |
} else { | |
c = b.lastIndexOf("/"); | |
if (c > 9) | |
b = b.slice(0, c + 1); | |
else | |
b += "/" | |
} | |
a = b + a | |
} | |
return a | |
} | |
return "" | |
}, | |
E = function(a) { | |
return a.replace(/^https?:\/\//, "") | |
}, | |
F = function(cookies, b) { | |
// look for b in cookies | |
for (var search_var = b + "=", cookie_contents = cookies.split(";"), d = 0; d < cookie_contents.length; d++) { | |
for (var e = cookie_contents[d]; e.charAt(0) == " "; ) | |
e = e.substring(1, e.length); | |
if (e.indexOf(search_var) == 0) | |
return e.substring(search_var.length, e.length) | |
} | |
return null | |
}, | |
oa = function() { | |
var a = F(h.cookie, "tracertraffic"), | |
b = encodeURIComponent(E(ga())), | |
c = | |
h.location.hash; | |
c = /tynt=/.test(c) ? c.match(/tynt=?([^?&$#]*)/)[1] : false; | |
var f = s + "/b/p?id=" + B + (a ? "&et=" + a : "") + (c ? "&a=" + c : "") + "&ts=" + t(), | |
d = f + (b ? "&cu=" + b : ""), | |
e = d + (h.referrer ? "&r=" + encodeURIComponent(E(h.referrer)) : ""); | |
a = e + "&t=" + encodeURIComponent(R); | |
n(a, function() { | |
n(e, function() { | |
n(d, function() { | |
n(f) | |
}) | |
}) | |
}) | |
}, | |
pa = function() { | |
var a = w("style", {type: "text/css",media: "print"}), | |
b = "#tyntPrint { background-image: url(http://" + s + "/b/h?id=" + Tynt.join("~") + "&ts=" + t() + ")}"; | |
b = h.createTextNode(b); | |
if (a.styleSheet) | |
a.styleSheet.cssText = | |
b.nodeValue; | |
else | |
a.appendChild(b); | |
h.getElementsByTagName("head")[0].appendChild(a); | |
l.insertBefore(w("div", {id: "tyntPrint"}), l.firstChild) | |
}, | |
S = function() { | |
var a = []; | |
return function(b) { | |
for (var c = a.length - 1; c >= 0; c--) | |
if (a[c] == b) | |
return false; | |
a.unshift(b); | |
a.length > 3 && a.pop(); | |
return true | |
} | |
}, | |
qa = S(), | |
ra = S(), | |
sa = function() { | |
var a, | |
b = function() { | |
window.removeEventListener("blur", b, false); | |
T(a); | |
return true | |
}; | |
return function(c) { | |
a = c.target || c.srcElement; | |
window.removeEventListener("blur", b, false); | |
if (a.nodeName == "IMG" && a.parentNode.nodeName != | |
"A") { | |
window.addEventListener("blur", b, false); | |
setTimeout(function() { | |
h.removeEventListener("blur", b, false) | |
}, 1E4) | |
} | |
return true | |
} | |
}(), | |
ha = function(a) { | |
T(a.target || a.srcElement, true) | |
}, G, | |
ia = function(a) { | |
a = a.target || a.srcElement; | |
G = a.nodeName == "IMG" ? a : null | |
}, | |
U = function() { | |
var a = function(i) { | |
return typeof i.pageX == "number" ? {x: i.pageX - (p.scrollLeft ? p.scrollLeft : l.scrollLeft),y: i.pageY - (p.scrollTop ? p.scrollTop : l.scrollTop)} : {x: i.clientX,y: i.clientY} | |
}, | |
b = function(i) { | |
i = a(i); | |
return i.x <= 0 || i.y <= 0 || i.x >= l.clientWidth || i.y >= | |
l.clientHeight | |
}, | |
c = function(i) { | |
i = a(i); | |
return i.x <= 0 || i.y <= 0 || i.x >= p.clientWidth || i.y >= p.clientHeight | |
}, | |
f = function(i) { | |
return i.target.nodeName == "#document" | |
}, | |
d = function(i) { | |
i = a(i); | |
return i.x <= 4 || i.y <= 4 || i.x >= p.clientWidth - 4 || i.y >= p.clientHeight - 4 | |
}, | |
e = function(i) { | |
e = navigator.userAgent.match("MSIE") ? !h.compatMode || h.compatMode.indexOf("CSS") == -1 ? b : c : navigator.userAgent.match("Firefox") ? f : d; | |
e(i) | |
}; | |
return function(i) { | |
if (G && e(i)) { | |
T(G); | |
G = null | |
} | |
return true | |
} | |
}(), | |
ta = function() { | |
function a(j, m) { | |
if (o(j)) | |
n(s + "/b/o?id=" + | |
B + (m ? "&i=" : "&l=") + encodeURIComponent(j) + "&ts=" + t()) | |
} | |
function b(j) { | |
var m = j.target || j.srcElement; | |
if (j.button < 2) | |
for (; m && m != h; ) { | |
j = m.href; | |
if (m.nodeName == "A" && j && location.href.split("#")[0] != j.split("#")[0] && !/^javascript/i.test(j)) { | |
a(j); | |
break | |
} | |
m = m.parentNode | |
} | |
} | |
function c() { | |
k && a(k, true) | |
} | |
function f(j) { | |
j = j.target || j.srcElement; | |
k = j.src || j.data || "flash"; | |
q(window, "blur", c) | |
} | |
function d() { | |
k = null; | |
N(window, "blur", c) | |
} | |
function e(j) { | |
q(j, "mouseover", f); | |
q(j, "mouseout", d) | |
} | |
function i() { | |
k && a(k, true) | |
} | |
var k, | |
o = S(); | |
q(document, | |
"mousedown", b); | |
P(function() { | |
for (var j = h.getElementsByTagName("iframe"), m = j.length - 1; m >= 0; m--) { | |
var r = j[m]; | |
if (r.src) | |
e(r); | |
else if (r.name) | |
try { | |
q(frames[r.name].document, "mousedown", b) | |
} catch (v) { | |
} | |
} | |
j = h.getElementsByTagName("object"); | |
for (m = j.length - 1; m >= 0; m--) | |
e(j[m]) | |
}); | |
q(window, "beforeunload", i); | |
q(window, "unload", i) | |
}, x; | |
if (Tynt.c) | |
x = function() { | |
}; | |
else { | |
Tynt.c = true; | |
x = function() { | |
var a = true, b, | |
c = function(f, d) { | |
var e = {id: B,wc: fa(d),c: d,f: a ? 1 : 0,t: R}; | |
M(f, e); | |
a = false; | |
var i = e.trace_type; | |
delete e.trace_type; | |
var k = e.g; | |
delete e.g; | |
for (var o = [], j = ["id", "wc", "f", "w", "h", "t", "c"], m = 0; m < j.length; m++) { | |
var r = j[m], | |
v = e[r]; | |
v && o.push([r, encodeURIComponent(v).replace(/\'/g, "%27")]); | |
delete e[r] | |
} | |
for (var y in e) | |
if (e.hasOwnProperty(y)) | |
(j = e[y]) && o.push([y, encodeURIComponent(j).replace(/\'/g, "%27")]); | |
e = []; | |
m = 2048 - (("http://" + s + "/a/t/x#?").length + (3 + k.length) + 5); | |
r = o.length; | |
var C = v = 0, | |
z = 0, V, H, W, I, | |
J = 0; | |
for (e[J] = {g: k,tp: null}; v < r && e.length < 35; ) { | |
V = o[v][0]; | |
y = o[v][1]; | |
W = V.length + 2; | |
H = m - W - C; | |
if (H > 0) { | |
j = y.substring(z, z + H); | |
I = j.slice(-2).indexOf("%"); | |
if (I > -1) { | |
j = | |
y.substring(z, z + H - 2 + I); | |
C += I + 2 | |
} | |
C += j.length + W; | |
z += j.length; | |
e[J][V] = j | |
} else | |
C = m; | |
if (C >= m) { | |
e[++J] = {g: k,p: J}; | |
C = 0 | |
} | |
if (z >= y.length) { | |
v++; | |
z = 0 | |
} | |
} | |
e[0].tp = e.length; | |
n(s + "/b/t/" + i + "?" + ca(e[0])); | |
for (k = 1; k < e.length; k++) | |
n(s + "/b/x/" + i + "?" + ca(e[k])) | |
}; | |
/tynt=nout/.test(location.href) || ta(); | |
if (window.addEventListener) { | |
navigator.userAgent.match("Firefox/2") || l.addEventListener("copy", ha, false); | |
window.addEventListener("mousedown", ia, false); | |
window.addEventListener("dragleave", U, false); | |
window.addEventListener("dragexit", U, false); | |
h.addEventListener("contextmenu", sa, false) | |
} else { | |
l.attachEvent("oncopy", ha); | |
h.getElementsByTagName("html")[0].attachEvent("ondragleave", U); | |
l.attachEvent("onmousedown", ia) | |
} | |
if (h.cookie.indexOf("tracertraffic=") != -1) | |
if (!h.referrer || h.referrer.indexOf(location.host) == -1) | |
O("tracertraffic=0", "expires=Thu, 01 Jan 1970 00:00:00 GMT"); | |
oa(); | |
P(pa); | |
return function(f, d) { | |
if (!h.getElementById("tyntSS")) { | |
var e; | |
if (d) | |
e = typeof getSelection != "undefined" ? getSelection().toString() : h.selection.createRange().text; | |
var i = f.src; | |
i && !e && ra(i) && c({g: Q(i),trace_type: 3,w: f.width,h: f.height}, i); | |
if (e && u(e).length && f.nodeName != "TEXTAREA" && f.nodeName != "INPUT") { | |
i = qa(e); | |
var k = {trace_type: 1}; | |
if (i) | |
b = Q(e); | |
k.g = b; | |
var o = Tynt.m ? Tynt.m(k, e) : true; | |
i && o && c(k, e) | |
} | |
} | |
} | |
} | |
} | |
var K = function(a) { | |
a = a.charCodeAt(0); | |
return 3584 <= a && a <= 3711 || 11904 <= a && a <= 12591 || 12688 <= a && a <= 40959 || 63744 <= a && a <= 64255 || 65072 <= a && a <= 65103 || 131072 <= a && a <= 173791 || 194560 <= a && a <= 195103 | |
}, | |
ja = function(a) { | |
a = a.getElementsByTagName("script"); | |
for (var b = a.length - 1; b >= 0; b--) { | |
var c = a[b]; | |
c.parentNode.removeChild(c) | |
} | |
}, | |
g, | |
ua = (Tynt.e || "") + "id.tynt.com", | |
va = {t: 3,p: 6,w: 7}, A, X, Y, | |
wa = ["", "Attribution", "Attribution Share Alike", "Attribution No Derivatives", "Attribution Non-Commercial", "Attribution Non-Commercial Share Alike", "Attribution Non-Commercial No Derivatives"], | |
xa = ["", "http://creativecommons.org/licenses/by/3.0", "http://creativecommons.org/licenses/by-sa/3.0", "http://creativecommons.org/licenses/by-nd/3.0", "http://creativecommons.org/licenses/by-nc/3.0", "http://creativecommons.org/licenses/by-nc-sa/3.0", "http://creativecommons.org/licenses/by-nc-nd/3.0"], | |
ka = function(a) { | |
a = a.match(/ixzz=?([^?$#]*)/); | |
if (!a) | |
return null; | |
a = a[1].match(/&([^?$]*)/); | |
if (Tynt.k) | |
return Tynt.k.charAt(1); | |
if (!a || !a[1]) | |
return null; | |
return a[1] | |
}, | |
Z = function(a) { | |
return (a = a.match(/axzz([^?$]*)/)) && a.length == 2 ? a[1] : null | |
}, | |
ya = function(a) { | |
var b = ga(); | |
b = b && g.c !== false ? b : location.href; | |
b = b.replace(/#(i|a)xzz=?(.*)$/g, ""); | |
return b + "#" + ("ixzz" + a) | |
}, | |
la = function(a) { | |
var b = new Date(t() + 864E5); | |
O("tracertraffic=" + a.toString(), "expires=" + b.toUTCString()) | |
}, | |
za = function() { | |
var a = location.href.match(/ixzz=?([^?&$#]*)/); | |
if (a = (a && a.length == 2 ? a[1] : null) || Tynt.h) { | |
var b = ka(location.href); | |
a = s + "/b/v?g=" + a + (/\?trace_owner_view/.test(location.href) ? "&o=y" : "") + "&id=" + B + (b ? "&s=" + b : "") + "&r=" + encodeURIComponent(E(h.referrer)) + "&ts=" + t(); | |
n(a); | |
return true | |
} | |
return false | |
}, | |
Aa = function(a) { | |
n(s + "/b/a?g=" + a + "&id=" + B + "&r=" + encodeURIComponent(E(h.referrer)) + "&ts=" + t(), function() { | |
}) | |
}, | |
ma = function(a) { | |
return a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">") | |
}, | |
D = false, | |
Ba = function(a) { | |
if (D) | |
return false; | |
D = true; | |
var b = ""; | |
if (g.a) { | |
var c = ya(a), | |
f = '<a style="color: #003399;" href="'; | |
b += g.ap; | |
if (g.st) | |
b = b + f + c + '">' + ma(R) + "</a> "; | |
if (g.su) | |
b = b + f + c + '">' + ma(c) + "</a>"; | |
if (g.as.length > 0) | |
b = b + "\n<br>" + g.as + " "; | |
if (g.cc > 0) | |
b = b + "\n<br>Under Creative Commons License: " + f + xa[g.cc] + '">' + wa[g.cc] + "</a>" | |
} | |
if (g.el) { | |
if (b.length > 0) | |
b += "\n<br>"; | |
b += g.el | |
} | |
if (A) { | |
if (b.length > 0) | |
b += "\n<br>"; | |
b = Y ? b + X + f + "http://tcr" + g.s + ".tynt.com/ads/" + Y + "/" + a + '">' + A + "</a>" : b + X + f + "http://tcr" + g.s + ".tynt.com/ads/" + A + "/" + $ + "/" + a + '">' + A + "</a>" | |
} | |
var d, e; | |
d = w("div", {}, {overflow: "hidden",color: "#000000", | |
backgroundColor: "transparent",textAlign: "left",textDecoration: "none",border: "none"}); | |
if (!h.selection || !h.selection.createRange) { | |
a = getSelection(); | |
if (a.toString()) | |
if (typeof a.setBaseAndExtent != "undefined") { | |
var i = a.getRangeAt(0); | |
b = w("span", {innerHTML: b}); | |
if (g.t) { | |
b.innerHTML += "<br/><br/>"; | |
d.appendChild(b); | |
d.appendChild(i.cloneContents()) | |
} else { | |
d.appendChild(i.cloneContents()); | |
b.innerHTML = "<br/><br/>" + b.innerHTML; | |
d.appendChild(b) | |
} | |
ja(d); | |
d.style.width = 0.1; | |
d.style.height = 0.1; | |
d.style.position = "absolute"; | |
d.style.top = | |
"-1000px"; | |
d.style.left = "-1001px"; | |
d.appendChild(h.createElement("br")); | |
b = d.innerText.length; | |
l.insertBefore(d, l.firstChild); | |
if (d.innerText.length != b) | |
d.style.overflow = ""; | |
a.selectAllChildren(d); | |
setTimeout(function() { | |
d.parentNode.removeChild(d); | |
getSelection().setBaseAndExtent(i.startContainer, i.startOffset, i.endContainer, i.endOffset); | |
D = false | |
}, 0) | |
} else { | |
e = w("div", {}, {height: 0,position: "absolute",top: "-1000px"}); | |
e.innerHTML = "<br>"; | |
if (g.t) { | |
l.insertBefore(e, l.firstChild); | |
d.innerHTML = b + "<br><br>" | |
} else { | |
l.appendChild(e); | |
d.innerHTML = "<br>" + b + "<br>" | |
} | |
e.appendChild(d); | |
b = h.createRange(); | |
b.selectNode(d); | |
a.addRange(b); | |
window.setTimeout(function() { | |
e.parentNode.removeChild(e); | |
D = false | |
}, 0) | |
} | |
} else { | |
var k = p.scrollLeft || l.scrollLeft, | |
o = p.scrollTop || l.scrollTop; | |
e = w("div", {}, {overflow: "hidden",position: "absolute",left: k + 20 + "px",top: o + 20 + "px",width: "1px",height: "1px"}); | |
l.insertBefore(e, l.firstChild); | |
var j = h.selection.createRange(); | |
d.innerHTML = g.t ? b + "<br><br>" + j.htmlText : j.htmlText + "<br><br>" + b; | |
ja(d); | |
e.appendChild(h.createElement("br")); | |
e.appendChild(d); | |
b = l.createTextRange(); | |
b.moveToElementText(d); | |
b.select(); | |
setTimeout(function() { | |
l.removeChild(e); | |
if (j.text != "") { | |
j.select(); | |
p.scrollLeft = k; | |
l.scrollLeft = k; | |
p.scrollTop = o; | |
l.scrollTop = o | |
} | |
D = false | |
}, 0) | |
} | |
return true | |
}, | |
Da = function(a, b) { | |
var c = true; | |
if (g.a || A || g.el) { | |
var f; | |
f = u(b); | |
f = f.length >= 2 ? K(f.charAt(0)) || K(f.charAt(f.length - 1)) || K(f.charAt(f.length / 2)) : K(f); | |
var d; | |
if (d = g.h) | |
a: { | |
d = (d = Ca()) ? d.className.split(/\s+/) : []; | |
for (var e = d.length - 1; e >= 0; e--) | |
if (g.h[d[e]] !== undefined) { | |
d = g.h[d[e]]; | |
break a | |
} | |
d = void 0 | |
} | |
d = | |
d; | |
if (d !== false && (f && b.replace(/\s/g, "").length >= g.aw * 2 || !f && fa(b) >= g.aw) || d) | |
if (g.a || A || g.el) { | |
c = Ba(a.g); | |
if (g.a) | |
a.trace_type = 0 | |
} | |
} | |
return c | |
}, | |
Ca = function() { | |
return !h.selection || !h.selection.createRange ? function() { | |
var a = getSelection().getRangeAt(0), | |
b = a.startContainer.nodeType == 3 ? a.startContainer.parentNode : a.startContainer; | |
return b && u(a.toString()) == u(b.textContent) ? b : null | |
} : function() { | |
var a = h.selection.createRange(), | |
b = a.duplicate(); | |
b.collapse(true); | |
return (b = b.parentElement()) && u(a.text) == u(b.innerText) ? b : | |
null | |
} | |
}(), | |
Ea = function(a) { | |
var b = a ? 864E5 : -5E3; | |
b = new Date(t() + b); | |
h.cookie = "tracerabg=" + a + ";path=/;expires=" + b.toUTCString() | |
}, | |
Ga = function(a) { | |
var b; | |
a: { | |
b = h.getElementsByTagName("script"); | |
for (var c = 0; c < b.length; c++) | |
if (/\/show_afs_search\.js/i.test(b[c].src)) { | |
b = true; | |
break a | |
} | |
b = false | |
} | |
if (!b && Fa(location)) { | |
Tynt.b = a || Q(location.href); | |
location.replace(location.href + "#axzz" + Tynt.b) | |
} | |
}, | |
Fa = function(a) { | |
if (a.hash != "") | |
return false; | |
if (typeof g.ba == "boolean" && g.ba) | |
g.ba = ["/"]; | |
else if (!g.ba) | |
return true; | |
for (var b, c = g.ba.length - 1; c >= 0; c--) { | |
b = null; | |
var f = g.ba[c], | |
d = f.indexOf("/"); | |
if (d != 0) { | |
b = f.slice(0, d); | |
f = f.slice(d) | |
} | |
if (!b || a.host == b) | |
if (f.charAt(f.length - 1) == "#") { | |
if (a.pathname.indexOf(f.slice(0, -1)) == 0) | |
return false | |
} else if (a.pathname == f) | |
return false | |
} | |
return true | |
}, | |
Ha = function(a) { | |
g = Tynt.i || window.tyntVariables || {}; | |
g.s = a.s || 1; | |
g.a = !(g.a == 0 || a.a == 0); | |
g.cc = g.cc || a.cc || 0; | |
if (g.cc > 6) | |
g.cc = 0; | |
g.b = !!(g.b || a.b); | |
g.aw = Math.max(g.aw || 8, 8); | |
if (g.a) { | |
g.ap = (g.ap || (typeof tyntAP != "undefined" ? tyntAP : null) || "Read more:") + " "; | |
g.as = g.as || (typeof tyntAS != | |
"undefined" ? tyntAS : null) || ""; | |
g.st = !!(g.st || a.st); | |
g.su = !(g.su == 0 || a.su == 0); | |
g.sp = g.sp || a.sp; | |
if (g.sp) { | |
Y = g.spid; | |
X = (g.spt || decodeURIComponent(a.spt || "")) + " "; | |
A = g.sp || decodeURIComponent(a.sp || "") | |
} | |
} | |
}, | |
na = function() { | |
var a = h.title.indexOf("#ixzz"); | |
if (a > -1) | |
h.title = h.title.substring(0, a); | |
a = h.title.indexOf("#axzz"); | |
if (a > -1) | |
h.title = h.title.substring(0, a) | |
}, | |
Ia = function() { | |
// GUESS: return user/liscense id? | |
for (var a = 0; a < Tynt.length; a++) | |
if (Tynt[a] && Tynt[a].length == 22) | |
// Liscense keys are probably 22 char long | |
// and nothing else is 22 char | |
return Tynt[a]; | |
return null | |
}, | |
L = function(a) { | |
// 'a' is the path that the website uses to link to the tracer script. | |
// This deserializes the URL to pull the variables out | |
// namely, user and s | |
if (!a) | |
return {}; | |
for (var b = {}, c = a.substring(a.indexOf("?") + 1).split("&"), f = 0; f < c.length; f++) { | |
var d = c[f].split("="); | |
if (d[0].indexOf("amp;") == 0) | |
d[0] = d[0].substring(4); | |
b[d[0]] = d[1] | |
} | |
a = a.split("/"); | |
a.pop(); | |
b.scriptPathUri = a.join("/"); | |
// return Object with user and s defined | |
return b | |
} (function() { | |
//For finding the path to the tracer script itself | |
// exposes the userID and whatever 's' is. | |
// example(gq.com): | |
// <script type="text/javascript" src="http://tcr.tynt.com/javascripts/Tracer.js?user=dxqip03Har3Rk7ab7jrHtB&s=102"></script> | |
for (var a = h.getElementsByTagName("script"), b = 0; b < a.length; b++) | |
if (/\/tracer.*\?/i.test(a[b].src)) | |
return a[b].src; | |
return null | |
}()), | |
// Liscense authorization? | |
$ = L.user || Ia(); | |
if (!$) | |
throw Error("Error finding Tynt Insight userId. Please check your HTML for errors."); | |
L.user && Tynt.push(L.user); | |
if (!function() { | |
// I think this is to check if its in debug mode | |
var a = /tracer=test/.test(location.href); | |
a && n(ua + "/script/verify/" + $); | |
if (a) | |
return true; | |
if (/tracer=no_tracing/.test(location.href)) | |
return true; | |
if (/disableTracer=/.test(location.href)) { | |
a = location.href.match(/disableTracer=([^?$]*)/)[1]; | |
var b = new Date; | |
b.setDate(a && a == "on" ? b.getDate() + 365 : b.getDate() - 2); | |
O("disableTracer=y", "expires=" + b.toUTCString()); | |
b = w("div", {}, {zIndex: "10000",position: "absolute",top: "10%",left: "10%",width: "80%",height: "80%",backgroundColor: "white",color: "black",textAlign: "center",fontSize: "32px",paddingTop: "10%",border: "1px solid gray"}); | |
b.innerHTML = "Tynt Insight has been turned " + (a && a == "on" ? "off" : "on") + " in this browser.<br>You may close this window."; | |
l.insertBefore(b, l.firstChild); | |
return true | |
} | |
if (F(h.cookie, "disableTracer")) | |
return true; | |
return false | |
}()) { | |
if (aa) { | |
na(); | |
h.attachEvent("onpropertychange", na) | |
} | |
Ha(L); | |
var T = x(); | |
x = va[ka(location.href)]; | |
if (za()) { | |
x || (x = /tynt.com/.test(h.referrer) ? 3 : 1); | |
la(x) | |
} | |
Tynt.m = Da; | |
if (g.b) | |
if (Z = Z(location.href)) { | |
if ("#axzz" + F(h.cookie, "tracerabg") != location.hash) { | |
Aa(Z); | |
la(2) | |
} | |
} else { | |
Ga(F(h.cookie, "tracerabg")); | |
Ea(Tynt.b) | |
} | |
} | |
}; | |
Tynt.TIL = function() { | |
document.body ? Ja() : setTimeout(Tynt.TIL, 300) | |
} | |
})(); | |
Tynt.TIL() | |
} | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment