Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function() {
- var a = !1,
- b = /var xyz/.test(function() {}) ? /\b_super\b/ : /[\D|\d]*/;
- this.__tmClass = function() {};
- window.__tmClass = this.__tmClass;
- __tmClass.extend = function(c) {
- function e() {
- !a && this.init && this.init.apply(this, arguments)
- }
- var f = this.prototype;
- a = !0;
- var h = new this;
- a = !1;
- for (var n in c) h[n] = "function" == typeof c[n] && "function" == typeof f[n] && b.test(c[n]) ? function(a, c) {
- return function() {
- var b = this._super;
- this._super = f[a];
- var e = c.apply(this, arguments);
- this._super = b;
- return e
- }
- }(n, c[n]) : c[n];
- e.prototype =
- h;
- e.prototype.constructor = e;
- e.extend = arguments.callee;
- return window.__tmClass = e
- }
- })();
- window.triggermail = {};
- window.console ? "undefined" == typeof window.console.debug && (console.debug = function() {}) : console = {
- debug: function() {},
- error: function() {},
- log: function() {}
- };
- window.TM_API_HOST = "triggeredmail.appspot.com/api";
- window.triggermail.lytics = [];
- triggermail.lytics.__SV = 1.2;
- (function(a) {
- function b() {
- b.done || (I = b.done = !0, C = !1, d.each(A, function(g) {
- g._dom_loaded()
- }))
- }
- var c = Array.prototype,
- e = Object.prototype,
- f = c.slice,
- h = e.toString,
- n = e.hasOwnProperty,
- q = window.console,
- x = window.navigator,
- l = window.document,
- m = x.userAgent,
- H = ["__mps", "__mpa", "__mpap", "$people_distinct_id", "__alias"],
- u = !1;
- try {
- u = window.XMLHttpRequest && "withCredentials" in new XMLHttpRequest
- } catch (z) {}
- var v = "https:" == l.location.protocol ? "https://" : "http://",
- e = a && a.__SV || 0,
- y = u,
- C = !y && -1 == m.indexOf("MSIE"),
- d = {}, B = !1,
- K = {
- api_host: v + TM_API_HOST,
- cross_subdomain_cookie: !0,
- cookie_name: "",
- loaded: function() {},
- store_google: !1,
- save_referrer: !0,
- test: !1,
- verbose: !1,
- img: !1,
- track_pageview: !0,
- debug: !1,
- live_demo: !1,
- track_links_timeout: 300,
- cookie_expiration: 365,
- upgrade: !1,
- disable_cookie: !1,
- ip: !0
- }, I = !1;
- (function() {
- var g = c.forEach,
- a = c.indexOf,
- r = Array.isArray,
- b = {}, e = d.each = function(a, w, r) {
- if (null != a)
- if (g && a.forEach === g) a.forEach(w, r);
- else if (a.length === +a.length)
- for (var d = 0, c = a.length; d < c && !(d in a && w.call(r, a[d], d, a) === b); d++);
- else
- for (d in a)
- if (n.call(a, d) && w.call(r, a[d], d, a) === b) break
- };
- d.extend = function(g) {
- e(f.call(arguments, 1), function(a) {
- for (var w in a) void 0 !== a[w] && (g[w] = a[w])
- });
- return g
- };
- d.isArray = r || function(g) {
- return "[object Array]" === h.call(g)
- };
- d.isFunction = function(g) {
- try {
- return /^\s*\bfunction\b/.test(g)
- } catch (a) {
- return !1
- }
- };
- d.isArguments = function(g) {
- return !(!g || !n.call(g, "callee"))
- };
- d.toArray = function(g) {
- return !g ? [] : g.toArray ? g.toArray() : d.isArray(g) || d.isArguments(g) ? f.call(g) : d.values(g)
- };
- d.values = function(g) {
- var a = [];
- if (null == g) return a;
- e(g, function(g) {
- a[a.length] = g
- });
- return a
- };
- d.identity = function(g) {
- return g
- };
- d.include = function(g, r) {
- var d = !1;
- if (null == g) return d;
- if (a && g.indexOf === a) return -1 != g.indexOf(r);
- e(g, function(g) {
- if (d || (d = g === r)) return b
- });
- return d
- };
- d.includes = function(g, a) {
- return -1 !== g.indexOf(a)
- }
- })();
- d.inherit = function(g, a) {
- g.prototype = new a;
- g.prototype.constructor = g;
- g.superclass = a.prototype;
- return g
- };
- d.isObject = function(g) {
- return g === Object(g) && !d.isArray(g)
- };
- d.isEmptyObject = function(g) {
- if (d.isObject(g)) {
- for (var a in g)
- if (n.call(g,
- a)) return !1;
- return !0
- }
- return !1
- };
- d.isUndefined = function(g) {
- return void 0 === g
- };
- d.isString = function(g) {
- return "[object String]" == h.call(g)
- };
- d.isDate = function(g) {
- return "[object Date]" == h.call(g)
- };
- d.isNumber = function(g) {
- return "[object Number]" == h.call(g)
- };
- d.encodeDates = function(g) {
- d.each(g, function(a, r) {
- d.isDate(a) ? g[r] = d.formatDate(a) : d.isObject(a) && (g[r] = d.encodeDates(a))
- });
- return g
- };
- d.formatDate = function(g) {
- function a(g) {
- return 10 > g ? "0" + g : g
- }
- return g.getUTCFullYear() + "-" + a(g.getUTCMonth() + 1) + "-" + a(g.getUTCDate()) +
- "T" + a(g.getUTCHours()) + ":" + a(g.getUTCMinutes()) + ":" + a(g.getUTCSeconds())
- };
- d.strip_empty_properties = function(g) {
- var a = {};
- d.each(g, function(g, c) {
- d.isString(g) && 0 < g.length && (a[c] = g)
- });
- return a
- };
- d.truncate = function(g, a) {
- var r;
- "string" === typeof g ? r = g.slice(0, a) : d.isArray(g) ? (r = [], d.each(g, function(g) {
- r.push(d.truncate(g, a))
- })) : d.isObject(g) ? (r = {}, d.each(g, function(g, c) {
- r[c] = d.truncate(g, a)
- })) : r = g;
- return r
- };
- d.JSONEncode = function() {
- return function(g) {
- var a = function(g) {
- var a = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- w = {
- "\b": "\\b",
- "\t": "\\t",
- "\n": "\\n",
- "\f": "\\f",
- "\r": "\\r",
- '"': '\\"',
- "\\": "\\\\"
- };
- a.lastIndex = 0;
- return a.test(g) ? '"' + g.replace(a, function(g) {
- var a = w[g];
- return "string" === typeof a ? a : "\\u" + ("0000" + g.charCodeAt(0).toString(16)).slice(-4)
- }) + '"' : '"' + g + '"'
- }, r = function(g, d) {
- var c = "",
- b = 0,
- e = b = "",
- e = 0,
- f = c,
- l = [],
- k = d[g];
- switch (typeof k) {
- case "string":
- return a(k);
- case "number":
- return isFinite(k) ? String(k) : "null";
- case "boolean":
- case "null":
- return String(k);
- case "object":
- if (!k) return "null";
- c += " ";
- l = [];
- if ("[object Array]" ===
- h.apply(k)) {
- e = k.length;
- for (b = 0; b < e; b += 1) l[b] = r(b, k) || "null";
- return e = 0 === l.length ? "[]" : c ? "[\n" + c + l.join(",\n" + c) + "\n" + f + "]" : "[" + l.join(",") + "]"
- }
- for (b in k) n.call(k, b) && (e = r(b, k)) && l.push(a(b) + (c ? ": " : ":") + e);
- return e = 0 === l.length ? "{}" : c ? "{" + l.join(",") + "" + f + "}" : "{" + l.join(",") + "}"
- }
- };
- return r("", {
- "": g
- })
- }
- }();
- d.JSONDecode = function() {
- var g, a, r = {
- '"': '"',
- "\\": "\\",
- "/": "/",
- b: "\b",
- f: "\f",
- n: "\n",
- r: "\r",
- t: "\t"
- }, d, c = function(a) {
- throw {
- name: "SyntaxError",
- message: a,
- at: g,
- text: d
- };
- }, b = function(b) {
- b && b !== a && c("Expected '" +
- b + "' instead of '" + a + "'");
- a = d.charAt(g);
- g += 1;
- return a
- }, e = function() {
- var g;
- g = "";
- "-" === a && (g = "-", b("-"));
- for (;
- "0" <= a && "9" >= a;) g += a, b();
- if ("." === a)
- for (g += "."; b() && "0" <= a && "9" >= a;) g += a;
- if ("e" === a || "E" === a) {
- g += a;
- b();
- if ("-" === a || "+" === a) g += a, b();
- for (;
- "0" <= a && "9" >= a;) g += a, b()
- }
- g = +g;
- if (isFinite(g)) return g;
- c("Bad number")
- }, f = function() {
- var g, d, e = "",
- E;
- if ('"' === a)
- for (; b();) {
- if ('"' === a) return b(), e;
- if ("\\" === a)
- if (b(), "u" === a) {
- for (d = E = 0; 4 > d; d += 1) {
- g = parseInt(b(), 16);
- if (!isFinite(g)) break;
- E = 16 * E + g
- }
- e += String.fromCharCode(E)
- } else if ("string" ===
- typeof r[a]) e += r[a];
- else break;
- else e += a
- }
- c("Bad string")
- }, l = function() {
- for (; a && " " >= a;) b()
- }, k = function() {
- switch (a) {
- case "t":
- return b("t"), b("r"), b("u"), b("e"), !0;
- case "f":
- return b("f"), b("a"), b("l"), b("s"), b("e"), !1;
- case "n":
- return b("n"), b("u"), b("l"), b("l"), null
- }
- c("Unexpected '" + a + "'")
- }, h;
- h = function() {
- l();
- switch (a) {
- case "{":
- var g;
- a: {
- var d = {};
- if ("{" === a) {
- b("{");
- l();
- if ("}" === a) {
- b("}");
- g = d;
- break a
- }
- for (; a;) {
- g = f();
- l();
- b(":");
- Object.hasOwnProperty.call(d, g) && c('Duplicate key "' + g + '"');
- d[g] = h();
- l();
- if ("}" ===
- a) {
- b("}");
- g = d;
- break a
- }
- b(",");
- l()
- }
- }
- c("Bad object");
- g = void 0
- }
- return g;
- case "[":
- a: {
- g = [];
- if ("[" === a) {
- b("[");
- l();
- if ("]" === a) {
- b("]");
- break a
- }
- for (; a;) {
- g.push(h());
- l();
- if ("]" === a) {
- b("]");
- break a
- }
- b(",");
- l()
- }
- }
- c("Bad array");
- g = void 0
- }
- return g;
- case '"':
- return f();
- case "-":
- return e();
- default:
- return "0" <= a && "9" >= a ? e() : k()
- }
- };
- return function(b) {
- d = b;
- g = 0;
- a = " ";
- b = h();
- l();
- a && c("Syntax error");
- return b
- }
- }();
- d.base64Encode = function(g) {
- var a, b, c, e, f = 0,
- l = 0,
- h = "",
- h = [];
- if (!g) return g;
- g = d.utf8Encode(g);
- do a = g.charCodeAt(f++),
- b = g.charCodeAt(f++), c = g.charCodeAt(f++), e = a << 16 | b << 8 | c, a = e >> 18 & 63, b = e >> 12 & 63, c = e >> 6 & 63, e &= 63, h[l++] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(a) + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(b) + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c) + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e);
- while (f < g.length);
- h = h.join("");
- switch (g.length % 3) {
- case 1:
- h = h.slice(0, -2) + "==";
- break;
- case 2:
- h =
- h.slice(0, -1) + "="
- }
- return h
- };
- d.utf8Encode = function(g) {
- g = (g + "").replace(/\r\n/g, "\n").replace(/\r/g, "\n");
- var a = "",
- b, d, c = 0,
- e;
- b = d = 0;
- c = g.length;
- for (e = 0; e < c; e++) {
- var f = g.charCodeAt(e),
- l = null;
- 128 > f ? d++ : l = 127 < f && 2048 > f ? String.fromCharCode(f >> 6 | 192, f & 63 | 128) : String.fromCharCode(f >> 12 | 224, f >> 6 & 63 | 128, f & 63 | 128);
- null !== l && (d > b && (a += g.substring(b, d)), a += l, b = d = e + 1)
- }
- d > b && (a += g.substring(b, g.length));
- return a
- };
- d.UUID = function() {
- var a = function() {
- for (var a = 1 * new Date, g = 0; a == 1 * new Date;) g++;
- return a.toString(16) + g.toString(16)
- },
- b = function(a) {
- function g(a, b) {
- var c, r = 0;
- for (c = 0; c < b.length; c++) r |= d[c] << 8 * c;
- return a ^ r
- }
- var b, d = [],
- c = 0;
- for (a = 0; a < m.length; a++) b = m.charCodeAt(a), d.unshift(b & 255), 4 <= d.length && (c = g(c, d), d = []);
- 0 < d.length && (c = g(c, d));
- return c.toString(16)
- };
- return function() {
- var d = (screen.height * screen.width).toString(16);
- return a() + "-" + Math.random().toString(16).replace(".", "") + "-" + b() + "-" + d + "-" + a()
- }
- }();
- d.isBlockedUA = function() {
- return /(google web preview|baiduspider|yandexbot)/i.test(m) ? !0 : !1
- };
- d.HTTPBuildQuery = function(a,
- b) {
- var c, e, f = [];
- "undefined" === typeof b && (b = "&");
- d.each(a, function(a, g) {
- c = encodeURIComponent(a.toString());
- e = encodeURIComponent(g);
- f[f.length] = e + "=" + c
- });
- return f.join(b)
- };
- d.getQueryParam = function(a, b) {
- b = b.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
- var d = RegExp("[\\?&]" + b + "=([^&#]*)").exec(a);
- return null === d || d && "string" !== typeof d[1] && d[1].length ? "" : decodeURIComponent(d[1]).replace(/\+/g, " ")
- };
- d.cookie = {
- get: function(a) {
- a += "=";
- for (var b = l.cookie.split(";"), d = 0; d < b.length; d++) {
- for (var c = b[d];
- " " == c.charAt(0);) c =
- c.substring(1, c.length);
- if (0 == c.indexOf(a)) return decodeURIComponent(c.substring(a.length, c.length))
- }
- return null
- },
- parse: function(a) {
- var b;
- try {
- b = d.JSONDecode(d.cookie.get(a)) || {}
- } catch (c) {}
- return b
- },
- set: function(a, b, d, c) {
- var e = "",
- f = "";
- c && (e = (e = (e = l.location.hostname.match(/[a-z0-9][a-z0-9\-]+\.[a-z\.]{2,6}$/i)) ? e[0] : "") ? "; domain=." + e : "");
- d && (f = new Date, f.setTime(f.getTime() + 864E5 * d), f = "; expires=" + f.toGMTString());
- l.cookie = a + "=" + encodeURIComponent(b) + f + "; path=/" + e
- },
- remove: function(a, b) {
- d.cookie.set(a,
- "", -1, b)
- }
- };
- d.register_event = function() {
- function a(g, c, e) {
- return function(a) {
- if (a = a || b(window.event)) {
- var f = !0,
- l;
- d.isFunction(e) && (l = e(a));
- a = c.call(g, a);
- if (!1 === l || !1 === a) f = !1;
- return f
- }
- }
- }
- function b(a) {
- a && (a.preventDefault = b.preventDefault, a.stopPropagation = b.stopPropagation);
- return a
- }
- b.preventDefault = function() {
- this.returnValue = !1
- };
- b.stopPropagation = function() {
- this.cancelBubble = !0
- };
- return function(b, d, c, e) {
- b ? b.addEventListener && !e ? b.addEventListener(d, c, !1) : (d = "on" + d, b[d] = a(b, c, b[d])) : t.error("No valid element provided to register_event")
- }
- }();
- d.dom_query = function() {
- function a(g, d) {
- return 0 <= (" " + g.className + " ").replace(b, " ").indexOf(" " + d + " ")
- }
- var b = /[\t\r\n]/g;
- return function(b) {
- if (!l.getElementsByTagName) return [];
- b = b.split(" ");
- for (var c, e = Array(l), w = 0; w < b.length; w++)
- if (c = b[w].replace(/^\s+/, "").replace(/\s+$/, ""), -1 < c.indexOf("#")) {
- c = c.split("#");
- var f = c[0],
- e = l.getElementById(c[1]);
- if (!e || f && e.nodeName.toLowerCase() != f) return [];
- e = Array(e)
- } else if (-1 < c.indexOf(".")) {
- c = c.split(".");
- var f = c[0],
- h = c[1];
- f || (f = "*");
- c = [];
- for (var k = 0, m = 0; m <
- e.length; m++) {
- var n;
- n = "*" == f ? e[m].all ? e[m].all : e[m].getElementsByTagName("*") : e[m].getElementsByTagName(f);
- for (var q = 0; q < n.length; q++) c[k++] = n[q]
- }
- e = [];
- for (k = f = 0; k < c.length; k++) c[k].className && (d.isString(c[k].className) && a(c[k], h)) && (e[f++] = c[k])
- } else if (c.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)) {
- var f = RegExp.$1,
- u = RegExp.$2,
- h = RegExp.$3,
- p = RegExp.$4;
- f || (f = "*");
- c = [];
- for (m = k = 0; m < e.length; m++) {
- n = "*" == f ? e[m].all ? e[m].all : e[m].getElementsByTagName("*") : e[m].getElementsByTagName(f);
- for (q =
- 0; q < n.length; q++) c[k++] = n[q]
- }
- e = [];
- f = 0;
- switch (h) {
- case "=":
- h = function(a) {
- return a.getAttribute(u) == p
- };
- break;
- case "~":
- h = function(a) {
- return a.getAttribute(u).match(RegExp("\\b" + p + "\\b"))
- };
- break;
- case "|":
- h = function(a) {
- return a.getAttribute(u).match(RegExp("^" + p + "-?"))
- };
- break;
- case "^":
- h = function(a) {
- return 0 == a.getAttribute(u).indexOf(p)
- };
- break;
- case "$":
- h = function(a) {
- return a.getAttribute(u).lastIndexOf(p) == a.getAttribute(u).length - p.length
- };
- break;
- case "*":
- h = function(a) {
- return -1 < a.getAttribute(u).indexOf(p)
- };
- break;
- default:
- h = function(a) {
- return a.getAttribute(u)
- }
- }
- e = [];
- for (k = f = 0; k < c.length; k++) h(c[k]) && (e[f++] = c[k])
- } else {
- f = c;
- c = [];
- for (m = k = 0; m < e.length; m++) {
- n = e[m].getElementsByTagName(f);
- for (q = 0; q < n.length; q++) c[k++] = n[q]
- }
- e = c
- }
- return e
- }
- }();
- d.info = {
- campaignParams: function() {
- var a = "",
- b = {};
- d.each(["utm_source", "utm_medium", "utm_campaign", "utm_content", "utm_term"], function(c) {
- a = d.getQueryParam(l.URL, c);
- a.length && (b[c] = a)
- });
- return b
- },
- searchEngine: function(a) {
- return 0 === a.search("https?://(.*)google.([^/?]*)") ? "google" :
- 0 === a.search("https?://(.*)bing.com") ? "bing" : 0 === a.search("https?://(.*)yahoo.com") ? "yahoo" : 0 === a.search("https?://(.*)duckduckgo.com") ? "duckduckgo" : null
- },
- searchInfo: function(a) {
- var b = d.info.searchEngine(a),
- c = {};
- null !== b && (c.g_search_engine = b, a = d.getQueryParam(a, "yahoo" != b ? "q" : "p"), a.length && (c.mp_keyword = a));
- return c
- },
- browser: function() {
- var a = x.vendor || "";
- return window.opera ? d.includes(m, "Mini") ? "Opera Mini" : "Opera" : /(BlackBerry|PlayBook|BB10)/i.test(m) ? "BlackBerry" : d.includes(m, "Chrome") ? "Chrome" :
- d.includes(a, "Apple") ? d.includes(m, "Mobile") ? "Mobile Safari" : "Safari" : d.includes(m, "Android") ? "Android Mobile" : d.includes(m, "Konqueror") ? "Konqueror" : d.includes(m, "Firefox") ? "Firefox" : d.includes(m, "MSIE") ? "Internet Explorer" : d.includes(m, "Gecko") ? "Mozilla" : ""
- },
- os: function() {
- return /Windows/i.test(m) ? /Phone/.test(m) ? "Windows Mobile" : "Windows" : /(iPhone|iPad|iPod)/.test(m) ? "iOS" : /Android/.test(m) ? "Android" : /(BlackBerry|PlayBook|BB10)/i.test(m) ? "BlackBerry" : /Mac/i.test(m) ? "Mac OS X" : /Linux/.test(m) ? "Linux" :
- ""
- },
- device: function() {
- return /iPhone/.test(m) ? "iPhone" : /iPad/.test(m) ? "iPad" : /iPod/.test(m) ? "iPod Touch" : /(BlackBerry|PlayBook|BB10)/i.test(m) ? "BlackBerry" : /Windows Phone/i.test(m) ? "Windows Phone" : /Android/.test(m) ? "Android" : ""
- },
- referringDomain: function(a) {
- a = a.split("/");
- return 3 <= a.length ? a[2] : ""
- },
- properties: function() {
- return d.strip_empty_properties({
- os: d.info.os(),
- browser: d.info.browser(),
- device: d.info.device(),
- mp_lib: "web"
- })
- },
- people_properties: function() {
- return d.strip_empty_properties({
- $os: d.info.os(),
- $browser: d.info.browser()
- })
- },
- pageviewInfo: function(a) {
- return d.strip_empty_properties({
- mp_page: a,
- mp_referrer: l.referrer,
- mp_browser: d.info.browser(),
- mp_platform: d.info.os()
- })
- }
- };
- var t = {
- log: function() {
- if (B && !d.isUndefined(q) && q) try {
- q.log.apply(q, arguments)
- } catch (a) {
- d.each(arguments, function(a) {
- q.log(a)
- })
- }
- },
- error: function() {
- if (B && !d.isUndefined(q) && q) {
- var a = ["Mixpanel error:"].concat(d.toArray(arguments));
- try {
- q.error.apply(q, a)
- } catch (b) {
- d.each(a, function(a) {
- q.error(a)
- })
- }
- }
- },
- critical: function() {
- if (!d.isUndefined(q) &&
- q) {
- var a = ["Mixpanel error:"].concat(d.toArray(arguments));
- try {
- q.error.apply(q, a)
- } catch (b) {
- d.each(a, function(a) {
- q.error(a)
- })
- }
- }
- }
- }, u = function() {};
- u.prototype.create_properties = function() {};
- u.prototype.event_handler = function() {};
- u.prototype.after_track_handler = function() {};
- u.prototype.init = function(a) {
- this.mp = a;
- return this
- };
- u.prototype.track = function(a, b, c, e) {
- var f = this,
- l = d.dom_query(a);
- if (0 == l.length) t.error("The DOM query (" + a + ") returned 0 elements");
- else return d.each(l, function(a) {
- d.register_event(a,
- this.override_event, function(a) {
- var g = {}, d = f.create_properties(c, this),
- l = f.mp.get_config("track_links_timeout");
- f.event_handler(a, this, g);
- window.setTimeout(f.track_callback(e, d, g, !0), l);
- f.mp.track(b, d, f.track_callback(e, d, g))
- })
- }, this), !0
- };
- u.prototype.track_callback = function(a, b, c, d) {
- d = d || !1;
- var e = this;
- return function() {
- c.callback_fired || (c.callback_fired = !0, a && !1 === a(d, b) || e.after_track_handler(b, c, d))
- }
- };
- u.prototype.create_properties = function(a, b) {
- return "function" === typeof a ? a(b) : d.extend({}, a)
- };
- var D = function() {
- this.override_event = "click"
- };
- d.inherit(D, u);
- D.prototype.create_properties = function(a, b) {
- var c = D.superclass.create_properties.apply(this, arguments);
- b.href && (c.url = b.href);
- return c
- };
- D.prototype.event_handler = function(a, b, c) {
- c.new_tab = 2 === a.which || a.metaKey || "_blank" === b.target;
- c.href = b.href;
- c.new_tab || a.preventDefault()
- };
- D.prototype.after_track_handler = function(a, b, c) {
- b.new_tab || setTimeout(function() {
- window.location = b.href
- }, 0)
- };
- var F = function() {
- this.override_event = "submit"
- };
- d.inherit(F,
- u);
- F.prototype.event_handler = function(a, b, c) {
- c.element = b;
- a.preventDefault()
- };
- F.prototype.after_track_handler = function(a, b, c) {
- setTimeout(function() {
- b.element.submit()
- }, 0)
- };
- var p = function(a) {
- this.props = {};
- this.campaign_params_saved = !1;
- this.name = a.cookie_name ? "mp_" + a.cookie_name : "mp_" + a.token + "_mixpanel";
- this.load();
- this.update_config(a);
- this.upgrade(a);
- this.save()
- };
- p.prototype.properties = function() {
- var a = {};
- d.each(this.props, function(b, c) {
- d.include(H, c) || (a[c] = b)
- });
- return a
- };
- p.prototype.load = function() {
- if (!this.disabled) {
- var a =
- d.cookie.parse(this.name);
- a && (this.props = d.extend({}, a))
- }
- };
- p.prototype.upgrade = function(a) {
- var b = a.upgrade,
- c;
- b && (c = "mp_super_properties", "string" === typeof b && (c = b), b = d.cookie.parse(c), d.cookie.remove(c), d.cookie.remove(c, !0), b && (this.props = d.extend(this.props, b.all, b.events)));
- if (!a.cookie_name && "mixpanel" !== a.name && (c = "mp_" + a.token + "_" + a.name, b = d.cookie.parse(c))) d.cookie.remove(c), d.cookie.remove(c, !0), this.register_once(b)
- };
- p.prototype.save = function() {
- this.disabled || d.cookie.set(this.name, d.JSONEncode(this.props),
- this.expire_days, this.cross_subdomain)
- };
- p.prototype.remove = function() {
- d.cookie.remove(this.name, !1);
- d.cookie.remove(this.name, !0)
- };
- p.prototype.clear = function() {
- this.remove();
- this.props = {}
- };
- p.prototype.register_once = function(a, b, c) {
- return d.isObject(a) ? ("undefined" === typeof b && (b = "None"), this.expire_days = "undefined" === typeof c ? this.default_expiry : c, d.each(a, function(a, g) {
- if (!this.props[g] || this.props[g] === b) this.props[g] = a
- }, this), this.save(), !0) : !1
- };
- p.prototype.register = function(a, b) {
- return d.isObject(a) ?
- (this.expire_days = "undefined" === typeof b ? this.default_expiry : b, d.extend(this.props, a), this.save(), !0) : !1
- };
- p.prototype.unregister = function(a) {
- a in this.props && (delete this.props[a], this.save())
- };
- p.prototype.update_campaign_params = function() {
- this.campaign_params_saved || (this.register_once(d.info.campaignParams()), this.campaign_params_saved = !0)
- };
- p.prototype.update_search_keyword = function(a) {
- this.register(d.info.searchInfo(a))
- };
- p.prototype.update_referrer_info = function(a) {
- this.register_once({
- $initial_referrer: a ||
- "$direct",
- $initial_referring_domain: d.info.referringDomain(a) || "$direct"
- }, "")
- };
- p.prototype.get_referrer_info = function() {
- return d.strip_empty_properties({
- $initial_referrer: this.props.$initial_referrer,
- $initial_referring_domain: this.props.$initial_referring_domain
- })
- };
- p.prototype.safe_merge = function(a) {
- d.each(this.props, function(b, c) {
- c in a || (a[c] = b)
- });
- return a
- };
- p.prototype.update_config = function(a) {
- this.default_expiry = this.expire_days = a.cookie_expiration;
- this.set_disabled(a.disable_cookie);
- this.set_cross_subdomain(a.cross_subdomain_cookie)
- };
- p.prototype.set_disabled = function(a) {
- (this.disabled = a) && this.remove()
- };
- p.prototype.set_cross_subdomain = function(a) {
- a !== this.cross_subdomain && (this.cross_subdomain = a, this.remove(), this.save())
- };
- p.prototype.get_cross_subdomain = function() {
- return this.cross_subdomain
- };
- p.prototype._add_to_people_queue = function(a, b) {
- var c = this._get_queue_key(a),
- e = b[a],
- f = this._get_or_create_queue("$set"),
- l = this._get_or_create_queue("$add"),
- h = this._get_or_create_queue("$append", []);
- "__mps" === c ? (d.extend(f, e), this._pop_from_people_queue("$add",
- e)) : "__mpa" === c ? d.each(e, function(a, b) {
- b in f ? f[b] += a : (b in l || (l[b] = 0), l[b] += a)
- }, this) : "__mpap" === c && h.push(e);
- t.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):");
- t.log(b);
- this.save()
- };
- p.prototype._pop_from_people_queue = function(a, b) {
- var c = this._get_queue(a);
- d.isUndefined(c) || (d.each(b, function(a, b) {
- delete c[b]
- }, this), this.save())
- };
- p.prototype._get_queue_key = function(a) {
- if ("$set" === a) return "__mps";
- if ("$add" === a) return "__mpa";
- if ("$append" === a) return "__mpap";
- t.error("Invalid queue:", a)
- };
- p.prototype._get_queue =
- function(a) {
- return this.props[this._get_queue_key(a)]
- };
- p.prototype._get_or_create_queue = function(a, b) {
- var c = this._get_queue_key(a);
- b = d.isUndefined(b) ? {} : b;
- return this.props[c] || (this.props[c] = b)
- };
- var G = function(b, c, e) {
- var f, l = "triggermail.lytics" === e ? a : a[e];
- if (l && !d.isArray(l)) t.error("You have already initialized " + e);
- else return f = new k, f._init(b, c, e), f.people = new s, f.people._init(f), B = B || f.get_config("debug"), d.isUndefined(l) || (f._execute_array.call(f.people, l.people), f._execute_array(l)), f
- }, k =
- function() {};
- k.prototype.init = function(b, c, d) {
- if ("undefined" === typeof d) t.error("You must name your new library: init(token, config, name)");
- else if ("triggermail.lytics" === d) t.error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");
- else return b = G(b, c, d), a[d] = b, b._loaded(), b
- };
- k.prototype._init = function(a, b, c) {
- this.__loaded = !0;
- this.config = {};
- this.set_config(d.extend({}, K, b, {
- name: c,
- token: a,
- callback_fn: ("triggermail.lytics" === c ? c : "triggermail.lytics." + c) +
- "._jsc"
- }));
- this._jsc = function() {};
- this.__dom_loaded_queue = [];
- this.__request_queue = [];
- this.__disabled_events = [];
- this._flags = {
- disable_all_events: !1,
- identify_called: !1
- };
- this.cookie = new p(this.config);
- this.register_once({
- distinct_id: d.UUID()
- }, "")
- };
- k.prototype._loaded = function() {
- this.get_config("loaded")(this);
- this.get_config("track_pageview") && this.track_pageview()
- };
- k.prototype._dom_loaded = function() {
- d.each(this.__dom_loaded_queue, function(a) {
- this._track_dom.apply(this, a)
- }, this);
- d.each(this.__request_queue,
- function(a) {
- this._send_request.apply(this, a)
- }, this);
- delete this.__dom_loaded_queue;
- delete this.__request_queue
- };
- k.prototype._track_dom = function(a, b) {
- if (this.get_config("img")) return t.error("You can't use DOM tracking functions with img = true."), !1;
- if (!I) return this.__dom_loaded_queue.push([a, b]), !1;
- var c = (new a).init(this);
- return c.track.apply(c, b)
- };
- k.prototype._prepare_callback = function(a, b) {
- if (d.isUndefined(a)) return null;
- if (y) return function(c) {
- a(c, b)
- };
- var c = this._jsc,
- e = "" + Math.floor(1E8 * Math.random()),
- f = this.get_config("callback_fn") + '["' + e + '"]';
- c[e] = function(d) {
- delete c[e];
- a(d, b)
- };
- return f
- };
- k.prototype._send_request = function(a, b, c) {
- if (C) this.__request_queue.push(arguments);
- else {
- var e = this.get_config("verbose");
- this.get_config("test") && (b.test = 1);
- e && (b.verbose = 1);
- this.get_config("img") && (b.img = 1);
- c && !y && (b.callback = c);
- b.ip = this.get_config("ip") ? 1 : 0;
- b._ = (new Date).getTime().toString();
- if ("img" in b) {
- var f = l.createElement("img");
- f.src = a;
- l.body.appendChild(f)
- } else if (y) {
- var h = new XMLHttpRequest;
- h.open("POST",
- a, !0);
- h.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- h.withCredentials = !0;
- h.onreadystatechange = function(a) {
- 4 === h.readyState && (200 === h.status ? c && (e ? c(d.JSONDecode(h.responseText)) : c(Number(h.responseText))) : (a = "Bad HTTP status: " + h.status + " " + h.statusText, t.error(a), c && (e ? c({
- status: 0,
- error: a
- }) : c(0))))
- };
- h.send(d.HTTPBuildQuery(b))
- } else {
- a += "?" + d.HTTPBuildQuery(b);
- f = l.createElement("script");
- f.type = "text/javascript";
- f.async = !0;
- f.defer = !0;
- f.src = a;
- var k = l.getElementsByTagName("script")[0];
- k.parentNode.insertBefore(f, k)
- }
- }
- };
- k.prototype._execute_array = function(a) {
- var b, c = [],
- e = [],
- f = [];
- d.each(a, function(a) {
- a && (b = a[0], "function" === typeof a ? a.call(this) : d.isArray(a) && "alias" === b ? c.push(a) : d.isArray(a) && -1 != b.indexOf("track") && "function" === typeof this[b] ? f.push(a) : e.push(a))
- }, this);
- a = function(a, b) {
- d.each(a, function(a) {
- this[a[0]].apply(this, a.slice(1))
- }, b)
- };
- a(c, this);
- a(e, this);
- a(f, this)
- };
- k.prototype.push = function(a) {
- this._execute_array([a])
- };
- k.prototype.disable = function(a) {
- "undefined" === typeof a ?
- this._flags.disable_all_events = !0 : this.__disabled_events = this.__disabled_events.concat(a)
- };
- k.prototype.track = function(a, b, c) {
- if ("undefined" === typeof a) t.error("No event name provided to mixpanel.track");
- else {
- b = b || {};
- b.token = b.token || this.get_config("token");
- this.cookie.update_search_keyword(l.referrer);
- this.get_config("store_google") && this.cookie.update_campaign_params();
- this.get_config("save_referrer") && this.cookie.update_referrer_info(l.referrer);
- b = d.extend({}, d.info.properties(), this.cookie.properties(),
- b);
- delete b.ch;
- b = {
- event: a,
- properties: b
- };
- B && (b.validate = 1);
- b = d.truncate(b, 1023);
- var e = d.JSONEncode(b),
- e = d.base64Encode(e);
- t.log("MIXPANEL REQUEST:");
- t.log(b);
- payload = {
- data: e
- }; - 1 != this.get_distinct_id().indexOf("live_demo") ? (payload.live_demo = !0, this._send_request(this.get_config("api_host") + "/templates/demo_track/" + a, payload, this._prepare_callback(c, b))) : this._send_request(this.get_config("api_host") + "/track/" + a, payload, this._prepare_callback(c, b));
- return b
- }
- };
- k.prototype.track_pageview = function(a) {
- "undefined" ===
- typeof a && (a = l.location.href);
- this.track("mp_page_view", d.info.pageviewInfo(a))
- };
- k.prototype.track_links = function() {
- return this._track_dom.call(this, D, arguments)
- };
- k.prototype.track_forms = function() {
- return this._track_dom.call(this, F, arguments)
- };
- k.prototype.register = function(a, b) {
- this.cookie.register(a, b)
- };
- k.prototype.register_once = function(a, b, c) {
- this.cookie.register_once(a, b, c)
- };
- k.prototype.unregister = function(a) {
- this.cookie.unregister(a)
- };
- k.prototype._register_single = function(a, b) {
- var c = {};
- c[a] =
- b;
- this.register(c)
- };
- k.prototype.identify = function(a, b, c, d) {
- a != this.get_distinct_id() && a != this.get_property("__alias") && (this.unregister("__alias"), this._register_single("distinct_id", a));
- this._flags.identify_called = !0;
- this.people._flush(b, c, d)
- };
- k.prototype.get_distinct_id = function() {
- return this.get_property("distinct_id")
- };
- k.prototype.alias = function(a, b) {
- if (a === this.get_property("$people_distinct_id")) return t.critical("Attempting to create alias for existing People user - aborting."), -2;
- var c = this;
- d.isUndefined(b) && (b = this.get_distinct_id());
- if (a !== b) return this._register_single("__alias", a), this.track("$create_alias", {
- alias: a,
- distinct_id: b
- }, function(b) {
- c.identify(a)
- });
- t.error("alias matches current distinct_id - skipping api call.");
- this.identify(a);
- return -1
- };
- k.prototype.name_tag = function(a) {
- this._register_single("mp_name_tag", a)
- };
- k.prototype.set_config = function(a) {
- d.isObject(a) && (d.extend(this.config, a), this.cookie && this.cookie.update_config(this.config), B = B || this.get_config("debug"))
- };
- k.prototype.get_config =
- function(a) {
- return this.config[a]
- };
- k.prototype.get_property = function(a) {
- return this.cookie.props[a]
- };
- k.prototype.toString = function() {
- var a = this.get_config("name");
- "triggermail.lytics" !== a && (a = "triggermail.lytics." + a);
- return a
- };
- var s = function() {};
- s.prototype._init = function(a) {
- this._mixpanel = a
- };
- s.prototype.set = function(a, b, c) {
- var e = {}, f = {};
- d.isObject(a) ? (d.each(a, function(a, b) {
- "$distinct_id" == b || "$token" == b || (f[b] = a)
- }), c = b) : f[a] = b;
- this._get_config("save_referrer") && this._mixpanel.cookie.update_referrer_info(l.referrer);
- f = d.extend({}, d.info.people_properties(), this._mixpanel.cookie.get_referrer_info(), f);
- e.$set = f;
- return this._send_request(e, c)
- };
- s.prototype.increment = function(a, b, c) {
- var e = {}, f = {};
- d.isObject(a) ? (d.each(a, function(a, b) {
- "$distinct_id" == b || "$token" == b || (isNaN(parseFloat(a)) ? t.error("Invalid increment value passed to mixpanel.people.increment - must be a number") : f[b] = a)
- }), c = b) : (d.isUndefined(b) && (b = 1), f[a] = b);
- e.$add = f;
- return this._send_request(e, c)
- };
- s.prototype.append = function(a, b, c) {
- var e = {}, f = {};
- d.isObject(a) ?
- (d.each(a, function(a, b) {
- "$distinct_id" == b || "$token" == b || (f[b] = a)
- }), c = b) : f[a] = b;
- e.$append = f;
- return this._send_request(e, c)
- };
- s.prototype.track_charge = function(a, b, c) {
- if (!d.isNumber(a) && (a = parseFloat(a), isNaN(a))) {
- t.error("Invalid value passed to mixpanel.people.track_charge - must be a number");
- return
- }
- return this.append("$transactions", d.extend({
- $amount: a
- }, b), c)
- };
- s.prototype.clear_charges = function(a) {
- return this.set("$transactions", [], a)
- };
- s.prototype.delete_user = function() {
- if (this._identify_called()) {
- var a = {
- $delete: this._mixpanel.get_distinct_id()
- };
- return this._send_request(a)
- }
- t.error("mixpanel.people.delete_user() requires you to call identify() first")
- };
- s.prototype.toString = function() {
- return this._mixpanel.toString() + ".people"
- };
- s.prototype._send_request = function(a, b) {
- a.$token = this._get_config("token");
- a.$distinct_id = this._mixpanel.get_distinct_id();
- var c = d.encodeDates(a),
- e = d.truncate(c, 255),
- c = d.JSONEncode(c),
- c = d.base64Encode(c);
- if (!this._identify_called()) return this._enqueue(a), d.isUndefined(b) ||
- (this._get_config("verbose") ? b({
- status: -1,
- error: null
- }) : b(-1)), e;
- t.log("MIXPANEL PEOPLE REQUEST:");
- t.log(e);
- this._mixpanel._send_request(this._get_config("api_host") + "/engage/", {
- data: c
- }, this._mixpanel._prepare_callback(b, e));
- return e
- };
- s.prototype._get_config = function(a) {
- return this._mixpanel.get_config(a)
- };
- s.prototype._identify_called = function() {
- return !0 === this._mixpanel._flags.identify_called
- };
- s.prototype._enqueue = function(a) {
- "$set" in a ? this._mixpanel.cookie._add_to_people_queue("$set", a) : "$add" in
- a ? this._mixpanel.cookie._add_to_people_queue("$add", a) : "$append" in a ? this._mixpanel.cookie._add_to_people_queue("$append", a) : t.error("Invalid call to _enqueue():", a)
- };
- s.prototype._flush = function(a, b, c) {
- var e = this,
- f = d.extend({}, this._mixpanel.cookie._get_queue("$set")),
- l = d.extend({}, this._mixpanel.cookie._get_queue("$add")),
- h = this._mixpanel.cookie._get_queue("$append");
- !d.isUndefined(f) && (d.isObject(f) && !d.isEmptyObject(f)) && (e._mixpanel.cookie._pop_from_people_queue("$set", f), this.set(f, function(b,
- c) {
- 0 == b && e._mixpanel.cookie._add_to_people_queue("$set", f);
- d.isUndefined(a) || a(b, c)
- }));
- !d.isUndefined(l) && (d.isObject(l) && !d.isEmptyObject(l)) && (e._mixpanel.cookie._pop_from_people_queue("$add", l), this.increment(l, function(a, c) {
- 0 == a && e._mixpanel.cookie._add_to_people_queue("$add", l);
- d.isUndefined(b) || b(a, c)
- }));
- if (!d.isUndefined(h) && d.isArray(h) && h.length)
- for (var k = h.length - 1; 0 <= k; k--) {
- var m = h.pop();
- e.append(m, function(a, b) {
- 0 == a && e._mixpanel.cookie._add_to_people_queue("$append", m);
- d.isUndefined(c) ||
- c(a, b)
- })
- }
- };
- d.toArray = d.toArray;
- d.isObject = d.isObject;
- d.JSONEncode = d.JSONEncode;
- d.JSONDecode = d.JSONDecode;
- d.isEmptyObject = d.isEmptyObject;
- k.prototype.init = k.prototype.init;
- k.prototype.disable = k.prototype.disable;
- k.prototype.track = k.prototype.track;
- k.prototype.track_links = k.prototype.track_links;
- k.prototype.track_forms = k.prototype.track_forms;
- k.prototype.track_pageview = k.prototype.track_pageview;
- k.prototype.register = k.prototype.register;
- k.prototype.register_once = k.prototype.register_once;
- k.prototype.unregister =
- k.prototype.unregister;
- k.prototype.identify = k.prototype.identify;
- k.prototype.alias = k.prototype.alias;
- k.prototype.name_tag = k.prototype.name_tag;
- k.prototype.set_config = k.prototype.set_config;
- k.prototype.get_config = k.prototype.get_config;
- k.prototype.get_property = k.prototype.get_property;
- k.prototype.get_distinct_id = k.prototype.get_distinct_id;
- k.prototype.toString = k.prototype.toString;
- p.prototype.properties = p.prototype.properties;
- p.prototype.update_search_keyword = p.prototype.update_search_keyword;
- p.prototype.update_referrer_info =
- p.prototype.update_referrer_info;
- p.prototype.get_cross_subdomain = p.prototype.get_cross_subdomain;
- p.prototype.clear = p.prototype.clear;
- s.prototype.set = s.prototype.set;
- s.prototype.increment = s.prototype.increment;
- s.prototype.append = s.prototype.append;
- s.prototype.track_charge = s.prototype.track_charge;
- s.prototype.clear_charges = s.prototype.clear_charges;
- s.prototype.delete_user = s.prototype.delete_user;
- s.prototype.toString = s.prototype.toString;
- if (d.isUndefined(a)) t.critical("'mixpanel' object not initialized. Ensure you are using the latest version of the Mixpanel JS Library along with the snippet we provide.");
- else if (a.__loaded || a.config && a.cookie) t.error("Mixpanel library has already been downloaded at least once.");
- else if (1.1 > e) t.critical("Version mismatch; please ensure you're using the latest version of the Mixpanel code snippet.");
- else {
- var A = {};
- d.each(a._i, function(a) {
- var b;
- a && d.isArray(a) && (b = a[a.length - 1], a = G.apply(this, a), A[b] = a)
- });
- var L = function() {
- d.each(A, function(b, c) {
- "triggermail.lytics" !== c && (a[c] = b)
- });
- a._ = d
- };
- a.init = function(b, c, d) {
- d ? a[d] || (a[d] = A[d] = G(b, c, d), a[d]._loaded()) : (d = a, A["triggermail.lytics"] ?
- d = A["triggermail.lytics"] : b && (d = G(b, c, "triggermail.lytics")), window["triggermail.lytics"] = a = d, L())
- };
- a.init();
- d.each(A, function(a) {
- a._loaded()
- });
- if (l.addEventListener) "complete" == l.readyState ? b() : l.addEventListener("DOMContentLoaded", b, !1);
- else if (l.attachEvent) {
- l.attachEvent("onreadystatechange", b);
- e = !1;
- try {
- e = null == window.frameElement
- } catch (M) {}
- if (l.documentElement.doScroll && e) {
- var J = function() {
- try {
- l.documentElement.doScroll("left")
- } catch (a) {
- setTimeout(J, 1);
- return
- }
- b()
- };
- J()
- }
- }
- d.register_event(window,
- "load", b, !0)
- }
- })(window.triggermail.lytics);
- var prettyPrint = function() {
- var a = {
- el: function(b, e) {
- var f = document.createElement(b),
- h;
- if ((e = a.merge({}, e)) && e.style) a.applyCSS(f, e.style), delete e.style;
- for (h in e) e.hasOwnProperty(h) && (f[h] = e[h]);
- return f
- },
- applyCSS: function(a, b) {
- for (var f in b)
- if (b.hasOwnProperty(f)) try {
- a.style[f] = b[f]
- } catch (h) {}
- },
- txt: function(a) {
- return document.createTextNode(a)
- },
- row: function(b, e, f) {
- f = f || "td";
- var h = a.count(b, null) + 1,
- n = a.el("tr"),
- q, x = {
- style: a.getStyles(f, e),
- colSpan: h,
- onmouseover: function() {
- a.forEach(this.parentNode.childNodes, function(b) {
- "td" ===
- b.nodeName.toLowerCase() && a.applyCSS(b, a.getStyles("td_hover", e))
- })
- },
- onmouseout: function() {
- a.forEach(this.parentNode.childNodes, function(b) {
- "td" === b.nodeName.toLowerCase() && a.applyCSS(b, a.getStyles("td", e))
- })
- }
- };
- a.forEach(b, function(b) {
- null !== b && (q = a.el(f, x), b.nodeType ? q.appendChild(b) : q.innerHTML = a.shorten(b.toString()), n.appendChild(q))
- });
- return n
- },
- hRow: function(b, e) {
- return a.row(b, e, "th")
- },
- table: function(b, e) {
- b = b || [];
- var f = {
- style: a.getStyles("thead", e)
- }, h = {
- style: a.getStyles("tbody", e)
- }, n = {
- style: a.getStyles("table",
- e)
- }, n = a.el("table", n),
- f = a.el("thead", f),
- h = a.el("tbody", h);
- b.length && (n.appendChild(f), f.appendChild(a.hRow(b, e)));
- n.appendChild(h);
- return {
- node: n,
- tbody: h,
- thead: f,
- appendChild: function(a) {
- this.tbody.appendChild(a)
- },
- addRow: function(b, c, f) {
- this.appendChild(a.row.call(a, b, c || e, f));
- return this
- }
- }
- },
- shorten: function(a) {
- a = a.replace(/^\s\s*|\s\s*$|\n/g, "");
- return 40 < a.length ? a.substring(0, 39) + "..." : a
- },
- htmlentities: function(a) {
- return a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")
- },
- merge: function(b,
- e) {
- "object" !== typeof b && (b = {});
- for (var f in e)
- if (e.hasOwnProperty(f)) {
- var h = e[f];
- b[f] = "object" === typeof h ? a.merge(b[f], h) : h
- }
- f = 2;
- for (h = arguments.length; f < h; f++) a.merge(b, arguments[f]);
- return b
- },
- count: function(a, b) {
- for (var f = 0, h = 0, n = a.length; h < n; h++) a[h] === b && f++;
- return f
- },
- thead: function(a) {
- return a.getElementsByTagName("thead")[0]
- },
- forEach: function(a, b, f) {
- f || (f = b);
- b = a.length;
- for (var h = -1; ++h < b && !1 !== f(a[h], h, a););
- return !0
- },
- type: function(a) {
- try {
- if (null === a) return "null";
- if (void 0 === a) return "undefined";
- var b = Object.prototype.toString.call(a).match(/\s(.+?)\]/)[1].toLowerCase();
- return a.nodeType ? 1 === a.nodeType ? "domelement" : "domnode" : /^(string|number|array|regexp|function|date|boolean)$/.test(b) ? b : "object" === typeof a ? a.jquery && "string" === typeof a.jquery ? "jquery" : "object" : a === window || a === document ? "object" : "default"
- } catch (f) {
- return "default"
- }
- },
- within: function(a) {
- return {
- is: function(b) {
- for (var f in a)
- if (a[f] === b) return f;
- return ""
- }
- }
- },
- common: {
- circRef: function(c, e, f) {
- return a.expander("[POINTS BACK TO <strong>" +
- e + "</strong>]", "Click to show this item anyway", function() {
- this.parentNode.appendChild(b(c, {
- maxDepth: 1
- }))
- })
- },
- depthReached: function(c, e) {
- return a.expander("[DEPTH REACHED]", "Click to show this item anyway", function() {
- try {
- this.parentNode.appendChild(b(c, {
- maxDepth: 1
- }))
- } catch (e) {
- this.parentNode.appendChild(a.table(["ERROR OCCURED DURING OBJECT RETRIEVAL"], "error").addRow([e.message]).node)
- }
- })
- }
- },
- getStyles: function(c, e) {
- e = b.settings.styles[e] || {};
- return a.merge({}, b.settings.styles["default"][c], e[c])
- },
- expander: function(b, e, f) {
- return a.el("a", {
- innerHTML: a.shorten(b) + ' <b style="visibility:hidden;">[+]</b>',
- title: e,
- onmouseover: function() {
- this.getElementsByTagName("b")[0].style.visibility = "visible"
- },
- onmouseout: function() {
- this.getElementsByTagName("b")[0].style.visibility = "hidden"
- },
- onclick: function() {
- this.style.display = "none";
- f.call(this);
- return !1
- },
- style: {
- cursor: "pointer"
- }
- })
- },
- stringify: function(b) {
- var e = a.type(b),
- f, h = !0;
- if ("array" === e) return f = "[", a.forEach(b, function(b, c) {
- f += (0 === c ? "" : ", ") + a.stringify(b)
- }),
- f + "]";
- if ("object" === typeof b) {
- f = "{";
- for (var n in b) b.hasOwnProperty(n) && (f += (h ? "" : ", ") + n + ":" + a.stringify(b[n]), h = !1);
- return f + "}"
- }
- return "regexp" === e ? "/" + b.source + "/" : "string" === e ? '"' + b.replace(/"/g, '\\"') + '"' : b.toString()
- },
- headerGradient: function() {
- var a = document.createElement("canvas");
- if (!a.getContext) return "";
- var b = a.getContext("2d");
- a.height = 30;
- a.width = 1;
- var f = b.createLinearGradient(0, 0, 0, 30);
- f.addColorStop(0, "rgba(0,0,0,0)");
- f.addColorStop(1, "rgba(0,0,0,0.25)");
- b.fillStyle = f;
- b.fillRect(0, 0,
- 1, 30);
- return "url(" + (a.toDataURL && a.toDataURL() || "") + ")"
- }()
- }, b = function(c, e) {
- e = e || {};
- var f = a.merge({}, b.config, e),
- h = a.el("div"),
- n = {}, q = !1;
- b.settings = f;
- var x = {
- string: function(b) {
- return a.txt('"' + a.shorten(b.replace(/"/g, '\\"')) + '"')
- },
- number: function(b) {
- return a.txt(b)
- },
- regexp: function(b) {
- var c = a.table(["RegExp", null], "regexp"),
- e = a.table(),
- h = a.expander("/" + b.source + "/", "Click to show more", function() {
- this.parentNode.appendChild(c.node)
- });
- e.addRow(["g", b.global]).addRow(["i", b.ignoreCase]).addRow(["m",
- b.multiline
- ]);
- c.addRow(["source", "/" + b.source + "/"]).addRow(["flags", e.node]).addRow(["lastIndex", b.lastIndex]);
- return f.expanded ? c.node : h
- },
- domelement: function(b, c) {
- var e = a.table(["DOMElement", null], "domelement"),
- h = b.nodeName || "";
- e.addRow(["tag", "<" + h.toLowerCase() + ">"]);
- a.forEach(["id", "className", "innerHTML", "src", "href"], function(c) {
- b[c] && e.addRow([c, a.htmlentities(b[c])])
- });
- return f.expanded ? e.node : a.expander("DOMElement (" + h.toLowerCase() + ")", "Click to show more", function() {
- this.parentNode.appendChild(e.node)
- })
- },
- domnode: function(b) {
- var c = a.table(["DOMNode", null], "domelement"),
- e = a.htmlentities((b.data || "UNDEFINED").replace(/\n/g, "\\n"));
- c.addRow(["nodeType", b.nodeType + " (" + b.nodeName + ")"]).addRow(["data", e]);
- return f.expanded ? c.node : a.expander("DOMNode", "Click to show more", function() {
- this.parentNode.appendChild(c.node)
- })
- },
- jquery: function(a, b, c) {
- return x.array(a, b, c, !0)
- },
- object: function(b, c, e) {
- var h = a.within(n).is(b);
- if (h) return a.common.circRef(b, h, f);
- n[e || "TOP"] = b;
- if (c === f.maxDepth) return a.common.depthReached(b,
- f);
- var z = a.table(["Object", null], "object");
- e = !0;
- for (var v in b)
- if (!b.hasOwnProperty || b.hasOwnProperty(v)) {
- var h = b[v],
- y = a.type(h);
- e = !1;
- try {
- z.addRow([v, x[y](h, c + 1, v)], y)
- } catch (C) {
- window.console && window.console.log && console.log(C.message)
- }
- }
- e ? z.addRow(["<small>[empty]</small>"]) : z.thead.appendChild(a.hRow(["key", "value"], "colHeader"));
- b = f.expanded || q ? z.node : a.expander(a.stringify(b), "Click to show more", function() {
- this.parentNode.appendChild(z.node)
- });
- q = !0;
- return b
- },
- array: function(b, c, e, h) {
- var q = a.within(n).is(b);
- if (q) return a.common.circRef(b, q);
- n[e || "TOP"] = b;
- if (c === f.maxDepth) return a.common.depthReached(b);
- e = h ? "jQuery" : "Array";
- var v = a.table([e + "(" + b.length + ")", null], h ? "jquery" : e.toLowerCase()),
- y = !0,
- C = 0;
- h && v.addRow(["selector", b.selector]);
- a.forEach(b, function(d, e) {
- if (0 <= f.maxArray && ++C > f.maxArray) return v.addRow([e + ".." + (b.length - 1), x[a.type(d)]("...", c + 1, e)]), !1;
- y = !1;
- v.addRow([e, x[a.type(d)](d, c + 1, e)])
- });
- h || (y ? v.addRow(["<small>[empty]</small>"]) : v.thead.appendChild(a.hRow(["index", "value"], "colHeader")));
- return f.expanded ? v.node : a.expander(a.stringify(b), "Click to show more", function() {
- this.parentNode.appendChild(v.node)
- })
- },
- "function": function(b, c, e) {
- if (c = a.within(n).is(b)) return a.common.circRef(b, c);
- n[e || "TOP"] = b;
- var h = a.table(["Function", null], "function");
- a.table(["Arguments"]);
- e = b.toString().match(/\((.+?)\)/);
- b = b.toString().match(/\(.*?\)\s+?\{?([\S\s]+)/)[1].replace(/\}?$/, "");
- h.addRow(["arguments", e ? e[1].replace(/[^\w_,\s]/g, "") : "<small>[none/native]</small>"]).addRow(["body", b]);
- return f.expanded ?
- h.node : a.expander("function(){...}", "Click to see more about this function.", function() {
- this.parentNode.appendChild(h.node)
- })
- },
- date: function(b) {
- var c = a.table(["Date", null], "date"),
- e = b.toString().split(/\s/);
- c.addRow(["Time", e[4]]).addRow(["Date", e.slice(0, 4).join("-")]);
- return f.expanded ? c.node : a.expander("Date (timestamp): " + +b, "Click to see a little more info about this date", function() {
- this.parentNode.appendChild(c.node)
- })
- },
- "boolean": function(b) {
- return a.txt(b.toString().toUpperCase())
- },
- undefined: function() {
- return a.txt("UNDEFINED")
- },
- "null": function() {
- return a.txt("NULL")
- },
- "default": function() {
- return a.txt("prettyPrint: TypeNotFound Error")
- }
- };
- h.appendChild(x[f.forceObject ? "object" : a.type(c)](c, 0));
- return h
- };
- b.config = {
- expanded: !0,
- forceObject: !1,
- maxDepth: 3,
- maxArray: -1,
- styles: {
- array: {
- th: {
- backgroundColor: "#6DBD2A",
- color: "white"
- }
- },
- "function": {
- th: {
- backgroundColor: "#D82525"
- }
- },
- regexp: {
- th: {
- backgroundColor: "#E2F3FB",
- color: "#000"
- }
- },
- object: {
- th: {
- backgroundColor: "#1F96CF"
- }
- },
- jquery: {
- th: {
- backgroundColor: "#FBF315"
- }
- },
- error: {
- th: {
- backgroundColor: "red",
- color: "yellow"
- }
- },
- domelement: {
- th: {
- backgroundColor: "#F3801E"
- }
- },
- date: {
- th: {
- backgroundColor: "#A725D8"
- }
- },
- colHeader: {
- th: {
- backgroundColor: "#EEE",
- color: "#000",
- textTransform: "uppercase"
- }
- },
- "default": {
- table: {
- borderCollapse: "collapse",
- width: "100%"
- },
- td: {
- padding: "5px",
- fontSize: "12px",
- backgroundColor: "#FFF",
- color: "#222",
- border: "1px solid #000",
- verticalAlign: "top",
- fontFamily: '"Consolas","Lucida Console",Courier,mono',
- whiteSpace: "nowrap"
- },
- td_hover: {},
- th: {
- padding: "5px",
- fontSize: "12px",
- backgroundColor: "#222",
- color: "#EEE",
- textAlign: "left",
- border: "1px solid #000",
- verticalAlign: "top",
- fontFamily: '"Consolas","Lucida Console",Courier,mono',
- backgroundImage: a.headerGradient,
- backgroundRepeat: "repeat-x"
- }
- }
- }
- };
- return b
- }();
- jQuery.extend(triggermail, function() {
- var a = function(a, c) {
- var e = a.obem;
- "undefined" != typeof e && "" != e && "undefined" == typeof triggermail.lytics.get_property("obem") && (triggermail.lytics.register({
- OBFUSCATED_EMAIL_PROPERTY: e
- }, 365), triggermail.track("identify", {
- customer: a
- }));
- e = a.email;
- if (!(void 0 == e || "" == e)) {
- if (!0 !== c && (e = triggermail.core.sanitizer.sanitize("email", e), !e)) return;
- var f = triggermail.lytics.get_property("email");
- if (!(triggermail.util.isValidEmail(f) && f != e)) return e != triggermail.lytics.get_property("email") &&
- (triggermail.lytics.register({
- email: e
- }, 365), triggermail.track("identify", {
- customer: a
- })), a
- }
- };
- return {
- track: function(a, c) {
- var e = jQuery.extend({}, c);
- jQuery.extend(c, triggermail.lytics.cookie.props);
- try {
- c.url = window.location.href, -1 < c.url.indexOf("s.thebrighttag") && delete c.url
- } catch (f) {}
- "unsubscribe" == a && e.email && (c.email = e.email);
- "page_view" != a && ("true" == triggermail.util.cookie.get("tm_debug") ? triggermail.lytics.track(a, c, this.track_callback(a, c)) : triggermail.lytics.track(a, c));
- triggermail.lytics.get_distinct_id() &&
- (c.distinct_id = triggermail.lytics.get_distinct_id());
- try {
- !0 === triggermail.integ.debug && console.debug(a, c)
- } catch (h) {}
- },
- report_to_insanetiego: function(a, c) {
- if ("true" === triggermail.util.cookie.get("tm_debug")) {
- 0 === $("#insanetiego").length && triggermail.insanetiego.inject_div();
- var e = prettyPrint(c, {
- styles: {
- array: {
- th: {
- display: "none"
- }
- },
- object: {
- th: {
- display: "none"
- }
- },
- "default": {
- th: {
- display: "none"
- }
- }
- }
- });
- $("#insanetiego").append("<p><b>Event: " + a + "</b></p>");
- $("#insanetiego").append(e);
- $.each(c.products, function(a,
- b) {
- var c, e;
- b.image && $("<img/>").attr("src", b.image).load(function() {
- c = this.width;
- e = this.height;
- $("#insanetiego").append("<p><b>Image size: width-" + c + " height-" + e + "<b></p>");
- $("#insanetiego").append('<img src="' + b.image + '" height="100" width="100" />')
- });
- b.alternative_image && (c = this.width, e = this.height, $("<img/>").attr("src", b.alternative_image).load(function() {
- c = this.width;
- e = this.height;
- $("#insanetiego").append("<p><b>Alternative Image size: width-" + c + " height-" + e + "<b></p>");
- $("#insanetiego").append('<img src="' +
- b.alternative_image + '" height="100" width="100"/>')
- }))
- })
- }
- },
- validate: function(a) {
- "true" === triggermail.util.cookie.get("tm_debug") && (a ? $("#insanetiego").append('<p><b style="color:#64E813;">Event is ok</b></p>') : $("#insanetiego").append('<p><b style="color:#E60508;">The Event Seems Broken</b></p>'))
- },
- track_callback: function(a, c) {
- return function(e) {
- triggermail.report_to_insanetiego(a, c);
- triggermail.validate(e)
- }
- },
- add_to_cart: function(a) {
- return this.track("add_to_cart", {
- products: [a]
- })
- },
- remove_from_cart: function(a) {
- return this.track("remove_from_cart", {
- products: [a]
- })
- },
- wishlist: function(a) {
- return this.track("wishlist", {
- products: [a]
- })
- },
- view_cart: function(a) {
- return this.track("viewed_cart", a)
- },
- stop: function(a) {
- return this.track("stop", a)
- },
- page: function(a) {
- return this.track("page_view", a)
- },
- purchase: function(a) {
- return this.track("purchase", a)
- },
- checkout_start: function(a) {
- return this.track("checkout_start", a)
- },
- view: function(a, c) {
- triggermail.integ.salt_products && (a.salt = Math.random().toString(36).replace(".", ""));
- var e = jQuery.extend(c || {}, {
- products: [a]
- });
- return this.track("viewed_product", e)
- },
- view_content: function(a, c) {
- triggermail.integ.salt_products && (a.salt = Math.random().toString(36).replace(".", ""));
- var e = jQuery.extend(c || {}, {
- contents: [a]
- });
- return this.track("viewed_content", e)
- },
- search: function(a) {
- return this.track("search", a)
- },
- identify: function(b, c) {
- return a(b, c)
- },
- subscribe: function(b) {
- b.source = "newsletter";
- return a(b)
- },
- unsubscribe: function(a) {
- return this.track("unsubscribe", a)
- },
- patch: function(a) {
- return this.track("patch", a)
- },
- merge: function(a) {
- return this.track("merge",
- a)
- },
- eton_show: function(a) {
- return this.track("eton_show", a)
- },
- init: function(a) {},
- exception: function(a) {
- var c = {};
- jQuery.extend(c, triggermail.lytics._.info.properties());
- try {
- c.url = window.location.href, -1 < c.url.indexOf("s.thebrighttag") && delete c.url, c.message = a.message
- } catch (e) {}
- c.error = a;
- this.track("exception", c)
- },
- EMAIL_ADDRESS_PROPERTY: "email_address",
- PAGE_VIEW: "page_view",
- MAX_PROPERTY_LENGTH: 1024
- }
- }());
- triggermail.util = function() {
- return {
- price: function(a) {
- return isNaN(parseFloat(a)) ? parseFloat(a.replace(/[^0-9\.]/g, "")) : parseFloat(a)
- },
- unique: function(a) {
- for (var b = {}, c = 0; c < a.length; c++) b[a[c]] = !0;
- return jQuery.map(b, function(a, b) {
- return b
- })
- },
- slugify: function(a) {
- return a.toLowerCase().replace(/[^\w ]+/g, "").replace(/ +/g, "-")
- },
- serializeForm: function(a) {
- var b = {};
- a = a.serializeArray();
- $.each(a, function() {
- void 0 !== b[this.name] ? (b[this.name].push || (b[this.name] = [b[this.name]]), b[this.name].push(this.value ||
- "")) : b[this.name] = this.value || ""
- });
- return b
- },
- getUrlParam: function(a) {
- a = a.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
- a = RegExp("[\\?&]" + a + "=([^&#]*)").exec(window.location.search);
- return null == a ? "" : decodeURIComponent(a[1].replace(/\+/g, " "))
- },
- isMobile: function() {
- var a = !1,
- b = "iphone;ipad;android;blackberry;nokia;opera mini;windows mobile;windows phone;iemobile".split(";"),
- c;
- for (c in b) 0 < navigator.userAgent.toLowerCase().indexOf(b[c].toLowerCase()) && (a = !0);
- return a
- },
- getParamFromQueryString: function(a,
- b) {
- return decodeURI((RegExp(b + "=(.+?)(&|$)").exec(a) || [, null])[1])
- },
- trimString: function(a, b) {
- return jQuery.trim(a).substring(0, b)
- },
- isAnonymousUser: function() {
- var a = triggermail.lytics.get_property(triggermail.core.EMAIL_ADDRESS_PROPERTY);
- return !this.isValidEmail(a)
- },
- emRegex: /\S+@\S+\.\S+/,
- isValidEmail: function(a) {
- return triggermail.util.emRegex.test(a)
- },
- findEmail: function(a, b) {
- try {
- return "undefined" == typeof b && (b = triggermail.util.emRegex), b.exec(a).pop()
- } catch (c) {}
- },
- hashCode: function(a) {
- var b = 0,
- c, e;
- if (0 == a.length) return b;
- for (c = 0; c < a.length; c++) e = a.charCodeAt(c), b = (b << 5) - b + e, b &= b;
- return b
- },
- productHash: function(a) {
- a = this.sanitizeProductName(a[TriggerMail.PRODUCT_NAME_PROPERTY]);
- return this.hashCode(a)
- },
- _getbyte64: function(a, b) {
- _ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- var c = _ALPHA.indexOf(a.charAt(b));
- if (-1 === c) throw "Cannot decode base64";
- return c
- },
- b64decode: function(a) {
- var b = 0,
- c, e, f = a.length,
- h = [];
- a = String(a);
- if (0 === f) return a;
- if (0 !== f % 4) throw "Cannot decode base64";
- "=" === a.charAt(f - 1) && (b = 1, "=" === a.charAt(f - 2) && (b = 2), f -= 4);
- for (c = 0; c < f; c += 4) e = this._getbyte64(a, c) << 18 | this._getbyte64(a, c + 1) << 12 | this._getbyte64(a, c + 2) << 6 | this._getbyte64(a, c + 3), h.push(String.fromCharCode(e >> 16, e >> 8 & 255, e & 255));
- switch (b) {
- case 1:
- e = this._getbyte64(a, c) << 18 | this._getbyte64(a, c + 1) << 12 | this._getbyte64(a, c + 2) << 6;
- h.push(String.fromCharCode(e >> 16, e >> 8 & 255));
- break;
- case 2:
- e = this._getbyte64(a, c) << 18 | this._getbyte64(a, c + 1) << 12, h.push(String.fromCharCode(e >> 16))
- }
- return h.join("")
- },
- wrapEvent: function(a) {
- var b =
- Array.prototype.slice.call(arguments, 1);
- return function() {
- try {
- return a.apply(this, b.concat(Array.prototype.slice.call(arguments, 0)))
- } catch (c) {}
- }
- },
- removeURLParam: function(a, b) {
- return triggermail.util.updateURLParams(a, b, !1)
- },
- keepURLParam: function(a, b) {
- return triggermail.util.updateURLParams(a, b, !0)
- },
- updateURLParams: function(a, b, c) {
- var e = a.split("?")[0],
- f = [],
- f = -1 !== a.indexOf("?") ? a.split("?")[1] : "";
- if ("" !== f) {
- for (var f = f.split("&"), h = f.length - 1; 0 <= h; h -= 1) a = f[h].split("=")[0], c ? jQuery.isArray(b) ? -1 ==
- b.indexOf(a) && f.splice(h, 1) : a != b && f.splice(h, 1) : jQuery.isArray(b) ? -1 < b.indexOf(a) && f.splice(h, 1) : a == b && f.splice(h, 1);
- e += 0 < f.length ? "?" + f.join("&") : ""
- }
- return e
- },
- getArrayElementFromQueryString: function(a, b) {
- var c = [];
- a || (a = location.href);
- b = b.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
- for (var e = RegExp(b + "=([^&#]+)", "ig");;) {
- var f = e.exec(a);
- if (f && f[1]) c.push(f[1]);
- else break
- }
- return c.length ? 1 == c.length ? c[0] : c : null
- }
- }
- }();
- triggermail.util.cookie = triggermail.lytics._.cookie;
- triggermail.util.encode = triggermail.lytics._.JSONEncode;
- triggermail.util.decode = triggermail.lytics._.JSONDecode;
- triggermail.demo = function() {
- var a = triggermail.lytics.get_distinct_id(); - 1 == a.indexOf("live_demo") && (triggermail.lytics._register_single("distinct_id", "live_demo_" + a), a = triggermail.lytics.get_distinct_id());
- triggermail.lytics.cookie.update_config({
- live_demo: !0,
- cookie_expiration: 1
- });
- window.open("http://www.bluecore.com/api/templates/live_demo/" + triggermail.Partner.keys.lytics.p + "/" + a)
- };
- triggermail.util.walk = function(a, b) {
- b(a);
- for (a = a.firstChild; a;) walk(a, b), a = a.nextSibling
- };
- triggermail.util.walkUntil = function(a, b, c) {
- ret = b(a);
- if (!0 === c(ret)) return ret;
- for (a = a.firstChild; a;) walk(a, b), a = a.nextSibling
- };
- triggermail.insanetiego = function() {
- return {
- inject_div: function() {
- $("body").append('<div id="insanetiego" style="position:fixed;bottom:0;width:100%;background:#D8E7ED;height:300px;overflow:scroll;z-index:2000;border-top-style:solid;border-top-width:5px;"></div>')
- },
- remove_div: function() {
- $("#insanetiego").remove()
- },
- debug: function() {
- triggermail.util.cookie.set("tm_debug", !0);
- triggermail.integ.debug = !0;
- this.inject_div()
- },
- undebug: function() {
- triggermail.util.cookie.set("tm_debug", !1);
- triggermail.integ.debug = !1
- }
- }
- }();
- triggermail.core = {};
- triggermail.core.sanitizer = function() {
- return {
- sanitize: function(a, b) {
- if ("email" == a) {
- var c;
- c = /\S+@\S+\.\S+/.test(b) ? b : null;
- return c
- }
- return b ? b : ""
- }
- }
- }();
- triggermail.integ = function() {
- return {
- init: function() {
- "undefined" != typeof triggermail.Partner.init ? triggermail.Partner.init() : triggermail.integ.partnerInit();
- try {
- triggermail.integ.checkLoop()
- } catch (a) {}
- },
- partnerInit: function(a) {
- var b = triggermail.Partner;
- if (!("undefined" == typeof a && (jQuery(".translated-rtl, .translated-rtl").length || jQuery('meta[http-equiv="X-Translated-By"]').length))) {
- try {
- b.trackProductView()
- } catch (c) {
- triggermail.exception(c)
- }
- try {
- triggermail.Partner.trackAddToCart()
- } catch (e) {
- triggermail.exception(e)
- }
- try {
- triggermail.Partner.trackCheckout()
- } catch (f) {
- triggermail.exception(f)
- }
- try {
- triggermail.Partner.watchEmail()
- } catch (h) {
- triggermail.exception(h)
- }
- if (triggermail.Partner.hasOwnProperty("trackRemoveFromCart")) try {
- triggermail.Partner.trackRemoveFromCart()
- } catch (n) {
- triggermail.exception(n)
- }
- if (triggermail.Partner.hasOwnProperty("trackCheckoutStart")) try {
- triggermail.Partner.trackCheckoutStart()
- } catch (q) {
- triggermail.exception(q)
- }
- if (triggermail.Partner.hasOwnProperty("trackUnsubscribe")) try {
- triggermail.Partner.trackUnsubscribe()
- } catch (x) {
- triggermail.exception(x)
- }
- if (triggermail.Partner.hasOwnProperty("trackSubscribe")) try {
- triggermail.Partner.trackSubscribe()
- } catch (l) {
- triggermail.exception(l)
- }
- if (triggermail.Partner.hasOwnProperty("trackSearch")) try {
- triggermail.Partner.trackSearch()
- } catch (m) {
- triggermail.exception(m)
- }
- if (triggermail.Partner.hasOwnProperty("trackWishlist")) try {
- triggermail.Partner.trackWishlist()
- } catch (H) {
- triggermail.exception(H)
- }
- if (triggermail.Partner.hasOwnProperty("trackContentView")) try {
- triggermail.Partner.trackContentView()
- } catch (u) {
- triggermail.exception(u)
- }
- if (triggermail.Partner.hasOwnProperty("trackStop")) try {
- triggermail.Partner.trackStop()
- } catch (z) {
- triggermail.exception(z)
- }
- }
- },
- checkLoop: function() {
- var a = triggermail.util.getUrlParam("tme");
- 0 < a.length ? triggermail.identify({
- email: a,
- source: "tme email append"
- }, !0) : (a = triggermail.util.getUrlParam("obem"), "undefined" != typeof a && "" != a && triggermail.identify({
- obem: a,
- source: "obem email append"
- }), (a = decodeURIComponent(location.search).match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi) || decodeURIComponent(location.hash).match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi)) && triggermail.util.isValidEmail(a[0]) ? triggermail.identify({
- email: a[0],
- source: "esp email append"
- }) : "undefined" != typeof jQuery("#bluecore_purchase_pixel") && 0 < jQuery("#bluecore_purchase_pixel").length && (a = jQuery("#bluecore_purchase_pixel")[0].src, a = triggermail.util.getParamFromQueryString(a, "email"), triggermail.identify({
- email: a,
- source: "bluecore purchase pixel"
- })))
- }
- }
- }();
- triggermail.integ.ProductFetcher = __tmClass.extend({
- name: function() {
- return this._name
- },
- readOg: function(a) {
- return jQuery('meta[property="' + a + '"]').attr("content")
- },
- category: function() {
- return this._category
- },
- color: function() {
- return this._color
- },
- size: function() {
- return this._size
- },
- price: function() {
- return this._price
- },
- brand: function() {
- return this._brand
- },
- id: function() {
- return this._id
- },
- image: function() {
- return this._image
- },
- url: function() {
- return this._url
- },
- out_of_stock: function() {
- return !1
- },
- tags: function() {
- return this._tags
- },
- to_dict: function() {
- try {
- var a = {
- name: triggermail.core.sanitizer.sanitize("name", this.name()),
- category: triggermail.core.sanitizer.sanitize("category", this.category()),
- size: triggermail.core.sanitizer.sanitize("size", this.size()),
- price: triggermail.core.sanitizer.sanitize("price", this.price()),
- brand: triggermail.core.sanitizer.sanitize("brand", this.brand()),
- id: triggermail.core.sanitizer.sanitize("id", this.id()),
- image: triggermail.core.sanitizer.sanitize("image", this.image()),
- url: triggermail.core.sanitizer.sanitize("url",
- this.url()),
- out_of_stock: this.out_of_stock(),
- tags: this.tags(),
- color: triggermail.core.sanitizer.sanitize("color", this.color())
- }, b;
- for (b in a)("" === a[b] || !1 == a[b]) && "out_of_stock" != b && delete a[b];
- jQuery.extend(a, this.extra_props());
- return a
- } catch (c) {
- triggermail.exception({
- location: "product_fetcher",
- error: c
- })
- }
- },
- extra_props: function() {
- return {}
- },
- fetch: function() {
- return this.to_dict()
- }
- });
- triggermail.integ.ContentFetcher = __tmClass.extend({
- name: function() {
- return this._name
- },
- id: function() {
- return this._id
- },
- image: function() {
- return this._image
- },
- url: function() {
- return this._url
- },
- title: function() {
- return this._title
- },
- to_dict: function() {
- try {
- var a = {
- id: triggermail.core.sanitizer.sanitize("id", this.id()),
- image: triggermail.core.sanitizer.sanitize("image", this.image()),
- name: triggermail.core.sanitizer.sanitize("name", this.name()),
- title: triggermail.core.sanitizer.sanitize("title", this.title()),
- url: triggermail.core.sanitizer.sanitize("url",
- this.url())
- }, b;
- for (b in a)("" === a[b] || !1 == a[b]) && delete a[b];
- jQuery.extend(a, this.extra_props());
- return a
- } catch (c) {
- triggermail.exception({
- location: "content_fetcher",
- error: c
- })
- }
- },
- extra_props: function() {
- return {}
- },
- fetch: function() {
- return this.to_dict()
- }
- });
- triggermail.integ.initServices = function() {
- triggermail.lytics.init(triggermail.integ.keys.lytics);
- triggermail.lytics = window["triggermail.lytics"];
- triggermail.lytics.set_config({
- save_referrer: !1,
- store_google: !1,
- debug: triggermail.integ.debug
- })
- };
- triggermail.integ.loadJQuery = function() {
- var a = document.createElement("script");
- a.type = "text/javascript";
- a.src = ("https:" === document.location.protocol ? "https://" : "http://") + "ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js";
- var b = document.getElementsByTagName("script")[0];
- b.parentNode.insertBefore(a, b)
- };
- triggermail.fetcher = triggermail.integ.ProductFetcher.extend({
- name: function() {
- return app.page.title
- },
- category: function() {},
- id: function() {
- return triggermail_master_product_id
- },
- url: function() {
- return window.location.href.split("?")[0]
- },
- brand: function() {},
- image: function() {
- return $('meta[property="og:image"]').attr("content") || jQuery("div.product-primary-image img").first().attr("src")
- },
- price: function() {
- return 0 < $("div.product-main-pricing .product-standard-price").length ? triggermail.util.price($("div.product-main-pricing .product-standard-price").text()) :
- 0 < $("div.product-main-pricing .price-sales").length ? triggermail.util.price($("div.product-main-pricing .price-sales").text()) : triggermail.util.price($("div.product-main-pricing .product-price").text().split("-")[0])
- },
- out_of_stock: function() {
- var a = $(".swatches.size li").length,
- b = $(".swatches.size li.unselectable").length;
- return 2 > a - b ? !0 : !1
- },
- extra_props: function() {
- var a = {};
- $(".breadcrumb li>a").each(function(b, c) {
- 0 != b && (a["breadcrumb_" + b.toString()] = $(c).text())
- });
- 0 < $("div.product-main-pricing .product-price .product-standard-price-strike").length ?
- (a.original_price = triggermail.util.price($("div.product-main-pricing .product-price .product-standard-price-strike").text()), a.on_sale = !0) : 0 < $("div.product-main-pricing .product-standard-price").length ? (a.original_price = triggermail.util.price($("div.product-main-pricing .product-standard-price").text()), a.on_sale = !1) : a.on_sale = !0;
- return a
- }
- });
- triggermail.LuckyContentFetcher = triggermail.integ.ContentFetcher.extend({
- id: function() {
- return "promo"
- },
- name: function() {
- return "promo"
- },
- image: function() {
- return "http://www.triggermail.io/images/blue_logo.png"
- },
- url: function() {
- return "http://www.luckybrand.com"
- },
- title: function() {
- try {
- return $(".top-bar").find("li").first().text()
- } catch (a) {}
- },
- extra_props: function() {
- try {
- var a = {};
- a.note = $(".header-promos").find(".info a").text();
- a.disclaimer_url = $(".header-promos").find(".info a").attr("href").split("?")[0];
- return a
- } catch (b) {}
- }
- });
- triggermail.CheckoutProduct = triggermail.integ.ProductFetcher.extend({
- init: function(a) {
- this._id = a
- }
- });
- triggermail.Partner = function() {
- return {
- init: function() {
- jQuery(document).ready(function() {
- triggermail.integ.partnerInit()
- })
- },
- trackProductView: function() {
- if ("undefined" != typeof app.page.type && "product" == app.page.type && 0 < $("div.product-col-2.product-detail").length) {
- var a = new triggermail.fetcher;
- "undefined" == typeof a.image() ? setTimeout(function() {
- triggermail.Partner.trackProductView()
- }, 5E3) : "" !== a.id() && null !== a.id() && ("" != a.image() ? triggermail.view(a.to_dict()) : triggermail.view({
- id: a.id()
- }, {
- partial: !0
- }));
- $(document).ajaxComplete(function(a, c, e) {
- triggermail.util.wrapEvent(function() {
- if (-1 < e.url.indexOf("size=")) {
- var a = triggermail_master_product_id,
- b = triggermail.util.price($("div.product-main-pricing .product-price .product-standard-price-strike").text());
- "undefined" != typeof b && (0 < b && "null" != b) && triggermail.patch({
- products: [{
- id: a,
- original_price: b
- }]
- })
- }
- })()
- })
- }
- },
- trackAddToCart: function() {
- "https://www.luckybrand.com/on/demandware.store/Sites-LuckyBrand-Site/en_US/Wishlist-Show" != window.location.href && $(document).ajaxComplete(function(a,
- c, e) {
- if ("/on/demandware.store/Sites-LuckyBrand-Site/en_US/Cart-AddProduct?format=ajax" == e.url) try {
- var f = new triggermail.fetcher;
- f.id() && triggermail.add_to_cart({
- id: f.id()
- })
- } catch (h) {
- a = e.data.match(/[0-9A-Z]+/), 0 < a.length && triggermail.add_to_cart({
- id: a[0]
- })
- }
- });
- if ("/cart" == window.location.pathname) {
- var a = [];
- $("table#cart-table tbody tr div.style span.value").each(function(b, c) {
- a.push($(c).text())
- });
- 0 < a.length && triggermail.view_cart({
- products: a
- })
- }
- },
- trackRemoveFromCart: function() {},
- trackCheckoutStart: function() {
- "/cart" ==
- window.location.pathname && "null" != triggermail.util.getParamFromQueryString(window.location.href, "dwcont") && triggermail.checkout_start({})
- },
- trackCheckout: function() {
- if ("undefined" != typeof triggermail_order_json) {
- for (var a = triggermail_order_json.total, b = [], c = __skuString.split("|"), e = 1; e < c.length; e += 4) b.push({
- id: c[e]
- });
- order = {
- total: a,
- products: b,
- email: triggermail_order_json.email,
- order_id: orderID
- };
- triggermail.purchase(order)
- }
- },
- trackSearch: function() {
- $(document).ajaxComplete(function(a, c, e) {
- triggermail.util.wrapEvent(function() {
- if (-1 <
- e.url.indexOf("/search")) {
- var a = triggermail.util.getParamFromQueryString(e.url, "q");
- "" != a && "null" != a && triggermail.search({
- search_term: a
- })
- }
- }, e)()
- });
- if ("search" == app.page.type) {
- var a = [];
- $(".breadcrumbpath a").each(function(b, c) {
- a.push($(c).attr("title"))
- });
- triggermail.search({
- search_term: a.join(" ")
- })
- }
- },
- trackContentView: function() {
- if (1 == Math.floor(100 * Math.random()) && "http://www.luckybrand.com/" == window.location.href) {
- var a = new triggermail.LuckyContentFetcher;
- triggermail.view_content(a.to_dict())
- }
- },
- trackUnsubscribe: function() {
- if (-1 < window.location.href.indexOf("pages.email-luckybrand.com") && $("#unsubscribe").is(":checked")) {
- var a = $("#email").val();
- if (triggermail.util.isValidEmail(a)) return triggermail.unsubscribe({
- email: a
- })
- }
- },
- trackSubscribe: function() {
- $(document).ajaxComplete(function(a, b, c) {
- triggermail.util.wrapEvent(function() {
- if (-1 < c.url.indexOf("Account-EmailSignup")) {
- var a = decodeURIComponent(triggermail.util.getParamFromQueryString(c.data, "email"));
- triggermail.util.isValidEmail(a) && triggermail.identify({
- email: a,
- source: "email signup"
- })
- }
- }, c)()
- })
- },
- watchEmail: function() {
- if ("undefined" == typeof _loggedIn) var a = $(".menu-utility-user li:first-child").text().trim().split("\n")[1].trim();
- window.triggermail_email_address && triggermail.identify({
- email: triggermail_email_address,
- first_name: a
- });
- a = "";
- try {
- a = decodeURIComponent(triggermail.util.getParamFromQueryString(window.location.hash, "ea"))
- } catch (b) {}
- triggermail.util.isValidEmail(a) && triggermail.identify({
- email: a
- })
- },
- env: function() {
- return -1 < document.location.hostname.toLowerCase().indexOf("www.luckybrand.com") ?
- "p" : "d"
- },
- keys: {
- Keen: {
- d: {
- id: "",
- key: ""
- },
- p: {
- id: "52f11badd97b854cf2000000",
- key: "d738abf54d6e54c13e034a61158ddb7505567520c38ad18590ca53ebc2f0fc66994d3e846cca186e179143d1624370ce5ce0fc77f5f320ad173839776db6a758546eefac5e4a2627269ba61a6ae110e8d2cc3806b117dfab7f3623cb89c7c4487391ad6b60df889e446de08baeec584a"
- }
- },
- lytics: {
- d: "dev",
- p: "lucky_jeans"
- }
- }
- }
- }();
- triggermail.initialize = function() {
- triggermail.integ.keys = {};
- var a = triggermail.Partner.env();
- triggermail.integ.keys.lytics = triggermail.Partner.keys.lytics[a];
- triggermail.integ.debug = !1;
- triggermail.integ.initServices();
- triggermail.init();
- a = triggermail.util.getUrlParam("__distinct_id_override__");
- "" != a && (triggermail.lytics.cookie.props.distinct_id = a, triggermail.lytics.cookie.save());
- a = triggermail.util.getUrlParam("eton_distinct_id");
- "" != a && (triggermail.lytics.cookie.props.distinct_id = a, triggermail.lytics.cookie.save());
- var a = triggermail.util.getUrlParam("mc_eid"),
- b = triggermail.lytics.cookie.props.distinct_id;
- a && b !== a && (a = "mceid_" + a, b !== a && (triggermail.merge({
- merge: {
- source: b,
- destination: a
- },
- customer: {
- distinct_id: a
- }
- }), triggermail.lytics.cookie.props.distinct_id = a, triggermail.lytics.cookie.save(), triggermail.lytics.register({
- mc_eid: a
- })));
- triggermail.integ.init();
- a = triggermail.util.getUrlParam("__auto_demo__");
- "" != a && (triggermail.demo(), triggermail.identify({
- email: a
- }));
- try {
- triggermail.eton.init()
- } catch (c) {}
- };
- function __checkJquery() {
- triggermail.__tm_initialized || (window.jQuery ? (triggermail.initialize(), triggermail.__tm_initialized = !0) : window.setTimeout(__checkJquery, 100))
- }
- __checkJquery();
Advertisement
Add Comment
Please, Sign In to add comment