Skip to content

Instantly share code, notes, and snippets.

@szepeviktor
Last active November 21, 2020 22:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save szepeviktor/0ecda4d0c9dc999e54f37cc54c382cf6 to your computer and use it in GitHub Desktop.
Save szepeviktor/0ecda4d0c9dc999e54f37cc54c382cf6 to your computer and use it in GitHub Desktop.
Google Call Tracking library https://www.gstatic.com/wcm/impl-1_31.js
(function () {
var l = this,
n = function (a) {
return "string" == typeof a
},
aa = function (a, b) {
a = a.split(".");
var c = l;
a[0] in c || "undefined" == typeof c.execScript || c.execScript("var " + a[0]);
for (var d; a.length && (d = a.shift());) a.length || void 0 === b ? c[d] && c[d] !== Object.prototype[d] ? c = c[d] : c = c[d] = {} : c[d] = b
},
ba = /^[\w+/_-]+[=]{0,2}$/,
p = null,
r = function () {},
t = function (a) {
var b = typeof a;
if ("object" == b)
if (a) {
if (a instanceof Array) return "array";
if (a instanceof Object) return b;
var c = Object.prototype.toString.call(a);
if ("[object Window]" ==
c) return "object";
if ("[object Array]" == c || "number" == typeof a.length && "undefined" != typeof a.splice && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("splice")) return "array";
if ("[object Function]" == c || "undefined" != typeof a.call && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("call")) return "function"
} else return "null";
else if ("function" == b && "undefined" == typeof a.call) return "object";
return b
},
u = function (a) {
return "function" == t(a)
},
ca = function (a) {
var b = typeof a;
return "object" ==
b && null != a || "function" == b
},
da = function (a, b, c) {
return a.call.apply(a.bind, arguments)
},
ea = function (a, b, c) {
if (!a) throw Error();
if (2 < arguments.length) {
var d = Array.prototype.slice.call(arguments, 2);
return function () {
var c = Array.prototype.slice.call(arguments);
Array.prototype.unshift.apply(c, d);
return a.apply(b, c)
}
}
return function () {
return a.apply(b, arguments)
}
},
v = function (a, b, c) {
Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("native code") ? v = da : v = ea;
return v.apply(null, arguments)
},
fa = Date.now || function () {
return +new Date
},
w = function (a, b) {
function c() {}
c.prototype = b.prototype;
a.Z = b.prototype;
a.prototype = new c;
a.prototype.constructor = a;
a.Y = function (a, c, f) {
for (var d = Array(arguments.length - 2), e = 2; e < arguments.length; e++) d[e - 2] = arguments[e];
return b.prototype[c].apply(a, d)
}
};
var x = function (a) {
if (Error.captureStackTrace) Error.captureStackTrace(this, x);
else {
var b = Error().stack;
b && (this.stack = b)
}
a && (this.message = String(a))
};
w(x, Error);
x.prototype.name = "CustomError";
var ha;
var y = function (a, b) {
a = a.split("%s");
for (var c = "", d = a.length - 1, e = 0; e < d; e++) c += a[e] + (e < b.length ? b[e] : "%s");
x.call(this, c + a[d])
};
w(y, x);
y.prototype.name = "AssertionError";
var ia = function (a, b, c, d) {
var e = "Assertion failed";
if (c) {
e += ": " + c;
var f = d
} else a && (e += ": " + a, f = b);
throw new y("" + e, f || []);
},
z = function (a, b, c) {
a || ia("", null, b, Array.prototype.slice.call(arguments, 2))
},
ja = function (a, b) {
throw new y("Failure" + (a ? ": " + a : ""), Array.prototype.slice.call(arguments, 1));
},
A = function (a, b, c) {
"number" == typeof a || ia("Expected number but got %s: %s.", [t(a), a], b, Array.prototype.slice.call(arguments, 2));
return a
},
B = function (a, b, c) {
u(a) || ia("Expected function but got %s: %s.", [t(a),
a
], b, Array.prototype.slice.call(arguments, 2))
};
var C = function (a, b) {
this.a = a === ka && b || "";
this.b = la
};
C.prototype.L = !0;
C.prototype.K = function () {
return this.a
};
C.prototype.toString = function () {
return "Const{" + this.a + "}"
};
var ma = function (a) {
if (a instanceof C && a.constructor === C && a.b === la) return a.a;
ja("expected object of type Const, got '" + a + "'");
return "type_error:Const"
},
la = {},
ka = {};
var D = function () {
this.a = "";
this.b = na
};
D.prototype.L = !0;
D.prototype.K = function () {
return this.a
};
var qa = function (a, b) {
a = oa(a);
if (/#/.test(a)) throw Error("Found a hash in url (" + a + "), appending not supported.");
var c = /\?/.test(a) ? "&" : "?",
d;
for (d in b)
for (var e = "array" == t(b[d]) ? b[d] : [b[d]], f = 0; f < e.length; f++) null != e[f] && (a += c + encodeURIComponent(d) + "=" + encodeURIComponent(String(e[f])), c = "&");
return pa(a)
};
D.prototype.toString = function () {
return "TrustedResourceUrl{" + this.a + "}"
};
var oa = function (a) {
if (a instanceof D && a.constructor === D && a.b === na) return a.a;
ja("expected object of type TrustedResourceUrl, got '" + a + "' of type " + t(a));
return "type_error:TrustedResourceUrl"
},
ta = function (a) {
var b = ma(new C(ka, "https://www.googleadservices.com/pagead/conversion/%{ak}/wcm"));
if (!ra.test(b)) throw Error("Invalid TrustedResourceUrl format: " + b);
var c = b.replace(sa, function (c, e) {
if (!Object.prototype.hasOwnProperty.call(a, e)) throw Error('Found marker, "' + e + '", in format string, "' + b + '", but no valid label mapping found in args: ' +
JSON.stringify(a));
c = a[e];
return c instanceof C ? ma(c) : encodeURIComponent(String(c))
});
return pa(c)
},
sa = /%{(\w+)}/g,
ra = /^(?:https:)?\/\/[0-9a-z.:[\]-]+\/|^\/[^\/\\]|^about:blank#/i,
ua = function (a, b) {
return qa(ta(a), b)
},
na = {},
pa = function (a) {
var b = new D;
b.a = a;
return b
};
var va = /^~?[\w-]+$/,
wa = function (a) {
return a.filter(function (a) {
return va.test(a)
})
};
var xa = /^UA-\d+-\d+%3A[\w-]+(?:%2C[\w-]+)*(?:%3BUA-\d+-\d+%3A[\w-]+(?:%2C[\w-]+)*)*$/,
ya = /^~?[\w-]+(?:\.~?[\w-]+)*$/,
za = /^\d+\.fls\.doubleclick\.net$/,
Aa = /;gac=([^;?]+)/,
Ba = /;gclaw=([^;?]+)/;
var Ca = Array.prototype.indexOf ? function (a, b) {
z(null != a.length);
return Array.prototype.indexOf.call(a, b, void 0)
} : function (a, b) {
if (n(a)) return n(b) && 1 == b.length ? a.indexOf(b, 0) : -1;
for (var c = 0; c < a.length; c++)
if (c in a && a[c] === b) return c;
return -1
},
Da = Array.prototype.forEach ? function (a, b, c) {
z(null != a.length);
Array.prototype.forEach.call(a, b, c)
} : function (a, b, c) {
for (var d = a.length, e = n(a) ? a.split("") : a, f = 0; f < d; f++) f in e && b.call(c, e[f], f, a)
},
Ea = Array.prototype.some ? function (a, b) {
z(null != a.length);
return Array.prototype.some.call(a,
b, void 0)
} : function (a, b) {
for (var c = a.length, d = n(a) ? a.split("") : a, e = 0; e < c; e++)
if (e in d && b.call(void 0, d[e], e, a)) return !0;
return !1
},
Fa = function (a) {
return Array.prototype.concat.apply([], arguments)
},
Ga = function (a) {
var b = a.length;
if (0 < b) {
for (var c = Array(b), d = 0; d < b; d++) c[d] = a[d];
return c
}
return []
};
var E;
a: {
var Ha = l.navigator;
if (Ha) {
var Ia = Ha.userAgent;
if (Ia) {
E = Ia;
break a
}
}
E = ""
};
var Ja = function (a, b) {
for (var c in a) b.call(void 0, a[c], c, a)
},
Ka = "constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),
La = function (a, b) {
for (var c, d, e = 1; e < arguments.length; e++) {
d = arguments[e];
for (c in d) a[c] = d[c];
for (var f = 0; f < Ka.length; f++) c = Ka[f], Object.prototype.hasOwnProperty.call(d, c) && (a[c] = d[c])
}
};
var Ma = function (a, b) {
var c = (c = a && a.ownerDocument) && (c.defaultView || c.parentWindow) || l;
if ("undefined" != typeof c.HTMLScriptElement && "undefined" != typeof c.Location && "undefined" != typeof c.Element) {
c = a && (a instanceof c.HTMLScriptElement || !(a instanceof c.Location || a instanceof c.Element));
var d = ca(a) ? a.constructor.displayName || a.constructor.name || Object.prototype.toString.call(a) : void 0 === a ? "undefined" : null === a ? "null" : typeof a;
z(c, "Argument is not a %s (or a non-Element, non-Location mock); got: %s", "HTMLScriptElement",
d)
}
a.src = oa(b);
if (null === p) {
a: {
b = l.document;
if ((b = b.querySelector && b.querySelector("script[nonce]")) && (b = b.nonce || b.getAttribute("nonce")) && ba.test(b)) break a;b = null
}
p = b || ""
}(b = p) && a.setAttribute("nonce", b)
};
var Na = function (a, b) {
var c;
var d = document;
b = b || d;
if (b.querySelectorAll && b.querySelector && a) return b.querySelectorAll(a ? "." + a : "");
if (a && b.getElementsByClassName) {
var e = b.getElementsByClassName(a);
return e
}
e = b.getElementsByTagName("*");
if (a) {
var f = {};
for (d = c = 0; b = e[d]; d++) {
var g = b.className,
h;
if (h = "function" == typeof g.split) h = 0 <= Ca(g.split(/\s+/), a);
h && (f[c++] = b)
}
f.length = c;
return f
}
return e
},
Pa = function (a, b) {
Ja(b, function (b, d) {
b && "object" == typeof b && b.L && (b = b.K());
"style" == d ? a.style.cssText = b : "class" ==
d ? a.className = b : "for" == d ? a.htmlFor = b : Oa.hasOwnProperty(d) ? a.setAttribute(Oa[d], b) : 0 == d.lastIndexOf("aria-", 0) || 0 == d.lastIndexOf("data-", 0) ? a.setAttribute(d, b) : a[d] = b
})
},
Oa = {
cellpadding: "cellPadding",
cellspacing: "cellSpacing",
colspan: "colSpan",
frameborder: "frameBorder",
height: "height",
maxlength: "maxLength",
nonce: "nonce",
role: "role",
rowspan: "rowSpan",
type: "type",
usemap: "useMap",
valign: "vAlign",
width: "width"
},
Qa = function (a) {
this.a = a || l.document || document
};
Qa.prototype.appendChild = function (a, b) {
a.appendChild(b)
};
var Ta = function (a) {
var b = [];
Ra(new Sa, a, b);
return b.join("")
},
Sa = function () {},
Ra = function (a, b, c) {
if (null == b) c.push("null");
else {
if ("object" == typeof b) {
if ("array" == t(b)) {
var d = b;
b = d.length;
c.push("[");
for (var e = "", f = 0; f < b; f++) c.push(e), Ra(a, d[f], c), e = ",";
c.push("]");
return
}
if (b instanceof String || b instanceof Number || b instanceof Boolean) b = b.valueOf();
else {
c.push("{");
e = "";
for (d in b) Object.prototype.hasOwnProperty.call(b, d) && (f = b[d], "function" != typeof f && (c.push(e), Ua(d, c), c.push(":"), Ra(a, f, c), e =
","));
c.push("}");
return
}
}
switch (typeof b) {
case "string":
Ua(b, c);
break;
case "number":
c.push(isFinite(b) && !isNaN(b) ? String(b) : "null");
break;
case "boolean":
c.push(String(b));
break;
case "function":
c.push("null");
break;
default:
throw Error("Unknown type: " + typeof b);
}
}
},
Va = {
'"': '\\"',
"\\": "\\\\",
"/": "\\/",
"\b": "\\b",
"\f": "\\f",
"\n": "\\n",
"\r": "\\r",
"\t": "\\t",
"\x0B": "\\u000b"
},
Wa = /\uffff/.test("\uffff") ? /[\\"\x00-\x1f\x7f-\uffff]/g : /[\\"\x00-\x1f\x7f-\xff]/g,
Ua = function (a, b) {
b.push('"', a.replace(Wa, function (a) {
var b =
Va[a];
b || (b = "\\u" + (a.charCodeAt(0) | 65536).toString(16).substr(1), Va[a] = b);
return b
}), '"')
};
var Xa = function (a, b) {
this.c = a;
this.f = b;
this.b = 0;
this.a = null
};
Xa.prototype.get = function () {
if (0 < this.b) {
this.b--;
var a = this.a;
this.a = a.next;
a.next = null
} else a = this.c();
return a
};
var Ya = function (a, b) {
a.f(b);
100 > a.b && (a.b++, b.next = a.a, a.a = b)
};
var Za = function (a) {
l.setTimeout(function () {
throw a;
}, 0)
},
$a, ab = function () {
var a = l.MessageChannel;
"undefined" === typeof a && "undefined" !== typeof window && window.postMessage && window.addEventListener && -1 == E.indexOf("Presto") && (a = function () {
var a = document.createElement("IFRAME");
a.style.display = "none";
a.src = "";
document.documentElement.appendChild(a);
var b = a.contentWindow;
a = b.document;
a.open();
a.write("");
a.close();
var c = "callImmediate" + Math.random(),
d = "file:" == b.location.protocol ? "*" : b.location.protocol +
"//" + b.location.host;
a = v(function (a) {
if (("*" == d || a.origin == d) && a.data == c) this.port1.onmessage()
}, this);
b.addEventListener("message", a, !1);
this.port1 = {};
this.port2 = {
postMessage: function () {
b.postMessage(c, d)
}
}
});
if ("undefined" !== typeof a && -1 == E.indexOf("Trident") && -1 == E.indexOf("MSIE")) {
var b = new a,
c = {},
d = c;
b.port1.onmessage = function () {
if (void 0 !== c.next) {
c = c.next;
var a = c.I;
c.I = null;
a()
}
};
return function (a) {
d.next = {
I: a
};
d = d.next;
b.port2.postMessage(0)
}
}
return "undefined" !== typeof document && "onreadystatechange" in
document.createElement("SCRIPT") ? function (a) {
var b = document.createElement("SCRIPT");
b.onreadystatechange = function () {
b.onreadystatechange = null;
b.parentNode.removeChild(b);
b = null;
a();
a = null
};
document.documentElement.appendChild(b)
} : function (a) {
l.setTimeout(a, 0)
}
};
var bb = function () {
this.b = this.a = null
},
db = new Xa(function () {
return new cb
}, function (a) {
a.reset()
});
bb.prototype.add = function (a, b) {
var c = db.get();
c.set(a, b);
this.b ? this.b.next = c : (z(!this.a), this.a = c);
this.b = c
};
var fb = function () {
var a = eb,
b = null;
a.a && (b = a.a, a.a = a.a.next, a.a || (a.b = null), b.next = null);
return b
},
cb = function () {
this.next = this.b = this.a = null
};
cb.prototype.set = function (a, b) {
this.a = a;
this.b = b;
this.next = null
};
cb.prototype.reset = function () {
this.next = this.b = this.a = null
};
var ib = function (a, b) {
F || gb();
hb || (F(), hb = !0);
eb.add(a, b)
},
F, gb = function () {
if (l.Promise && l.Promise.resolve) {
var a = l.Promise.resolve(void 0);
F = function () {
a.then(jb)
}
} else F = function () {
var a = jb,
c;
!(c = !u(l.setImmediate)) && (c = l.Window && l.Window.prototype) && (c = -1 == E.indexOf("Edge") && l.Window.prototype.setImmediate == l.setImmediate);
c ? ($a || ($a = ab()), $a(a)) : l.setImmediate(a)
}
},
hb = !1,
eb = new bb,
jb = function () {
for (var a; a = fb();) {
try {
a.a.call(a.b)
} catch (b) {
Za(b)
}
Ya(db, a)
}
hb = !1
};
var kb = function (a) {
a.prototype.then = a.prototype.then;
a.prototype.$goog_Thenable = !0
},
lb = function (a) {
if (!a) return !1;
try {
return !!a.$goog_Thenable
} catch (b) {
return !1
}
};
var I = function (a, b) {
this.a = 0;
this.i = void 0;
this.f = this.b = this.c = null;
this.g = this.h = !1;
if (a != r) try {
var c = this;
a.call(b, function (a) {
G(c, 2, a)
}, function (a) {
if (!(a instanceof H)) try {
if (a instanceof Error) throw a;
throw Error("Promise rejected.");
} catch (e) {}
G(c, 3, a)
})
} catch (d) {
G(this, 3, d)
}
},
mb = function () {
this.next = this.f = this.c = this.b = this.a = null;
this.g = !1
};
mb.prototype.reset = function () {
this.f = this.c = this.b = this.a = null;
this.g = !1
};
var nb = new Xa(function () {
return new mb
}, function (a) {
a.reset()
}),
ob = function (a, b, c) {
var d = nb.get();
d.b = a;
d.c = b;
d.f = c;
return d
};
I.prototype.then = function (a, b, c) {
null != a && B(a, "opt_onFulfilled should be a function.");
null != b && B(b, "opt_onRejected should be a function. Did you pass opt_context as the second argument instead of the third?");
return pb(this, u(a) ? a : null, u(b) ? b : null, c)
};
kb(I);
I.prototype.cancel = function (a) {
0 == this.a && ib(function () {
var b = new H(a);
qb(this, b)
}, this)
};
var qb = function (a, b) {
if (0 == a.a)
if (a.c) {
var c = a.c;
if (c.b) {
for (var d = 0, e = null, f = null, g = c.b; g && (g.g || (d++, g.a == a && (e = g), !(e && 1 < d))); g = g.next) e || (f = g);
e && (0 == c.a && 1 == d ? qb(c, b) : (f ? (d = f, z(c.b), z(null != d), d.next == c.f && (c.f = d), d.next = d.next.next) : rb(c), sb(c, e, 3, b)))
}
a.c = null
} else G(a, 3, b)
},
ub = function (a, b) {
a.b || 2 != a.a && 3 != a.a || tb(a);
z(null != b.b);
a.f ? a.f.next = b : a.b = b;
a.f = b
},
pb = function (a, b, c, d) {
var e = ob(null, null, null);
e.a = new I(function (a, g) {
e.b = b ? function (c) {
try {
var e = b.call(d, c);
a(e)
} catch (k) {
g(k)
}
} : a;
e.c = c ? function (b) {
try {
var e = c.call(d, b);
void 0 === e && b instanceof H ? g(b) : a(e)
} catch (k) {
g(k)
}
} : g
});
e.a.c = a;
ub(a, e);
return e.a
};
I.prototype.w = function (a) {
z(1 == this.a);
this.a = 0;
G(this, 2, a)
};
I.prototype.C = function (a) {
z(1 == this.a);
this.a = 0;
G(this, 3, a)
};
var G = function (a, b, c) {
if (0 == a.a) {
a === c && (b = 3, c = new TypeError("Promise cannot resolve to itself"));
a.a = 1;
a: {
var d = c,
e = a.w,
f = a.C;
if (d instanceof I) {
null != e && B(e, "opt_onFulfilled should be a function.");
null != f && B(f, "opt_onRejected should be a function. Did you pass opt_context as the second argument instead of the third?");
ub(d, ob(e || r, f || null, a));
var g = !0
} else if (lb(d)) d.then(e, f, a),
g = !0;
else {
if (ca(d)) try {
var h = d.then;
if (u(h)) {
vb(d, h, e, f, a);
g = !0;
break a
}
} catch (q) {
f.call(a, q);
g = !0;
break a
}
g = !1
}
}
g ||
(a.i = c, a.a = b, a.c = null, tb(a), 3 != b || c instanceof H || wb(a, c))
}
},
vb = function (a, b, c, d, e) {
var f = !1,
g = function (a) {
f || (f = !0, c.call(e, a))
},
h = function (a) {
f || (f = !0, d.call(e, a))
};
try {
b.call(a, g, h)
} catch (q) {
h(q)
}
},
tb = function (a) {
a.h || (a.h = !0, ib(a.j, a))
},
rb = function (a) {
var b = null;
a.b && (b = a.b, a.b = b.next, b.next = null);
a.b || (a.f = null);
null != b && z(null != b.b);
return b
};
I.prototype.j = function () {
for (var a; a = rb(this);) sb(this, a, this.a, this.i);
this.h = !1
};
var sb = function (a, b, c, d) {
if (3 == c && b.c && !b.g)
for (; a && a.g; a = a.c) a.g = !1;
if (b.a) b.a.c = null, xb(b, c, d);
else try {
b.g ? b.b.call(b.f) : xb(b, c, d)
} catch (e) {
yb.call(null, e)
}
Ya(nb, b)
},
xb = function (a, b, c) {
2 == b ? a.b.call(a.f, c) : a.c && a.c.call(a.f, c)
},
wb = function (a, b) {
a.g = !0;
ib(function () {
a.g && yb.call(null, b)
})
},
yb = Za,
H = function (a) {
x.call(this, a)
};
w(H, x);
H.prototype.name = "cancel";
/*
Portions of this code are from MochiKit, received by
The Closure Authors under the MIT license. All other code is Copyright
2005-2009 The Closure Authors. All Rights Reserved.
*/
var J = function (a, b) {
this.g = [];
this.P = a;
this.N = b || null;
this.f = this.a = !1;
this.c = void 0;
this.w = this.C = this.i = !1;
this.h = 0;
this.b = null;
this.j = 0
};
J.prototype.cancel = function (a) {
if (this.a) this.c instanceof J && this.c.cancel();
else {
if (this.b) {
var b = this.b;
delete this.b;
a ? b.cancel(a) : (b.j--, 0 >= b.j && b.cancel())
}
this.P ? this.P.call(this.N, this) : this.w = !0;
this.a || zb(this, new K(this))
}
};
J.prototype.M = function (a, b) {
this.i = !1;
Ab(this, a, b)
};
var Ab = function (a, b, c) {
a.a = !0;
a.c = c;
a.f = !b;
Bb(a)
},
Cb = function (a) {
if (a.a) {
if (!a.w) throw new L(a);
a.w = !1
}
};
J.prototype.callback = function (a) {
Cb(this);
Db(a);
Ab(this, !0, a)
};
var zb = function (a, b) {
Cb(a);
Db(b);
Ab(a, !1, b)
},
Db = function (a) {
z(!(a instanceof J), "An execution sequence may not be initiated with a blocking Deferred.")
},
Eb = function (a, b, c, d) {
z(!a.C, "Blocking Deferreds can not be re-used");
a.g.push([b, c, d]);
a.a && Bb(a)
};
J.prototype.then = function (a, b, c) {
var d, e, f = new I(function (a, b) {
d = a;
e = b
});
Eb(this, d, function (a) {
a instanceof K ? f.cancel() : e(a)
});
return f.then(a, b, c)
};
kb(J);
var Fb = function (a) {
return Ea(a.g, function (a) {
return u(a[1])
})
},
Bb = function (a) {
if (a.h && a.a && Fb(a)) {
var b = a.h,
c = M[b];
c && (l.clearTimeout(c.u), delete M[b]);
a.h = 0
}
a.b && (a.b.j--, delete a.b);
b = a.c;
for (var d = c = !1; a.g.length && !a.i;) {
var e = a.g.shift(),
f = e[0],
g = e[1];
e = e[2];
if (f = a.f ? g : f) try {
var h = f.call(e || a.N, b);
void 0 !== h && (a.f = a.f && (h == b || h instanceof Error), a.c = b = h);
if (lb(b) || "function" === typeof l.Promise && b instanceof l.Promise) d = !0, a.i = !0
} catch (q) {
b = q, a.f = !0, Fb(a) || (c = !0)
}
}
a.c = b;
d && (h = v(a.M, a, !0), d = v(a.M,
a, !1), b instanceof J ? (Eb(b, h, d), b.C = !0) : b.then(h, d));
c && (b = new Gb(b), M[b.u] = b, a.h = b.u)
},
L = function () {
x.call(this)
};
w(L, x);
L.prototype.message = "Deferred has already fired";
L.prototype.name = "AlreadyCalledError";
var K = function () {
x.call(this)
};
w(K, x);
K.prototype.message = "Deferred was canceled";
K.prototype.name = "CanceledError";
var Gb = function (a) {
this.u = l.setTimeout(v(this.b, this), 0);
this.a = a
};
Gb.prototype.b = function () {
z(M[this.u], "Cannot throw an error that is not scheduled.");
delete M[this.u];
throw this.a;
};
var M = {};
var Kb = function (a, b) {
var c = b || {};
b = c.document || document;
var d = oa(a),
e = document.createElement("SCRIPT"),
f = {
O: e,
D: void 0
},
g = new J(Hb, f),
h = null,
q = null != c.timeout ? c.timeout : 5E3;
0 < q && (h = window.setTimeout(function () {
N(e, !0);
zb(g, new Ib(1, "Timeout reached for loading script " + d))
}, q), f.D = h);
e.onload = e.onreadystatechange = function () {
e.readyState && "loaded" != e.readyState && "complete" != e.readyState || (N(e, c.S || !1, h), g.callback(null))
};
e.onerror = function () {
N(e, !0, h);
zb(g, new Ib(0, "Error while loading script " + d))
};
f = c.attributes || {};
La(f, {
type: "text/javascript",
charset: "UTF-8"
});
Pa(e, f);
Ma(e, a);
Jb(b).appendChild(e);
return g
},
Jb = function (a) {
var b;
return (b = (a || document).getElementsByTagName("HEAD")) && 0 != b.length ? b[0] : a.documentElement
},
Hb = function () {
if (this && this.O) {
var a = this.O;
a && "SCRIPT" == a.tagName && N(a, !0, this.D)
}
},
N = function (a, b, c) {
null != c && l.clearTimeout(c);
a.onload = r;
a.onerror = r;
a.onreadystatechange = r;
b && window.setTimeout(function () {
a && a.parentNode && a.parentNode.removeChild(a)
}, 0)
},
Ib = function (a, b) {
var c =
"Jsloader error (code #" + a + ")";
b && (c += ": " + b);
x.call(this, c);
this.code = a
};
w(Ib, x);
var Lb = function (a) {
this.a = a;
this.D = 5E3
},
Mb = 0,
Pb = function (a, b, c, d) {
var e = {};
d = d || "_" + (Mb++).toString(36) + fa().toString(36);
var f = "_callbacks___" + d;
b && (l[f] = Nb(d, b), e.callback = f);
b = {
timeout: a.D,
S: !0
};
a = qa(a.a, e);
a = Kb(a, b);
Eb(a, null, Ob(d, e, c), void 0)
};
Lb.prototype.cancel = function (a) {
a && (a.T && a.T.cancel(), a.u && Qb(a.u, !1))
};
var Ob = function (a, b, c) {
return function () {
Qb(a, !1);
c && c(b)
}
},
Nb = function (a, b) {
return function (c) {
Qb(a, !0);
b.apply(void 0, arguments)
}
},
Qb = function (a, b) {
a = "_callbacks___" + a;
if (l[a])
if (b) try {
delete l[a]
} catch (c) {
l[a] = void 0
} else l[a] = r
};
var O = function (a, b) {
this.b = {};
this.a = [];
this.c = 0;
var c = arguments.length;
if (1 < c) {
if (c % 2) throw Error("Uneven number of arguments");
for (var d = 0; d < c; d += 2) this.set(arguments[d], arguments[d + 1])
} else if (a)
if (a instanceof O)
for (c = a.v(), d = 0; d < c.length; d++) this.set(c[d], a.get(c[d]));
else
for (d in a) this.set(d, a[d])
};
O.prototype.f = function () {
Rb(this);
for (var a = [], b = 0; b < this.a.length; b++) a.push(this.b[this.a[b]]);
return a
};
O.prototype.v = function () {
Rb(this);
return this.a.concat()
};
var Rb = function (a) {
if (a.c != a.a.length) {
for (var b = 0, c = 0; b < a.a.length;) {
var d = a.a[b];
P(a.b, d) && (a.a[c++] = d);
b++
}
a.a.length = c
}
if (a.c != a.a.length) {
var e = {};
for (c = b = 0; b < a.a.length;) d = a.a[b], P(e, d) || (a.a[c++] = d, e[d] = 1), b++;
a.a.length = c
}
};
O.prototype.get = function (a, b) {
return P(this.b, a) ? this.b[a] : b
};
O.prototype.set = function (a, b) {
P(this.b, a) || (this.c++, this.a.push(a));
this.b[a] = b
};
O.prototype.forEach = function (a, b) {
for (var c = this.v(), d = 0; d < c.length; d++) {
var e = c[d],
f = this.get(e);
a.call(b, f, e, this)
}
};
var P = function (a, b) {
return Object.prototype.hasOwnProperty.call(a, b)
};
var Sb = /^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/,
Tb = function (a, b) {
if (a) {
a = a.split("&");
for (var c = 0; c < a.length; c++) {
var d = a[c].indexOf("="),
e = null;
if (0 <= d) {
var f = a[c].substring(0, d);
e = a[c].substring(d + 1)
} else f = a[c];
b(f, e ? decodeURIComponent(e.replace(/\+/g, " ")) : "")
}
}
};
var Q = function (a, b) {
this.f = this.j = this.c = "";
this.i = null;
this.g = this.h = "";
this.a = !1;
if (a instanceof Q) {
this.a = void 0 !== b ? b : a.a;
Ub(this, a.c);
this.j = a.j;
this.f = a.f;
Vb(this, a.i);
this.h = a.h;
b = a.b;
var c = new R;
c.c = b.c;
b.a && (c.a = new O(b.a), c.b = b.b);
Wb(this, c);
this.g = a.g
} else a && (c = String(a).match(Sb)) ? (this.a = !!b, Ub(this, c[1] || "", !0), this.j = S(c[2] || ""), this.f = S(c[3] || "", !0), Vb(this, c[4]), this.h = S(c[5] || "", !0), Wb(this, c[6] || "", !0), this.g = S(c[7] || "")) : (this.a = !!b, this.b = new R(null, this.a))
};
Q.prototype.toString = function () {
var a = [],
b = this.c;
b && a.push(T(b, Xb, !0), ":");
var c = this.f;
if (c || "file" == b) a.push("//"), (b = this.j) && a.push(T(b, Xb, !0), "@"), a.push(encodeURIComponent(String(c)).replace(/%25([0-9a-fA-F]{2})/g, "%$1")), c = this.i, null != c && a.push(":", String(c));
if (c = this.h) this.f && "/" != c.charAt(0) && a.push("/"), a.push(T(c, "/" == c.charAt(0) ? Yb : Zb, !0));
(c = this.b.toString()) && a.push("?", c);
(c = this.g) && a.push("#", T(c, $b));
return a.join("")
};
var Ub = function (a, b, c) {
a.c = c ? S(b, !0) : b;
a.c && (a.c = a.c.replace(/:$/, ""))
},
Vb = function (a, b) {
if (b) {
b = Number(b);
if (isNaN(b) || 0 > b) throw Error("Bad port number " + b);
a.i = b
} else a.i = null
},
Wb = function (a, b, c) {
b instanceof R ? (a.b = b, ac(a.b, a.a)) : (c || (b = T(b, bc)), a.b = new R(b, a.a))
},
S = function (a, b) {
return a ? b ? decodeURI(a.replace(/%25/g, "%2525")) : decodeURIComponent(a) : ""
},
T = function (a, b, c) {
return n(a) ? (a = encodeURI(a).replace(b, cc), c && (a = a.replace(/%25([0-9a-fA-F]{2})/g, "%$1")), a) : null
},
cc = function (a) {
a = a.charCodeAt(0);
return "%" + (a >> 4 & 15).toString(16) + (a & 15).toString(16)
},
Xb = /[#\/\?@]/g,
Zb = /[#\?:]/g,
Yb = /[#\?]/g,
bc = /[#\?@]/g,
$b = /#/g,
R = function (a, b) {
this.b = this.a = null;
this.c = a || null;
this.g = !!b
},
U = function (a) {
a.a || (a.a = new O, a.b = 0, a.c && Tb(a.c, function (b, c) {
a.add(decodeURIComponent(b.replace(/\+/g, " ")), c)
}))
};
R.prototype.add = function (a, b) {
U(this);
this.c = null;
a = V(this, a);
var c = this.a.get(a);
c || this.a.set(a, c = []);
c.push(b);
this.b = A(this.b) + 1;
return this
};
var dc = function (a, b) {
U(a);
b = V(a, b);
P(a.a.b, b) && (a.c = null, a.b = A(a.b) - a.a.get(b).length, a = a.a, P(a.b, b) && (delete a.b[b], a.c--, a.a.length > 2 * a.c && Rb(a)))
},
ec = function (a, b) {
U(a);
b = V(a, b);
return P(a.a.b, b)
};
R.prototype.forEach = function (a, b) {
U(this);
this.a.forEach(function (c, d) {
Da(c, function (c) {
a.call(b, c, d, this)
}, this)
}, this)
};
R.prototype.v = function () {
U(this);
for (var a = this.a.f(), b = this.a.v(), c = [], d = 0; d < b.length; d++)
for (var e = a[d], f = 0; f < e.length; f++) c.push(b[d]);
return c
};
R.prototype.f = function (a) {
U(this);
var b = [];
if (n(a)) ec(this, a) && (b = Fa(b, this.a.get(V(this, a))));
else {
a = this.a.f();
for (var c = 0; c < a.length; c++) b = Fa(b, a[c])
}
return b
};
R.prototype.set = function (a, b) {
U(this);
this.c = null;
a = V(this, a);
ec(this, a) && (this.b = A(this.b) - this.a.get(a).length);
this.a.set(a, [b]);
this.b = A(this.b) + 1;
return this
};
R.prototype.get = function (a, b) {
if (!a) return b;
a = this.f(a);
return 0 < a.length ? String(a[0]) : b
};
R.prototype.toString = function () {
if (this.c) return this.c;
if (!this.a) return "";
for (var a = [], b = this.a.v(), c = 0; c < b.length; c++) {
var d = b[c],
e = encodeURIComponent(String(d));
d = this.f(d);
for (var f = 0; f < d.length; f++) {
var g = e;
"" !== d[f] && (g += "=" + encodeURIComponent(String(d[f])));
a.push(g)
}
}
return this.c = a.join("&")
};
var V = function (a, b) {
b = String(b);
a.g && (b = b.toLowerCase());
return b
},
ac = function (a, b) {
b && !a.g && (U(a), a.c = null, a.a.forEach(function (a, b) {
var c = b.toLowerCase();
b != c && (dc(this, b), dc(this, c), 0 < a.length && (this.c = null, this.a.set(V(this, c), Ga(a)), this.b = A(this.b) + a.length))
}, a));
a.g = b
};
var W = function (a) {
if (n(a)) try {
var b = JSON.parse(unescape(a));
a = b ? b : {}
} catch (c) {}
this.expires = parseInt(a.expires, 10);
this.m = a.mobile_number;
this.s = a.formatted_number;
this.l = a.fallback;
this.B = a.clabel;
this.o = a.backoff;
this.X = a.tld;
this.A = a.backoff_expires
};
W.prototype.encode = function () {
var a = {};
this.expires && (a.expires = this.expires);
this.m && (a.mobile_number = this.m);
this.s && (a.formatted_number = this.s);
this.l && (a.fallback = this.l);
this.B && (a.clabel = this.B);
this.o && (a.backoff = this.o);
this.A && (a.backoff_expires = this.A);
return escape(Ta(a))
};
var X = null,
fc = !1;
function gc() {
var a = document.getElementById("google-wcc-debug-window");
if (a) return a;
var b = function (a) {
if (n(a)) return document.createTextNode(a);
var c = document.createElement(a[0]);
c.setAttribute("style", a[1] + ";");
if (a[2])
for (var d = 0; d != a[2].length; ++d) c.appendChild(b(a[2][d]));
return c
},
c = b(["div", "background-color:#fafafa;color:#000;border:1px solid #ddd;border-radius:3px;font-family:sans-serif;font-size:13px;position:fixed;bottom:0;left:0;width:40em;display:block;text-align:left;z-index:2147483645",
[
["div", "color:#222;font-size:16px;border-bottom:1px solid #ddd;padding:13px", ["Google AdWords Website Call Conversions", ["span", "float:right", [
["button", "border:1px solid #ddd;background-color:#fff;font-weight:bold;font-size:12px;padding:4px 8px;color:#444;box-shadow:#eee 0px 1px 0px 0px", ["Force"]],
["button", "border:1px solid #ddd;background-color:#fff;font-weight:bold;font-size:12px;padding:4px 8px;color:#444;box-shadow:#eee 0px 1px 0px 0px", ["Close"]]
]]]],
["div", "height:10em;padding:10px;overflow-y:auto"]
]
]);
document.body.appendChild(c);
a = c.childNodes[0].childNodes[1].childNodes;
a[0].onclick = function () {
X && (X[5] = new Date, X[6] = {
force: !0
}, hc.apply(void 0, X))
};
a[1].onclick = function () {
c.style.display = "none"
};
a = c.childNodes[1];
a.id = "google-wcc-debug-window";
return a
}
function Y(a) {
if (fc) {
for (var b = "", c = 0; c != arguments.length; ++c) {
var d = arguments[c];
n(d) || (d = Ta(d));
b += d
}
"" != b && ("." != b[b.length - 1] && (b += "."), c = gc(), c.appendChild(document.createTextNode(b)), c.appendChild(document.createElement("br")))
}
}
function ic(a) {
for (; null != a; a = a.parentNode)
if ("A" == a.nodeName) {
if (a.href && "tel:" == a.href.substr(0, 4)) return a;
break
} return null
}
function jc(a) {
a = a.replace(/\d/g, "9");
return ["+" + a.replace(/[^0-9]/g, ""), a]
}
function kc(a) {
var b = {
G: "gclid",
W: "ref",
U: "gac",
V: "gclaw"
};
return Object.keys(a).reduce(function (c, d) {
d in b && a[d] && (c[b[d]] = a[d]);
return c
}, {})
}
function lc(a) {
var b = document,
c = window.location.href;
c = (c instanceof Q ? new Q(c) : new Q(c, void 0)).b.get("gclid");
a.G = c;
a.W = b.referrer;
a: {
if (za.test(b.location.host)) {
if ((c = b.location.href.match(Ba)) && 2 == c.length && c[1].match(ya)) {
c = c[1];
break a
}
} else {
c = [];
for (var d = String(b.cookie || document.cookie).split(";"), e = 0; e < d.length; e++) {
var f = d[e].split("="),
g = f[0].replace(/^\s*|\s*$/g, "");
g && "_gcl_aw" == g && (f = f.slice(1).join("=").replace(/^\s*|\s*$/g, ""), c.push(f))
}
d = [];
if (c && 0 != c.length) {
for (e = 0; e < c.length; e++) f =
c[e].split("."), 3 == f.length && "GCL" == f[0] && f[1] && d.push(f[2]);
c = wa(d)
} else c = d;
if (0 < c.length) {
c = c.join(".");
break a
}
}
c = ""
}
a.V = c;
if (za.test(b.location.host)) var h = (h = b.location.href.match(Aa)) && 2 == h.length && h[1].match(xa) ? decodeURIComponent(h[1]) : "";
else {
c = [];
b = b.cookie.split(";");
d = /^\s*_gac_(UA-\d+-\d+)=\s*(.+?)\s*$/;
for (e = 0; e < b.length; e++)(f = b[e].match(d)) && c.push({
H: f[1],
value: f[2]
});
b = {};
if (c && c.length)
for (d = 0; d < c.length; d++) e = c[d].value.split("."), "1" == e[0] && 3 == e.length && e[1] && (b[c[d].H] || (b[c[d].H] = []), b[c[d].H].push({
timestamp: e[1],
G: e[2]
}));
c = [];
for (h in b) {
d = [];
e = b[h];
for (f = 0; f < e.length; f++) d.push(e[f].G);
c.push(h + ":" + d.join(","))
}
h = 0 < c.length ? c.join(";") : ""
}
a.U = h
}
function mc(a) {
var b = "https://" + (a.domain || "www.google.com") + "/pagead/attribution/wcm?" + ("cl=" + escape(a.J) + "&fb=" + escape(a.l) + "&use_ssct=1" + (a.F ? "&alloc=" + escape(a.F) : "")),
c = kc(a);
a = Object.keys(c).reduce(function (a, b) {
return a + "&" + b + "=" + escape(c[b])
}, b);
return pa(a)
}
var nc = 0;
function oc(a, b) {
pc(ua({
ak: a.R
}, {
cl: a.J,
fb: a.l,
alloc: a.F
}), function (c) {
null != c && 86400 == c.o ? (a.domain = c.X, pc(mc(a), b)) : b(c)
})
}
function pc(a, b) {
a = new Lb(a);
var c = "_" + (++nc).toString(36) + Math.round(Math.pow(36, 9) - Math.random() * Math.pow(36, 8)).toString(36).slice(1);
Pb(a, function (a) {
a: {
if (a && a.wcm && (a = new W(a.wcm), a.o || a.m && a.s)) break a;a = null
}
b(a)
}, function () {
b(null)
}, c)
}
var qc = "gwcc";
function rc() {
var a = document.cookie.match(new RegExp("(^|;| )" + qc + "=([^;]+)"));
return a ? new W(a[2]) : null
}
function sc(a) {
document.cookie = qc + "=" + a.encode() + ";path=/;max-age=7776000"
}
function tc(a) {
return !window.google_no_debug && (!a || !a.no_debug)
}
function uc(a) {
return n(a) && 0 < a.length
}
function vc() {
return uc(window.google_replace_number)
}
function wc(a, b) {
return null != a && b < new Date(1E3 * a)
}
function Z(a) {
window.google_wcc_status = a
}
function xc(a, b, c) {
var d = function (e) {
if (1 == e.nodeType && ("SCRIPT" == e.nodeName || "google-wcc-debug-window" == e.id)) return 0;
var f = 0;
if (3 == e.nodeType && -1 != e.data.search(a)) {
e.data = e.data.replace(a, b);
var g = ic(e);
null != g && (g.href = "tel:" + c);
++f
}
e = e.childNodes;
for (g = 0; g != e.length; g++) f += d(e[g]);
return f
};
return d(document.body)
}
function yc(a, b, c) {
var d = 10,
e = a.replace(/[^0-9]/g, "");
if (0 == e.length) Y('The specified number "', a, '" cannot be replaced'), Z("autoreplace fail");
else {
var f = new RegExp("\\(?" + e.split("").join("[^0-9]{0,3}"), "g"),
g = function () {
var e = xc(f, b, c);
0 < e ? (Y("Updated ", e, " element(s) with ", b), Z("success")) : 0 < d-- ? window.setTimeout(g, 500) : (Y("Could not find ", a, " in the page"), Z("autoreplace fail"))
};
g()
}
}
function zc(a) {
switch (a) {
case 300:
return "temporary error";
case 86400:
return "no ad click";
case 86402:
return "not tracked"
}
return "error #" + a
}
function hc(a, b, c, d, e, f, g) {
X = [].slice.apply(arguments);
fc = tc(g) && ("#google-wcc-" == window.location.hash.substr(0, 12) || "undefined" != typeof window.sessionStorage && "y" == window.sessionStorage.getItem("_goog_wcc_debug"));
vc() || c.autoreplace ? Y("Attempting to auto-replace") : u(b) ? Y("Using callback as target") : n(b) && Y("Using CSS class '", b, "' as target");
e && window.clearTimeout(e);
uc(c.autoreplace) && null == b && (d = c.autoreplace, b = function (a, b) {
yc(d, a, b)
});
if (d && b) {
var h = d.replace(/[^0-9A-Z]/gi, ""),
q = function (a,
c) {
if (new Date > new Date(f.valueOf() + (g && g.timeout ? g.timeout : 5E3))) Z("timeout");
else {
var e = d;
if (a.match(/^\+1\d{10}$/)) {
var h = e.match(/\d/g);
h = h ? h.length : 0;
if (10 != h && 11 != h) e = null;
else {
h = 11 == h ? 1 : 2;
for (var m = "", k = 0; k != e.length; ++k) m = e.charAt(k).match(/\d/) ? m + a.charAt(h++) : m + e.charAt(k);
e = m
}
} else e = null;
c = e ? e : c ? c : a;
h = b;
if (u(h)) vc() || (Y("Sending ", c, " to callback"), Z("success")), h(c, a);
else if (h) {
e = [];
(m = document.getElementById(h)) && e.push(m);
(m = document) ? (z(m, "Node cannot be null or undefined."), m = new Qa(9 ==
m.nodeType ? m : m.ownerDocument || m.document)) : m = ha || (ha = new Qa);
k = (m = m.a) || document;
k = k.querySelectorAll && k.querySelector ? k.querySelectorAll("." + h) : Na(h, m);
for (m = 0; m != k.length; ++m) e.push(k[m]);
if (0 == e.length) Y("Found no elements matching ", h), Z("receiver not found");
else {
for (m = 0; m != e.length; m++) {
for (k = e[m]; h = k.firstChild;) k.removeChild(h);
e[m].appendChild(document.createTextNode(c));
h = ic(e[m]);
null != h && (h.href = "tel:" + a)
}
Y("Updated ", e.length, " element(s) with ", c);
Z("success")
}
}
}
};
if (tc(g) && ("#google-wcc-force" ==
window.location.hash || g && g.force)) {
var k = jc(d);
q(k[0], k[1])
} else {
k = null;
if (!g || 0 != g.cache)
if (k = rc()) {
if (k.l && k.l != h) {
Y("Advertiser number doesn't match previous call: ", k.l);
Z("fallback mismatch");
return
}
if (null != k.m && null != k.expires && new Date(1E3 * k.expires) > new Date && k.B == c.cl && k.m && k.s) {
q(k.m, k.s);
return
}
} var Dc = g && g.referrer || document.referrer;
!fc && -1 == Dc.indexOf("//www.google.com") && k && wc(k.A, f) ? Z("backoff") : (k = {
R: c.ak,
J: c.cl,
l: h,
F: g && g.alloc
}, lc(k), oc(k, function (a) {
if (null != a) {
if (a.o) {
var b =
zc(a.o);
Y("Could not get number: ", b);
Z(b);
a.A = parseInt(f.valueOf() / 1E3 + a.o, 10)
}
g && 0 == g.cache || (a.l = h, a.B = c.cl, sc(a));
a.m && a.s && q(a.m, a.s)
} else g && 0 == g.cache || (a = new W({
expires: 86400,
backoff_expires: parseInt(f.valueOf() / 1E3 + 86400, 10)
}), sc(a)), Z("malformed reply")
}))
}
}
}
if (window._googWcmImpl) {
var Ac = window._googWcmImpl.q;
if (Ac)
for (var Bc = 0; Bc != Ac.length; ++Bc) hc.apply(void 0, [].slice.apply(Ac[Bc]))
}
aa("_googWcmImpl", hc);
aa("_googWccDebug", function (a) {
if ("undefined" == typeof window.sessionStorage) return "WCC debugging not available.";
"enable" == a ? window.sessionStorage.setItem("_goog_wcc_debug", "y") : "disable" == a && window.sessionStorage.removeItem("_goog_wcc_debug");
return "WCC debugging is " + ("y" == window.sessionStorage.getItem("_goog_wcc_debug") ? "enabled." : "disabled.")
});
if (vc()) {
var Cc = window.google_replace_number;
window._googWcmGet(function (a, b) {
yc(Cc, a, b)
}, Cc)
};
}).call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment