Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@thibaudcolas
Last active February 6, 2021 00:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thibaudcolas/74b44bb489f31e2ff63f4e3b79cbd446 to your computer and use it in GitHub Desktop.
Save thibaudcolas/74b44bb489f31e2ff63f4e3b79cbd446 to your computer and use it in GitHub Desktop.
diff a/owa.tracker-combined-min-1.6.2.js b/owa-tgs.js (both run through Prettier first, after removing the extra closure around the whole TGS code)
diff --git a/owa.tracker-combined-min-1.6.2.js b/owa-tgs.js
index c718d10..2c5fd6e 100644
--- a/owa.tracker-combined-min-1.6.2.js
+++ b/owa-pretty.js
@@ -1,7 +1,3 @@
-/* OWA owa.tracker package file created Sun, 03 Jun 18 20:57:14 -0700 */
-
-/* Start of json2 */
-
if (!this.JSON) {
this.JSON = {};
}
@@ -225,11 +221,6 @@ if (!this.JSON) {
};
}
})();
-
-/* End of json2 */
-
-/* Start of lazyload */
-
LazyLoad = (function () {
var f = document,
g,
@@ -325,7 +316,11 @@ LazyLoad = (function () {
for (n = 0, o = q.length; n < o; ++n) {
d = q[n];
if (r === "css") {
- l = j("link", { href: d, rel: "stylesheet", type: "text/css" });
+ l = j("link", {
+ href: d,
+ rel: "stylesheet",
+ type: "text/css",
+ });
} else {
l = j("script", { src: d });
}
@@ -360,11 +355,6 @@ LazyLoad = (function () {
},
};
})();
-
-/* End of lazyload */
-
-/* Start of owa */
-
var OWA = {
items: {},
loadedJsLibs: {},
@@ -999,14 +989,14 @@ OWA.util = {
createCookie: function (name, value, days, domain) {
if (days) {
var date = new Date();
- date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
+ date.setTime(date.getTime() + days * 24 * 60 * 60 * 1e3);
var expires = "; expires=" + date.toGMTString();
} else var expires = "";
document.cookie = name + "=" + value + expires + "; path=/";
},
setCookie: function (name, value, days, path, domain, secure) {
var date = new Date();
- date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
+ date.setTime(date.getTime() + days * 24 * 60 * 60 * 1e3);
document.cookie =
name +
"=" +
@@ -1386,7 +1376,7 @@ OWA.util = {
}
},
getCurrentUnixTimestamp: function () {
- return Math.round(new Date().getTime() / 1000);
+ return Math.round(new Date().getTime() / 1e3);
},
generateHash: function (value) {
return this.crc32(value);
@@ -1406,7 +1396,7 @@ OWA.util = {
var y = 0;
crc = crc ^ -1;
for (var i = 0, iTop = str.length; i < iTop; i++) {
- y = (crc ^ str.charCodeAt(i)) & 0xff;
+ y = (crc ^ str.charCodeAt(i)) & 255;
x = "0x" + table.substr(y * 9, 8);
crc = (crc >>> 8) ^ x;
}
@@ -1483,8 +1473,7 @@ OWA.util = {
i = 0;
str += "";
if (!charlist) {
- whitespace =
- " \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000";
+ whitespace = " \n\r\t\f\v            ​\u2028\u2029 ";
} else {
charlist += "";
whitespace = charlist.replace(
@@ -1544,10 +1533,10 @@ OWA.util = {
o2 = data.charCodeAt(i++);
o3 = data.charCodeAt(i++);
bits = (o1 << 16) | (o2 << 8) | o3;
- h1 = (bits >> 18) & 0x3f;
- h2 = (bits >> 12) & 0x3f;
- h3 = (bits >> 6) & 0x3f;
- h4 = bits & 0x3f;
+ h1 = (bits >> 18) & 63;
+ h2 = (bits >> 12) & 63;
+ h3 = (bits >> 6) & 63;
+ h4 = bits & 63;
tmp_arr[ac++] =
b64.charAt(h1) +
b64.charAt(h2) +
@@ -1590,9 +1579,9 @@ OWA.util = {
h3 = b64.indexOf(data.charAt(i++));
h4 = b64.indexOf(data.charAt(i++));
bits = (h1 << 18) | (h2 << 12) | (h3 << 6) | h4;
- o1 = (bits >> 16) & 0xff;
- o2 = (bits >> 8) & 0xff;
- o3 = bits & 0xff;
+ o1 = (bits >> 16) & 255;
+ o2 = (bits >> 8) & 255;
+ o3 = bits & 255;
if (h3 == 64) {
tmp_arr[ac++] = String.fromCharCode(o1);
} else if (h4 == 64) {
@@ -1893,7 +1882,7 @@ OWA.util = {
},
dechex: function (number) {
if (number < 0) {
- number = 0xffffffff + number + 1;
+ number = 4294967295 + number + 1;
}
return parseInt(number, 10).toString(16);
},
@@ -1954,15 +1943,10 @@ OWA.util = {
return true;
},
};
-
-/* End of owa */
-
-/* Start of owa.tracker */
-
OWA.event = function () {
this.properties = {};
this.id = "";
- this.siteId = "";
+ this.siteId = "bacakpdjpomjaelpkpkabmedhkoongbi";
this.set("timestamp", OWA.util.getCurrentUnixTimestamp());
};
OWA.event.prototype = {
@@ -2067,7 +2051,7 @@ OWA.tracker = function (options) {
encodeProperties: false,
movementInterval: 100,
logDomStreamPercentage: 100,
- domstreamLoggingInterval: 3000,
+ domstreamLoggingInterval: 3e3,
domstreamEventThreshold: 10,
maxPriorCampaigns: 5,
campaignAttributionWindow: 60,
@@ -2079,14 +2063,18 @@ OWA.tracker = function (options) {
{ public: "owa_medium", private: "md", full: "medium" },
{ public: "owa_campaign", private: "cn", full: "campaign" },
{ public: "owa_source", private: "sr", full: "source" },
- { public: "owa_search_terms", private: "tr", full: "search_terms" },
+ {
+ public: "owa_search_terms",
+ private: "tr",
+ full: "search_terms",
+ },
{ public: "owa_ad", private: "ad", full: "ad" },
{ public: "owa_ad_type", private: "at", full: "ad_type" },
],
logger_endpoint: "",
api_endpoint: "",
maxCustomVars: 5,
- getRequestCharacterLimit: 2000,
+ getRequestCharacterLimit: 2e3,
};
var endpoint = window.owa_baseUrl || OWA.config.baseUrl;
if (endpoint) {
@@ -2556,7 +2544,7 @@ OWA.tracker.prototype = {
},
generateHiddenIframe: function (parentElement, data) {
var iframe_name = "owa-tracker-post-iframe";
- if (OWA.util.isIE() && OWA.util.getInternetExplorerVersion() < 9.0) {
+ if (OWA.util.isIE() && OWA.util.getInternetExplorerVersion() < 9) {
var iframe = document.createElement(
'<iframe name="' +
iframe_name +
@@ -2586,13 +2574,13 @@ OWA.tracker.prototype = {
var cleanuptimer = setInterval(function () {
parentElement.removeChild(iframe);
clearInterval(cleanuptimer);
- }, 1000);
+ }, 1e3);
},
postFromIframe: function (ifr, data) {
var post_url = this.getLoggerEndpoint();
var doc = this.getIframeDocument(ifr);
var form_name = "post_form" + Math.random();
- if (OWA.util.isIE() && OWA.util.getInternetExplorerVersion() < 9.0) {
+ if (OWA.util.isIE() && OWA.util.getInternetExplorerVersion() < 9) {
var frm = doc.createElement(
'<form name="' + form_name + '"></form>'
);
@@ -2607,7 +2595,7 @@ OWA.tracker.prototype = {
if (data.hasOwnProperty(param)) {
if (
OWA.util.isIE() &&
- OWA.util.getInternetExplorerVersion() < 9.0
+ OWA.util.getInternetExplorerVersion() < 9
) {
var input = doc.createElement(
"<input type='hidden' name='" + param + "' />"
@@ -2628,7 +2616,7 @@ OWA.tracker.prototype = {
createPostForm: function () {
var post_url = this.getLoggerEndpoint();
var form_name = "post_form" + Math.random();
- if (OWA.util.isIE() && OWA.util.getInternetExplorerVersion() < 9.0) {
+ if (OWA.util.isIE() && OWA.util.getInternetExplorerVersion() < 9) {
var frm = doc.createElement(
'<form name="' + form_name + '"></form>'
);
@@ -3593,5 +3581,3 @@ OWA.tracker.prototype = {
window["owa_cmds"].process();
}
})();
-
-/* End of owa.tracker */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment