Created
February 22, 2019 15:21
-
-
Save JacobLett/36894fdc4f37dc8cc85dc2367d57e60a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function ensightenInit() { | |
| var ensightenOptions = { | |
| client: "altair", | |
| clientId: 2538, | |
| publishPath: "prod", | |
| isPublic: 1, | |
| serverComponentLocation: "nexus.ensighten.com/altair/prod/serverComponent.php", | |
| staticJavascriptPath: "nexus.ensighten.com/altair/prod/code/", | |
| ns: 'Bootstrapper', | |
| nexus: "nexus.ensighten.com", | |
| scUseCacheBuster: "true", | |
| enableTagAuditBeacon: "false", | |
| enablePagePerfBeacon: "false", | |
| registryNs: "ensBootstraps", | |
| generatedOn: "Thu Nov 08 22:02:35 GMT 2018", | |
| beaconSamplingSeedValue: 11 | |
| }; | |
| if (!window[ensightenOptions.ns]) { | |
| window[ensightenOptions.registryNs] || (window[ensightenOptions.registryNs] = {}); | |
| window[ensightenOptions.registryNs][ensightenOptions.ns] = window[ensightenOptions.ns] = function(f) { | |
| function l(a) { | |
| this.name = "DependencyNotAvailableException"; | |
| this.message = "Dependency with id " + a + "is missing" | |
| } | |
| function m(a) { | |
| this.name = "BeaconException"; | |
| this.message = "There was an error durring beacon initialization"; | |
| a = a || {}; | |
| this.lineNumber = a.lineNumber || a.line; | |
| this.fileName = a.fileName | |
| } | |
| function n() { | |
| for (var a = b.dataDefinitionIds.length, c = !0, d = 0; d < a; d++) { | |
| var e = b.dataDefinitions[b.dataDefinitionIds[d]]; | |
| if (!e || | |
| null == e.endRegistration) { | |
| c = !1; | |
| break | |
| } | |
| } | |
| c && b.callOnDataDefintionComplete() | |
| } | |
| var e = {}, | |
| b = {}; | |
| b.ensightenOptions = ensightenOptions; | |
| b.scDataObj = {}; | |
| e.version = "1.26.0"; | |
| e.nexus = f.nexus || "nexus.ensighten.com"; | |
| e.rand = -1; | |
| e.currSec = (new Date).getSeconds(); | |
| e.options = { | |
| interval: f.interval || 100, | |
| erLoc: f.errorLocation || e.nexus + "/error/e.gif", | |
| scLoc: f.serverComponentLocation || e.nexus + "/" + f.client + "/serverComponent.php", | |
| sjPath: f.staticJavascriptPath || e.nexus + "/" + f.client + "/code/", | |
| alLoc: f.alertLocation || e.nexus + "/alerts/a.gif", | |
| publishPath: f.publishPath, | |
| isPublic: f.isPublic, | |
| client: f.client, | |
| clientId: f.clientId, | |
| enableTagAuditBeacon: f.enableTagAuditBeacon, | |
| scUseCacheBuster: f.scUseCacheBuster, | |
| beaconSamplingSeedValue: f.beaconSamplingSeedValue || -1 | |
| }; | |
| e.ruleList = []; | |
| e.allDeploymentIds = []; | |
| e.runDeploymentIds = []; | |
| e.runRuleIds = []; | |
| e.exceptionList = []; | |
| e.ensightenVariables = {}; | |
| e.test = function(a) { | |
| if (!(a.executionData.hasRun || a.executionData.runTime && 0 < a.executionData.runTime.length)) { | |
| for (var c = 0; c < a.dependencies.length; c++) | |
| if (!1 === a.dependencies[c]()) return; | |
| a.execute() | |
| } | |
| }; | |
| l.prototype = Error(); | |
| l.prototype || (l.prototype = {}); | |
| l.prototype.constructor = l; | |
| e.DependencyNotAvailableException = l; | |
| m.prototype = Error(); | |
| m.prototype || (m.prototype = {}); | |
| m.prototype.constructor = m; | |
| e.BeaconException = m; | |
| e.checkForInvalidDependencies = function(a, c, d, h) { | |
| for (a = 0; a < d.length; a++) | |
| if ("DEPENDENCYNEVERAVAILABLE" === d[a]) return b.currentRuleId = this.id, b.currentDeploymentId = this.deploymentId, b.reportException(new e.DependencyNotAvailableException(h[a])), c && -1 !== c && e.allDeploymentIds.push(c), !0; | |
| return !1 | |
| }; | |
| b.currentRuleId = -1; | |
| b.currentDeploymentId = -1; | |
| b.reportedErrors = []; | |
| b.reportedAlerts = []; | |
| b.AF = []; | |
| b._serverTime = ""; | |
| b._clientIP = ""; | |
| b.sampleBeacon = function() { | |
| var a = !1; | |
| try { | |
| var c = (e.currSec || 0) % 20, | |
| b = e.options.beaconSamplingSeedValue; - 1 === b ? a = !0 : 0 !== c && 0 === b % c && (a = !0) | |
| } catch (h) {} | |
| return a | |
| }; | |
| b.getServerComponent = function(a) { | |
| b.callOnGetServerComponent(); | |
| b.insertScript(window.location.protocol + "//" + e.options.scLoc, !1, a || !0, e.options.scUseCacheBuster) | |
| }; | |
| b.setVariable = function(a, c) { | |
| e.ensightenVariables[a] = | |
| c | |
| }; | |
| b.getVariable = function(a) { | |
| return a in e.ensightenVariables ? e.ensightenVariables[a] : null | |
| }; | |
| b.testAll = function() { | |
| for (var a = 0; a < e.ruleList.length; a++) e.test(e.ruleList[a]) | |
| }; | |
| b.executionState = { | |
| DOMParsed: !1, | |
| DOMLoaded: !1, | |
| dataDefinitionComplete: !1, | |
| conditionalRules: !1, | |
| readyForServerComponent: !1 | |
| }; | |
| b.reportException = function(a) { | |
| a.timestamp = (new Date).getTime(); | |
| e.exceptionList.push(a); | |
| a = window.location.protocol + "//" + e.options.erLoc + "?msg=" + encodeURIComponent(a.message || "") + "&lnn=" + encodeURIComponent(a.lineNumber || | |
| a.line || -1) + "&fn=" + encodeURIComponent(a.fileName || "") + "&cid=" + encodeURIComponent(e.options.clientId || -1) + "&client=" + encodeURIComponent(e.options.client || "") + "&publishPath=" + encodeURIComponent(e.options.publishPath || "") + "&rid=" + encodeURIComponent(b.currentRuleId || -1) + "&did=" + encodeURIComponent(b.currentDeploymentId || -1) + "&errorName=" + encodeURIComponent(a.name || ""); | |
| a = b.imageRequest(a); | |
| a.timestamp = (new Date).getTime(); | |
| this.reportedErrors.push(a) | |
| }; | |
| b.Rule = function(a) { | |
| this.execute = function() { | |
| this.executionData.runTime.push(new Date); | |
| b.currentRuleId = this.id; | |
| b.currentDeploymentId = this.deploymentId; | |
| try { | |
| this.code() | |
| } catch (c) { | |
| window[ensightenOptions.ns].reportException(c) | |
| } finally { | |
| this.executionData.hasRun = !0, -1 !== this.deploymentId && (e.runDeploymentIds.push(this.deploymentId), e.runRuleIds.push(this.id)), b.testAll() | |
| } | |
| }; | |
| this.id = a.id; | |
| this.deploymentId = a.deploymentId; | |
| this.dependencies = a.dependencies || []; | |
| this.code = a.code; | |
| this.executionData = { | |
| hasRun: !1, | |
| runTime: [] | |
| } | |
| }; | |
| b.registerRule = function(a) { | |
| if (b.getRule(a.id) && -1 !== a.id) return !1; | |
| e.ruleList.push(a); - 1 !== a.deploymentId && e.allDeploymentIds.push(a.deploymentId); | |
| b.testAll(); | |
| return !0 | |
| }; | |
| b.getRule = function(a) { | |
| for (var c = 0; c < e.ruleList.length; c++) | |
| if (e.ruleList[c].id === a) return e.ruleList[c]; | |
| return !1 | |
| }; | |
| b.getRuleList = function() { | |
| return e.ruleList | |
| }; | |
| b.clearRuleList = function() { | |
| e.ruleList = [] | |
| }; | |
| b.getAllDeploymentIds = function() { | |
| return e.allDeploymentIds | |
| }; | |
| b.getRunRuleIds = function() { | |
| return e.runRuleIds | |
| }; | |
| b.getRunDeploymentIds = function() { | |
| return e.runDeploymentIds | |
| }; | |
| b.hasRuleRun = function(a) { | |
| return (a = b.getRule(a)) ? a.executionData.hasRun : | |
| !1 | |
| }; | |
| e.toTwoChar = function(a) { | |
| return (2 === a.toString().length ? "" : "0") + a | |
| }; | |
| b.Alert = function(a) { | |
| var c = new Date; | |
| c = c.getFullYear() + "-" + e.toTwoChar(c.getMonth()) + "-" + e.toTwoChar(c.getDate()) + " " + e.toTwoChar(c.getHours()) + ":" + e.toTwoChar(c.getMinutes()) + ":" + e.toTwoChar(c.getSeconds()); | |
| this.severity = a.severity || 1; | |
| this.subject = a.subject || ""; | |
| this.type = a.type || 1; | |
| this.ruleId = a.ruleId || -1; | |
| this.severity = encodeURIComponent(this.severity); | |
| this.date = encodeURIComponent(c); | |
| this.subject = encodeURIComponent(this.subject); | |
| this.type = encodeURIComponent(this.type) | |
| }; | |
| b.generateAlert = function(a) { | |
| a = b.imageRequest(window.location.protocol + "//" + e.options.alLoc + "?d=" + a.date + "&su=" + a.subject + "&se=" + a.severity + "&t=" + a.type + "&cid=" + e.options.clientId + "&client=" + e.options.client + "&publishPath=" + e.options.publishPath + "&rid=" + b.currentRuleId + "&did=" + b.currentDeploymentId); | |
| a.timestamp = (new Date).getTime(); | |
| this.reportedAlerts.push(a) | |
| }; | |
| b.imageRequest = function(a) { | |
| var c = new Image(0, 0); | |
| c.src = a; | |
| return c | |
| }; | |
| b.insertScript = function(a, c, d, h) { | |
| var p = | |
| document.getElementsByTagName("script"), | |
| g; | |
| h = void 0 !== h ? h : !0; | |
| if (void 0 !== c ? c : 1) | |
| for (g = 0; g < p.length; g++) | |
| if (p[g].src === a && p[g].readyState && /loaded|complete/.test(p[g].readyState)) return; | |
| if (d) { | |
| d = 1 == d && "object" == typeof b.scDataObj ? b.scDataObj : d; | |
| e.rand = Math.random() * ("1E" + (10 * Math.random()).toFixed(0)); | |
| c = window.location.href; | |
| "object" === typeof d && d.PageID && (c = d.PageID, delete d.PageID); | |
| if ("object" === typeof d) | |
| for (g in d) { | |
| g = ~c.indexOf("#") ? c.slice(c.indexOf("#"), c.length) : ""; | |
| c = c.slice(0, g.length ? c.length - g.length : | |
| c.length); | |
| c += ~c.indexOf("?") ? "&" : "?"; | |
| for (k in d) c += k + "=" + d[k] + "&"; | |
| c = c.slice(0, -1) + g; | |
| break | |
| } | |
| a += "?"; | |
| h && (a += "r=" + e.rand + "&"); | |
| a += "ClientID=" + encodeURIComponent(e.options.clientId) + "&PageID=" + encodeURIComponent(c) | |
| }(function(a, c, b) { | |
| var d = c.head || c.getElementsByTagName("head"); | |
| setTimeout(function() { | |
| if ("item" in d) { | |
| if (!d[0]) { | |
| setTimeout(arguments.callee, 25); | |
| return | |
| } | |
| d = d[0] | |
| } | |
| var a = c.createElement("script"); | |
| a.src = b; | |
| a.onload = a.onerror = function() { | |
| this.addEventListener && (this.readyState = "loaded") | |
| }; | |
| d.insertBefore(a, | |
| d.firstChild) | |
| }, 0) | |
| })(window, document, a) | |
| }; | |
| b.loadScriptCallback = function(a, c, b) { | |
| var d = document.getElementsByTagName("script"), | |
| e; | |
| b = d[0]; | |
| for (e = 0; e < d.length; e++) | |
| if (d[e].src === a && d[e].readyState && /loaded|complete/.test(d[e].readyState)) try { | |
| c() | |
| } catch (g) { | |
| window[ensightenOptions.ns].reportException(g) | |
| } finally { | |
| return | |
| } | |
| d = document.createElement("script"); | |
| d.type = "text/javascript"; | |
| d.async = !0; | |
| d.src = a; | |
| d.onerror = function() { | |
| this.addEventListener && (this.readyState = "loaded") | |
| }; | |
| d.onload = d.onreadystatechange = function() { | |
| if (!this.readyState || | |
| "complete" === this.readyState || "loaded" === this.readyState) { | |
| this.onload = this.onreadystatechange = null; | |
| this.addEventListener && (this.readyState = "loaded"); | |
| try { | |
| c.call(this) | |
| } catch (g) { | |
| window[ensightenOptions.ns].reportException(g) | |
| } | |
| } | |
| }; | |
| b.parentNode.insertBefore(d, b) | |
| }; | |
| b.insertPageFiles = function(a) { | |
| var b = 0, | |
| d = 0, | |
| e = function() { | |
| d == a.length - 1 && window[ensightenOptions.ns].callOnPageSpecificCompletion(); | |
| d++ | |
| }; | |
| for (b = 0; b < a.length; ++b) window[ensightenOptions.ns].loadScriptCallback(a[b], e) | |
| }; | |
| b.unobtrusiveAddEvent = function(a, | |
| b, d) { | |
| try { | |
| var c = a[b] ? a[b] : function() {}; | |
| a[b] = function() { | |
| d.apply(this, arguments); | |
| return c.apply(this, arguments) | |
| } | |
| } catch (p) { | |
| window[ensightenOptions.ns].reportException(p) | |
| } | |
| }; | |
| b.anonymous = function(a, c) { | |
| return function() { | |
| try { | |
| b.currentRuleId = c ? c : "anonymous", a() | |
| } catch (d) { | |
| window[ensightenOptions.ns].reportException(d) | |
| } | |
| } | |
| }; | |
| b.setCurrentRuleId = function(a) { | |
| b.currentRuleId = a | |
| }; | |
| b.setCurrentDeploymentId = function(a) { | |
| b.currentDeploymentId = a | |
| }; | |
| b.bindImmediate = function(a, c, d) { | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: d || -1, | |
| dependencies: [], | |
| code: a | |
| }); | |
| else if ("object" !== typeof a) return !1; | |
| b.registerRule(a) | |
| }; | |
| b.bindDOMParsed = function(a, c, d) { | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: d || -1, | |
| dependencies: [function() { | |
| return window[ensightenOptions.ns].executionState.DOMParsed | |
| }], | |
| code: a | |
| }); | |
| else if ("object" !== typeof a) return !1; | |
| b.registerRule(a) | |
| }; | |
| b.bindDOMLoaded = function(a, c, d) { | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: d || -1, | |
| dependencies: [function() { | |
| return window[ensightenOptions.ns].executionState.DOMLoaded | |
| }], | |
| code: a | |
| }); | |
| else if ("object" !== typeof a) return !1; | |
| b.registerRule(a) | |
| }; | |
| b.bindPageSpecificCompletion = function(a, c, d) { | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: d || -1, | |
| dependencies: [function() { | |
| return window[ensightenOptions.ns].executionState.conditionalRules | |
| }], | |
| code: a | |
| }); | |
| else if ("object" !== typeof a) return !1; | |
| b.registerRule(a) | |
| }; | |
| b.bindOnGetServerComponent = function(a, c, d) { | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: d || -1, | |
| dependencies: [function() { | |
| return window[ensightenOptions.ns].executionState.readyForServerComponent | |
| }], | |
| code: a | |
| }); | |
| else if ("object" !== typeof a) return !1; | |
| b.registerRule(a) | |
| }; | |
| b.bindDataDefinitionComplete = function(a, c, d) { | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: d || -1, | |
| dependencies: [function() { | |
| return window[ensightenOptions.ns].executionState.dataDefinitionComplete | |
| }], | |
| code: a | |
| }); | |
| else if ("object" !== typeof a) return !1; | |
| b.registerRule(a) | |
| }; | |
| b.checkHasRun = function(a) { | |
| if (0 === a.length) return !0; | |
| for (var c, d = 0; d < a.length; ++d) | |
| if (c = b.getRule(parseInt(a[d], 10)), !c || !c.executionData.hasRun) return !1; | |
| return !0 | |
| }; | |
| b.bindDependencyImmediate = function(a, c, d, h, f) { | |
| var g = []; | |
| if (!e.checkForInvalidDependencies(c, h, d, f)) { | |
| g.push(function() { | |
| return window[ensightenOptions.ns].checkHasRun(d) | |
| }); | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: h || -1, | |
| dependencies: g, | |
| code: a | |
| }); | |
| else if ("object" !== typeof a) return !1; | |
| b.registerRule(a) | |
| } | |
| }; | |
| b.bindDependencyDOMLoaded = function(a, c, d, h, f) { | |
| var g = []; | |
| if (!e.checkForInvalidDependencies(c, h, d, f)) { | |
| g.push(function() { | |
| return window[ensightenOptions.ns].executionState.DOMLoaded | |
| }); | |
| g.push(function() { | |
| return window[ensightenOptions.ns].checkHasRun(d) | |
| }); | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: h || -1, | |
| dependencies: g, | |
| code: a | |
| }); | |
| else if ("object" !== typeof a) return !1; | |
| b.registerRule(a) | |
| } | |
| }; | |
| b.bindDependencyDOMParsed = function(a, c, d, h, f) { | |
| var g = []; | |
| if (!e.checkForInvalidDependencies(c, h, d, f)) { | |
| g.push(function() { | |
| return window[ensightenOptions.ns].executionState.DOMParsed | |
| }); | |
| g.push(function() { | |
| return window[ensightenOptions.ns].checkHasRun(d) | |
| }); | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: h || -1, | |
| dependencies: g, | |
| code: a | |
| }); | |
| else if ("object" !== | |
| typeof a) return !1; | |
| b.registerRule(a) | |
| } | |
| }; | |
| b.bindDependencyPageSpecificCompletion = function(a, c, d, h, f) { | |
| var g = []; | |
| if (!e.checkForInvalidDependencies(c, h, d, f)) { | |
| g.push(function() { | |
| return window[ensightenOptions.ns].executionState.conditionalRules | |
| }); | |
| g.push(function() { | |
| return window[ensightenOptions.ns].checkHasRun(d) | |
| }); | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: h || -1, | |
| dependencies: g, | |
| code: a | |
| }); | |
| else if ("object" !== typeof a) return !1; | |
| b.registerRule(a) | |
| } | |
| }; | |
| b.bindDependencyOnGetServerComponent = function(a, | |
| c, d, h, f) { | |
| var g = []; | |
| if (!e.checkForInvalidDependencies(c, h, d, f)) { | |
| g.push(function() { | |
| return window[ensightenOptions.ns].executionState.readyForServerComponent | |
| }); | |
| g.push(function() { | |
| return window[ensightenOptions.ns].checkHasRun(d) | |
| }); | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: h || -1, | |
| dependencies: g, | |
| code: a | |
| }); | |
| else if ("object" !== typeof a) return !1; | |
| b.registerRule(a) | |
| } | |
| }; | |
| b.bindDependencyPageSpecificCompletion = function(a, c, d, f, p) { | |
| var g = []; | |
| if (!e.checkForInvalidDependencies(c, f, d, p)) { | |
| g.push(function() { | |
| return window[ensightenOptions.ns].executionState.dataDefinitionComplete | |
| }); | |
| g.push(function() { | |
| return window[ensightenOptions.ns].checkHasRun(d) | |
| }); | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: f || -1, | |
| dependencies: g, | |
| code: a | |
| }); | |
| else if ("object" !== typeof a) return !1; | |
| b.registerRule(a) | |
| } | |
| }; | |
| b.dataDefintionIds = []; | |
| b.dataDefinitions = []; | |
| b.pageSpecificDataDefinitionsSet = !1; | |
| b.setPageSpecificDataDefinitionIds = function(a) { | |
| for (var c = a ? a.length : 0, d = 0; d < c; d++) { | |
| var e = a[d]; | |
| if (Array.prototype.indexOf) - 1 == b.dataDefinitionIds.indexOf(e) && b.dataDefinitionIds.push(e); | |
| else { | |
| for (var f = !1, g = | |
| b.dataDefinitionIds.length, l = 0; l < g; l++) | |
| if (b.dataDefinitionIds[l] === e) { | |
| f = !0; | |
| break | |
| } | |
| f || b.dataDefinitionIds.push(e) | |
| } | |
| } | |
| b.pageSpecificDataDefinitionsSet = !0; | |
| n() | |
| }; | |
| b.DataDefinition = function(a, b) { | |
| this.id = a; | |
| this.registrationFn = b; | |
| this.endRegistrationTime = this.startRegistrationTime = null; | |
| this.startRegistration = function() { | |
| this.startRegistrationTime = new Date | |
| }; | |
| this.endRegistration = function() { | |
| this.endRegistrationTime = new Date | |
| } | |
| }; | |
| b.registerDataDefinition = function(a, c) { | |
| var d = b.dataDefinitions[c]; | |
| d || (d = new b.DataDefinition(c, | |
| a), b.dataDefinitions[c] = d); | |
| d.startRegistrationTime || (d.startRegistration(), d.registrationFn(), d.endRegistration()); | |
| b.pageSpecificDataDefinitionsSet && n() | |
| }; | |
| b.callOnDataDefintionComplete = function() { | |
| b.executionState.dataDefinitionComplete = !0; | |
| b.testAll() | |
| }; | |
| b.callOnDOMParsed = function() { | |
| window[ensightenOptions.ns].executionState.DOMParsed = !0; | |
| window[ensightenOptions.ns].testAll() | |
| }; | |
| b.callOnDOMLoaded = function() { | |
| window[ensightenOptions.ns].executionState.DOMParsed = !0; | |
| window[ensightenOptions.ns].executionState.DOMLoaded = !0; | |
| window[ensightenOptions.ns].testAll() | |
| }; | |
| b.callOnPageSpecificCompletion = function() { | |
| for (var a = document.getElementsByTagName("script"), b = 0, d = a.length; b < d; b++) | |
| if (a[b].src && a[b].src.match(/\.ensighten\.com\/(.+?)\/code\/.*/i) && "loaded" != a[b].readyState && "complete" != a[b].readyState) { | |
| setTimeout(window[ensightenOptions.ns].callOnPageSpecificCompletion, 50); | |
| return | |
| } | |
| setTimeout(function() { | |
| window[ensightenOptions.ns].executionState.conditionalRules = !0; | |
| window[ensightenOptions.ns].testAll() | |
| }, 1) | |
| }; | |
| b.callOnGetServerComponent = | |
| function() { | |
| window[ensightenOptions.ns].executionState.readyForServerComponent = !0; | |
| window[ensightenOptions.ns].testAll() | |
| }; | |
| b.hasDOMParsed = function() { | |
| return window[ensightenOptions.ns].executionState.DOMParsed | |
| }; | |
| b.hasDOMLoaded = function() { | |
| return window[ensightenOptions.ns].executionState.DOMLoaded | |
| }; | |
| b.hasPageSpecificCompletion = function() { | |
| return window[ensightenOptions.ns].executionState.conditionalRules | |
| }; | |
| var r = function() { | |
| var a = [], | |
| b = !1, | |
| d = !1; | |
| return { | |
| add: function(c) { | |
| b && !d ? c() : "function" == typeof c && (a[a.length] = | |
| c) | |
| }, | |
| exec: function() { | |
| d = !0; | |
| do { | |
| var c = a; | |
| a = []; | |
| b = !0; | |
| for (var e = 0; e < c.length; e++) try { | |
| c[e].call(window) | |
| } catch (g) { | |
| window[ensightenOptions.ns].reportException(g) | |
| } | |
| } while (0 < a.length); | |
| d = !1 | |
| }, | |
| haveRun: function() { | |
| return b | |
| } | |
| } | |
| }; | |
| b.new_fArray = function() { | |
| return r() | |
| }; | |
| e.timer = null; | |
| (function() { | |
| function a(a, b) { | |
| return function() { | |
| a.apply(b, arguments) | |
| } | |
| } | |
| window.console || (window.console = {}); | |
| var b = window.console; | |
| if (!b.log) | |
| if (window.log4javascript) { | |
| var d = log4javascript.getDefaultLogger(); | |
| b.log = a(d.info, d); | |
| b.debug = a(d.debug, d); | |
| b.info = | |
| a(d.info, d); | |
| b.warn = a(d.warn, d); | |
| b.error = a(d.error, d) | |
| } else b.log = function() {}; | |
| b.debug || (b.debug = b.log); | |
| b.info || (b.info = b.log); | |
| b.warn || (b.warn = b.log); | |
| b.error || (b.error = b.log) | |
| })(); | |
| document.addEventListener ? (-1 < navigator.userAgent.indexOf("AppleWebKit/") ? e.timer = window.setInterval(function() { | |
| /loaded|interactive|complete/.test(document.readyState) && (clearInterval(e.timer), b.callOnDOMParsed()) | |
| }, 50) : document.addEventListener("DOMContentLoaded", b.callOnDOMParsed, !1), window.addEventListener("load", b.callOnDOMLoaded, !1)) : (setTimeout(function() { | |
| var a = window.document; | |
| (function() { | |
| try { | |
| if (!document.body) throw "continue"; | |
| a.documentElement.doScroll("left") | |
| } catch (c) { | |
| setTimeout(arguments.callee, 15); | |
| return | |
| } | |
| window[ensightenOptions.ns].callOnDOMParsed() | |
| })() | |
| }, 1), window.attachEvent("onload", function() { | |
| window[ensightenOptions.ns].callOnDOMLoaded() | |
| })); | |
| document.readyState && "complete" === document.readyState && (b.executionState.DOMParsed = !0, b.executionState.DOMLoaded = !0); | |
| "true" === e.options.enableTagAuditBeacon && b.sampleBeacon() && | |
| window.setTimeout(function() { | |
| if (window[ensightenOptions.ns] && !window[ensightenOptions.ns].mobilePlatform) try { | |
| for (var a = [], c, d, h, l, g = 0; g < e.ruleList.length; ++g) d = e.ruleList[g], h = d.executionData.hasRun ? "1" : "0", l = d.deploymentId.toString() + "|" + d.id.toString() + "|" + h, a.push(l); | |
| c = "[" + a.join(";") + "]"; | |
| var m = window.location.protocol + "//" + e.nexus + "/" + encodeURIComponent(f.client) + "/" + encodeURIComponent(f.publishPath) + "/TagAuditBeacon.rnc?cid=" + encodeURIComponent(f.clientId) + "&data=" + c + "&idx=0&r=" + e.rand; | |
| b.imageRequest(m) | |
| } catch (q) { | |
| b.currentRuleId = -1, b.currentDeploymentId = -1, a = new e.BeaconException(q), window[ensightenOptions.ns].reportException(a) | |
| } | |
| }, 3E3); | |
| window.setInterval(b.testAll, e.options.interval); | |
| return b | |
| }(ensightenOptions); | |
| "true" === ensightenOptions.enablePagePerfBeacon && window[ensightenOptions.ns] && window[ensightenOptions.ns].sampleBeacon() && window[ensightenOptions.ns].bindDOMParsed(function() { | |
| if (!window[ensightenOptions.ns].mobilePlatform) { | |
| var f = window.performance; | |
| if (f) { | |
| f = f.timing || {}; | |
| var l = f.navigationStart || 0, | |
| m = { | |
| connectEnd: "ce", | |
| connectStart: "cs", | |
| domComplete: "dc", | |
| domContentLoadedEventEnd: "dclee", | |
| domContentLoadedEventStart: "dcles", | |
| domInteractive: "di", | |
| domLoading: "dl", | |
| domainLookupEnd: "dle", | |
| domainLookupStart: "dls", | |
| fetchStart: "fs", | |
| loadEventEnd: "lee", | |
| loadEventStart: "les", | |
| redirectEnd: "rede", | |
| redirectStart: "reds", | |
| requestStart: "reqs", | |
| responseStart: "resps", | |
| responseEnd: "respe", | |
| secureConnectionStart: "scs", | |
| unloadEventStart: "ues", | |
| unloadEventEnd: "uee" | |
| }; | |
| var n = "&ns=" + encodeURIComponent(f.navigationStart); | |
| for (var e in m) | |
| if (void 0 !== f[e]) { | |
| var b = f[e] - l; | |
| n += "&" + m[e] + "=" + (0 < b ? encodeURIComponent(b) : 0) | |
| } else n += "&" + m[e] + "=-1"; | |
| window[ensightenOptions.ns].timing = n; | |
| e = ensightenOptions.nexus || "nexus.ensighten.com"; | |
| f = ensightenOptions.staticJavascriptPath || | |
| ""; | |
| n = f.indexOf("/", 0); | |
| l = f.indexOf("/code/"); | |
| f = f.substring(n, l) + "/perf.rnc"; | |
| f += "?cid=" + encodeURIComponent(ensightenOptions.clientId) + window[ensightenOptions.ns].timing; | |
| window[ensightenOptions.ns].imageRequest("//" + e + f) | |
| } | |
| } | |
| }); | |
| Bootstrapper.dataDefinitionIds = []; | |
| Bootstrapper.bindImmediate(function() { | |
| var Bootstrapper = window["Bootstrapper"]; | |
| var ensightenOptions = Bootstrapper.ensightenOptions | |
| }, 2674012, 573553); | |
| Bootstrapper.bindDependencyImmediate(function() { | |
| var Bootstrapper = window["Bootstrapper"]; | |
| var ensightenOptions = Bootstrapper.ensightenOptions; | |
| ensClientConfig = { | |
| "info": { | |
| "name": "altair", | |
| "publishPath": "prod", | |
| "clientId": 2538, | |
| "nexus": "nexus.ensighten.com" | |
| }, | |
| "cookieTypes": ["Analytics", "Performance and Functionality", "Social Media"], | |
| "whitelist": { | |
| "default": [{ | |
| "tag": "hyperworks(\\.com\\.(br|mx)|\\.(fr|se))", | |
| "displayName": "Hyperworks" | |
| }, { | |
| "tag": "mediag.com", | |
| "displayName": "MediaG" | |
| }, { | |
| "tag": "slideslive.com", | |
| "displayName": "slideslive" | |
| }, { | |
| "tag": "altair(hyperworks|engineering)?((\\.com(\\.(cn|es))?)|(\\.de|\\-india\\.in|jp\\.co\\.jp|\\.co\\.(kr|za|uk)|\\.se|\\.it|\\.jp|\\.ca))", | |
| "displayName": "Altair" | |
| }, { | |
| "tag": "api.hubapi.com", | |
| "displayName": "Hubspot API" | |
| }, { | |
| "tag": "altairproductdesign.com", | |
| "displayName": "AltairProductDesign" | |
| }, { | |
| "tag": "thinklabs.com", | |
| "displayName": "Thinklab" | |
| }, { | |
| "tag": "pbs((grid)?works|professional)?(\\.com)?\\.(au|br|ca|cn|fr|de|in|it|jp|co\\.(kr|uk)|se|com)", | |
| "displayName": "PBS" | |
| }, { | |
| "tag": "solidthinking\\.(com|fr|jp|co\\.kr)", | |
| "displayName": "SolidThinking" | |
| }, { | |
| "tag": "ensighten\\.com", | |
| "displayName": "Ensighten" | |
| }], | |
| "Analytics": [{ | |
| "tag": "\\.google-analytics\\.com", | |
| "displayName": "Google Analytics" | |
| }, { | |
| "tag": "(googletagmanager\\.com)|(tagmanager.google.com)", | |
| "displayName": "Google Tag Manager" | |
| }, { | |
| "tag": "doubleclick.net", | |
| "displayName": "DoubleClick" | |
| }, { | |
| "tag": "wiredminds\\.de", | |
| "displayName": "WiredMinds" | |
| }], | |
| "Performance and Functionality": [{ | |
| "tag": "youtube.com", | |
| "displayName": "YouTube" | |
| }, { | |
| "tag": "(hs\\-scripts|hsforms|hubspot)\\.(com|net)", | |
| "displayName": "HubSpot" | |
| }, { | |
| "tag": "mailchimp.com", | |
| "displayName": "MailChimp" | |
| }, { | |
| "tag": "wistia\\.com|wistia\\.net|embedwistia", | |
| "displayName": "Wistia" | |
| }, { | |
| "tag": "hellobar.com", | |
| "displayName": "hellobar" | |
| }], | |
| "Social Media": [{ | |
| "tag": "twitter\\.com", | |
| "displayName": "Twitter Conversion Tracking" | |
| }, { | |
| "tag": "facebook\\.com|facebook\\.net", | |
| "displayName": "Facebook Custom Audiences" | |
| }, { | |
| "tag": "(linkedin|licdn)\\.com", | |
| "displayName": "LinkedIn Widget" | |
| }] | |
| }, | |
| "defaultEnv": "", | |
| "featureToggles": { | |
| "enableReporting": true, | |
| "enableAllowedDomainsReporting": false, | |
| "enableFiltering": true, | |
| "enablePrivacyNotice": true, | |
| "enableConsentModal": true, | |
| "showTrustedDomains": false, | |
| "requireSSL": false, | |
| "enableEnvironmentMatching": false, | |
| "enableDataMonitoring": false, | |
| "usesWhitelist": true, | |
| "consentWidget": false | |
| }, | |
| "libraryPackage": "enterprise", | |
| "dataMonitoring": { | |
| "mode": "block", | |
| "blockURLParamsRegex": [], | |
| "domainsAllowed": [] | |
| }, | |
| "environmentConfigs": [{ | |
| "name": "aTest", | |
| "countryCode": "ad", | |
| "languageCode": "ab-AD", | |
| "condition": { | |
| "type": "url", | |
| "key": "", | |
| "value": "privTest\x3dtrue", | |
| "shouldBePositive": true, | |
| "operator": "contains" | |
| }, | |
| "optVals": { | |
| "Social Media": 0, | |
| "Performance and Functionality": 0, | |
| "Analytics": 0 | |
| }, | |
| "translation": { | |
| "notificationBannerContent": 'Data protection regulations are changing for the better and we need your consent to collect data through the use of cookies. You are free to change your mind later and can opt-in at any time. {{Click here}} to see your cookie preferences.\n\nIf you are interested in learning more about how we handle your data, please take a look at Altair\u2019s \x3ca href\x3d"https://www.altair.com/popup_privacy.htm"\x3edata usage policy here\x3c/a\x3e.', | |
| "consentTitle": "CUSTOMIZE COOKIE SETTINGS", | |
| "consentDescription": "\x26nbsp;", | |
| "save": "Save", | |
| "cancel": "Cancel", | |
| "close": "I Understand", | |
| "cookies": { | |
| "Analytics": { | |
| "title": "Analytics", | |
| "description": "These technologies collect information that is used in aggregate form to help us understand how our websites are being used are being used or to help us continuously improve our websites." | |
| }, | |
| "Performance and Functionality": { | |
| "title": "Performance and Functionality", | |
| "description": "These technologies are used to enhance the performance and functionality of our websites but are non-essential to their use. However, without these cookies, certain functionality may become unavailable." | |
| }, | |
| "Social Media": { | |
| "title": "Social Media", | |
| "description": "These technologies are used to enable you to share pages and content that you find interesting on our websites through third party social networking and other websites." | |
| } | |
| } | |
| } | |
| }, { | |
| "name": "Not EU", | |
| "countryCode": "ca", | |
| "languageCode": "en-CA", | |
| "condition": { | |
| "type": "jsVar", | |
| "key": "isEU", | |
| "value": "false", | |
| "shouldBePositive": true, | |
| "operator": "contains", | |
| "_or": { | |
| "type": "url", | |
| "key": "", | |
| "value": "privTest\x3dtrue", | |
| "shouldBePositive": true, | |
| "operator": "contains" | |
| } | |
| }, | |
| "optVals": { | |
| "Social Media": 1, | |
| "Performance and Functionality": 1, | |
| "Analytics": 1 | |
| }, | |
| "translation": { | |
| "notificationBannerContent": 'Data protection regulations are changing for the better and we need your consent to collect data through the use of cookies. You are free to change your mind later and can opt-in at any time. {{Click here}} to see your cookie preferences.\n\nIf you are interested in learning more about how we handle your data, please take a look at Altair\u2019s \x3ca href\x3d"https://www.altair.com/popup_privacy.htm"\x3edata usage policy here\x3c/a\x3e.', | |
| "consentTitle": "CUSTOMIZE COOKIE SETTINGS", | |
| "consentDescription": "\x26nbsp;", | |
| "save": "Save", | |
| "cancel": "Cancel", | |
| "close": "I Understand", | |
| "cookies": { | |
| "Analytics": { | |
| "title": "Analytics", | |
| "description": "These technologies collect information that is used in aggregate form to help us understand how our websites are being used are being used or to help us continuously improve our websites." | |
| }, | |
| "Performance and Functionality": { | |
| "title": "Performance and Functionality", | |
| "description": "These technologies are used to enhance the performance and functionality of our websites but are non-essential to their use. However, without these cookies, certain functionality may become unavailable." | |
| }, | |
| "Social Media": { | |
| "title": "Social Media", | |
| "description": "These technologies are used to enable you to share pages and content that you find interesting on our websites through third party social networking and other websites." | |
| } | |
| } | |
| } | |
| }, { | |
| "name": "EU", | |
| "countryCode": "de", | |
| "languageCode": "de-DE", | |
| "condition": { | |
| "type": "jsVar", | |
| "key": "isEU", | |
| "value": "true", | |
| "shouldBePositive": true, | |
| "operator": "contains" | |
| }, | |
| "optVals": { | |
| "Social Media": 0, | |
| "Performance and Functionality": 1, | |
| "Analytics": 0 | |
| }, | |
| "translation": { | |
| "notificationBannerContent": 'Data protection regulations are changing for the better and we need your consent to collect data through the use of cookies. You are free to change your mind later and can opt-in at any time. {{Click here}} to see your cookie preferences.\n\nIf you are interested in learning more about how we handle your data, please take a look at Altair\u2019s \x3ca href\x3d"https://www.altair.com/popup_privacy.htm"\x3edata usage policy here\x3c/a\x3e.', | |
| "consentTitle": "CUSTOMIZE COOKIE SETTINGS", | |
| "consentDescription": "\x26nbsp;", | |
| "save": "Save", | |
| "cancel": "Cancel", | |
| "close": "I Understand", | |
| "cookies": { | |
| "Analytics": { | |
| "title": "Analytics", | |
| "description": "These technologies collect information that is used in aggregate form to help us understand how our websites are being used are being used or to help us continuously improve our websites." | |
| }, | |
| "Performance and Functionality": { | |
| "title": "Performance and Functionality", | |
| "description": "These technologies are used to enhance the performance and functionality of our websites but are non-essential to their use. However, without these cookies, certain functionality may become unavailable." | |
| }, | |
| "Social Media": { | |
| "title": "Social Media", | |
| "description": "These technologies are used to enable you to share pages and content that you find interesting on our websites through third party social networking and other websites." | |
| } | |
| } | |
| } | |
| }] | |
| }; | |
| if (Bootstrapper.ensightenOptions.publishPath) ensClientConfig.info.publishPath = Bootstrapper.ensightenOptions.publishPath; | |
| if (Bootstrapper.ensightenOptions.nexus) ensClientConfig.info.nexus = Bootstrapper.ensightenOptions.nexus | |
| }, 2697112, [2484092], 544086, [544085]); | |
| Bootstrapper.bindImmediate(function() { | |
| var Bootstrapper = window["Bootstrapper"]; | |
| var ensightenOptions = Bootstrapper.ensightenOptions; | |
| var euArr = ["Austria", "Italy", "Belgium", "Latvia", "Bulgaria", "Lithuania", "Croatia", "Luxembourg", "Cyprus", "Malta", "Czech Republic", "Netherlands", "Denmark", "Poland", "Estonia", "Portugal", "Finland", "Romania", "France", "Slovakia", "Germany", "Slovenia", "Greece", "Spain", "Hungary", "Sweden", "Ireland", "United Kingdom", "Switzerland"]; | |
| window.isEU = "false"; | |
| if (document.cookie.match(/user_country.*/i) && | |
| euArr.indexOf(document.cookie.match(/user_country.*/i)[0].replace(/user_country\=/i, "")) > -1) window.isEU = "true" | |
| }, 2484092, 544085); | |
| Bootstrapper.bindDependencyImmediate(function() { | |
| var Bootstrapper = window["Bootstrapper"]; | |
| var ensightenOptions = Bootstrapper.ensightenOptions; | |
| window.MutationObserver = window.MutationObserver || function(w) { | |
| function v(a) { | |
| this.i = []; | |
| this.m = a | |
| } | |
| function I(a) { | |
| (function c() { | |
| var d = a.takeRecords(); | |
| d.length && a.m(d, a); | |
| a.h = setTimeout(c, v._period) | |
| })() | |
| } | |
| function p(a) { | |
| var b = { | |
| type: null, | |
| target: null, | |
| addedNodes: [], | |
| removedNodes: [], | |
| previousSibling: null, | |
| nextSibling: null, | |
| attributeName: null, | |
| attributeNamespace: null, | |
| oldValue: null | |
| }, | |
| c; | |
| for (c in a) b[c] !== w && a[c] !== w && (b[c] = a[c]); | |
| return b | |
| } | |
| function J(a, b) { | |
| var c = C(a, b); | |
| return function(d) { | |
| var f = d.length, | |
| n; | |
| b.a && 3 === a.nodeType && a.nodeValue !== c.a && d.push(new p({ | |
| type: "characterData", | |
| target: a, | |
| oldValue: c.a | |
| })); | |
| b.b && c.b && A(d, a, c.b, b.f); | |
| if (b.c || b.g) n = K(d, a, c, b); | |
| if (n || d.length !== f) c = C(a, b) | |
| } | |
| } | |
| function L(a, b) { | |
| return b.value | |
| } | |
| function M(a, b) { | |
| return "style" !== b.name ? b.value : a.style.cssText | |
| } | |
| function A(a, b, c, d) { | |
| for (var f = {}, n = b.attributes, k, g, x = n.length; x--;) k = n[x], g = k.name, d && d[g] === w || (D(b, k) !== c[g] && | |
| a.push(p({ | |
| type: "attributes", | |
| target: b, | |
| attributeName: g, | |
| oldValue: c[g], | |
| attributeNamespace: k.namespaceURI | |
| })), f[g] = !0); | |
| for (g in c) f[g] || a.push(p({ | |
| target: b, | |
| type: "attributes", | |
| attributeName: g, | |
| oldValue: c[g] | |
| })) | |
| } | |
| function K(a, b, c, d) { | |
| function f(b, c, f, k, y) { | |
| var g = b.length - 1; | |
| y = -~((g - y) / 2); | |
| for (var h, l, e; e = b.pop();) h = f[e.j], l = k[e.l], d.c && y && Math.abs(e.j - e.l) >= g && (a.push(p({ | |
| type: "childList", | |
| target: c, | |
| addedNodes: [h], | |
| removedNodes: [h], | |
| nextSibling: h.nextSibling, | |
| previousSibling: h.previousSibling | |
| })), y--), d.b && l.b && A(a, h, l.b, | |
| d.f), d.a && 3 === h.nodeType && h.nodeValue !== l.a && a.push(p({ | |
| type: "characterData", | |
| target: h, | |
| oldValue: l.a | |
| })), d.g && n(h, l) | |
| } | |
| function n(b, c) { | |
| for (var g = b.childNodes, q = c.c, x = g.length, v = q ? q.length : 0, h, l, e, m, t, z = 0, u = 0, r = 0; u < x || r < v;) m = g[u], t = (e = q[r]) && e.node, m === t ? (d.b && e.b && A(a, m, e.b, d.f), d.a && e.a !== w && m.nodeValue !== e.a && a.push(p({ | |
| type: "characterData", | |
| target: m, | |
| oldValue: e.a | |
| })), l && f(l, b, g, q, z), d.g && (m.childNodes.length || e.c && e.c.length) && n(m, e), u++, r++) : (k = !0, h || (h = {}, l = []), m && (h[e = E(m)] || (h[e] = !0, -1 === (e = F(q, m, r, | |
| "node")) ? d.c && (a.push(p({ | |
| type: "childList", | |
| target: b, | |
| addedNodes: [m], | |
| nextSibling: m.nextSibling, | |
| previousSibling: m.previousSibling | |
| })), z++) : l.push({ | |
| j: u, | |
| l: e | |
| })), u++), t && t !== g[u] && (h[e = E(t)] || (h[e] = !0, -1 === (e = F(g, t, u)) ? d.c && (a.push(p({ | |
| type: "childList", | |
| target: c.node, | |
| removedNodes: [t], | |
| nextSibling: q[r + 1], | |
| previousSibling: q[r - 1] | |
| })), z--) : l.push({ | |
| j: e, | |
| l: r | |
| })), r++)); | |
| l && f(l, b, g, q, z) | |
| } | |
| var k; | |
| n(b, c); | |
| return k | |
| } | |
| function C(a, b) { | |
| var c = !0; | |
| return function f(a) { | |
| var k = { | |
| node: a | |
| }; | |
| !b.a || 3 !== a.nodeType && 8 !== a.nodeType ? (b.b && c && 1 === a.nodeType && | |
| (k.b = G(a.attributes, function(c, f) { | |
| if (!b.f || b.f[f.name]) c[f.name] = D(a, f); | |
| return c | |
| })), c && (b.c || b.a || b.b && b.g) && (k.c = N(a.childNodes, f)), c = b.g) : k.a = a.nodeValue; | |
| return k | |
| }(a) | |
| } | |
| function E(a) { | |
| try { | |
| return a.id || (a.mo_id = a.mo_id || H++) | |
| } catch (b) { | |
| try { | |
| return a.nodeValue | |
| } catch (c) { | |
| return H++ | |
| } | |
| } | |
| } | |
| function N(a, b) { | |
| for (var c = [], d = 0; d < a.length; d++) c[d] = b(a[d], d, a); | |
| return c | |
| } | |
| function G(a, b) { | |
| for (var c = {}, d = 0; d < a.length; d++) c = b(c, a[d], d, a); | |
| return c | |
| } | |
| function F(a, b, c, d) { | |
| for (; c < a.length; c++) | |
| if ((d ? a[c][d] : a[c]) === b) return c; | |
| return -1 | |
| } | |
| v._period = 30; | |
| v.prototype = { | |
| observe: function(a, b) { | |
| for (var c = { | |
| b: !!(b.attributes || b.attributeFilter || b.attributeOldValue), | |
| c: !!b.childList, | |
| g: !!b.subtree, | |
| a: !(!b.characterData && !b.characterDataOldValue) | |
| }, d = this.i, f = 0; f < d.length; f++) d[f].s === a && d.splice(f, 1); | |
| b.attributeFilter && (c.f = G(b.attributeFilter, function(a, b) { | |
| a[b] = !0; | |
| return a | |
| })); | |
| d.push({ | |
| s: a, | |
| o: J(a, c) | |
| }); | |
| this.h || I(this) | |
| }, | |
| takeRecords: function() { | |
| for (var a = [], b = this.i, c = 0; c < b.length; c++) b[c].o(a); | |
| return a | |
| }, | |
| disconnect: function() { | |
| this.i = []; | |
| clearTimeout(this.h); | |
| this.h = null | |
| } | |
| }; | |
| var B = document.createElement("i"); | |
| B.style.top = 0; | |
| var D = (B = "null" != B.attributes.style.value) ? L : M, | |
| H = 1; | |
| return v | |
| }(void 0); | |
| var LZString = function() { | |
| var f = String.fromCharCode; | |
| var keyStrBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d"; | |
| var keyStrUriSafe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$"; | |
| var baseReverseDic = {}; | |
| function getBaseValue(alphabet, character) { | |
| if (!baseReverseDic[alphabet]) { | |
| baseReverseDic[alphabet] = {}; | |
| for (var i = 0; i < alphabet.length; i++) baseReverseDic[alphabet][alphabet.charAt(i)] = | |
| i | |
| } | |
| return baseReverseDic[alphabet][character] | |
| } | |
| var LZString = { | |
| compressToBase64: function(input) { | |
| if (input == null) return ""; | |
| var res = LZString._compress(input, 6, function(a) { | |
| return keyStrBase64.charAt(a) | |
| }); | |
| switch (res.length % 4) { | |
| default: | |
| case 0: | |
| return res; | |
| case 1: | |
| return res + "\x3d\x3d\x3d"; | |
| case 2: | |
| return res + "\x3d\x3d"; | |
| case 3: | |
| return res + "\x3d" | |
| } | |
| }, | |
| decompressFromBase64: function(input) { | |
| if (input == null) return ""; | |
| if (input == "") return null; | |
| return LZString._decompress(input.length, 32, function(index) { | |
| return getBaseValue(keyStrBase64, | |
| input.charAt(index)) | |
| }) | |
| }, | |
| compressToUTF16: function(input) { | |
| if (input == null) return ""; | |
| return LZString._compress(input, 15, function(a) { | |
| return f(a + 32) | |
| }) + " " | |
| }, | |
| decompressFromUTF16: function(compressed) { | |
| if (compressed == null) return ""; | |
| if (compressed == "") return null; | |
| return LZString._decompress(compressed.length, 16384, function(index) { | |
| return compressed.charCodeAt(index) - 32 | |
| }) | |
| }, | |
| compressToUint8Array: function(uncompressed) { | |
| var compressed = LZString.compress(uncompressed); | |
| var buf = new Uint8Array(compressed.length * 2); | |
| for (var i = | |
| 0, TotalLen = compressed.length; i < TotalLen; i++) { | |
| var current_value = compressed.charCodeAt(i); | |
| buf[i * 2] = current_value >>> 8; | |
| buf[i * 2 + 1] = current_value % 256 | |
| } | |
| return buf | |
| }, | |
| decompressFromUint8Array: function(compressed) { | |
| if (compressed === null || compressed === undefined) return LZString.decompress(compressed); | |
| else { | |
| var buf = new Array(compressed.length / 2); | |
| for (var i = 0, TotalLen = buf.length; i < TotalLen; i++) buf[i] = compressed[i * 2] * 256 + compressed[i * 2 + 1]; | |
| var result = []; | |
| buf.forEach(function(c) { | |
| result.push(f(c)) | |
| }); | |
| return LZString.decompress(result.join("")) | |
| } | |
| }, | |
| compressToEncodedURIComponent: function(input) { | |
| if (input == null) return ""; | |
| return LZString._compress(input, 6, function(a) { | |
| return keyStrUriSafe.charAt(a) | |
| }) | |
| }, | |
| decompressFromEncodedURIComponent: function(input) { | |
| if (input == null) return ""; | |
| if (input == "") return null; | |
| input = input.replace(/ /g, "+"); | |
| return LZString._decompress(input.length, 32, function(index) { | |
| return getBaseValue(keyStrUriSafe, input.charAt(index)) | |
| }) | |
| }, | |
| compress: function(uncompressed) { | |
| return LZString._compress(uncompressed, 16, function(a) { | |
| return f(a) | |
| }) | |
| }, | |
| _compress: function(uncompressed, | |
| bitsPerChar, getCharFromInt) { | |
| if (uncompressed == null) return ""; | |
| var i, value, context_dictionary = {}, | |
| context_dictionaryToCreate = {}, | |
| context_c = "", | |
| context_wc = "", | |
| context_w = "", | |
| context_enlargeIn = 2, | |
| context_dictSize = 3, | |
| context_numBits = 2, | |
| context_data = [], | |
| context_data_val = 0, | |
| context_data_position = 0, | |
| ii; | |
| for (ii = 0; ii < uncompressed.length; ii += 1) { | |
| context_c = uncompressed.charAt(ii); | |
| if (!Object.prototype.hasOwnProperty.call(context_dictionary, context_c)) { | |
| context_dictionary[context_c] = context_dictSize++; | |
| context_dictionaryToCreate[context_c] = | |
| true | |
| } | |
| context_wc = context_w + context_c; | |
| if (Object.prototype.hasOwnProperty.call(context_dictionary, context_wc)) context_w = context_wc; | |
| else { | |
| if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) { | |
| if (context_w.charCodeAt(0) < 256) { | |
| for (i = 0; i < context_numBits; i++) { | |
| context_data_val = context_data_val << 1; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data_position = 0; | |
| context_data.push(getCharFromInt(context_data_val)); | |
| context_data_val = 0 | |
| } else context_data_position++ | |
| } | |
| value = context_w.charCodeAt(0); | |
| for (i = 0; i < 8; i++) { | |
| context_data_val = context_data_val << 1 | value & 1; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data_position = 0; | |
| context_data.push(getCharFromInt(context_data_val)); | |
| context_data_val = 0 | |
| } else context_data_position++; | |
| value = value >> 1 | |
| } | |
| } else { | |
| value = 1; | |
| for (i = 0; i < context_numBits; i++) { | |
| context_data_val = context_data_val << 1 | value; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data_position = 0; | |
| context_data.push(getCharFromInt(context_data_val)); | |
| context_data_val = 0 | |
| } else context_data_position++; | |
| value = | |
| 0 | |
| } | |
| value = context_w.charCodeAt(0); | |
| for (i = 0; i < 16; i++) { | |
| context_data_val = context_data_val << 1 | value & 1; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data_position = 0; | |
| context_data.push(getCharFromInt(context_data_val)); | |
| context_data_val = 0 | |
| } else context_data_position++; | |
| value = value >> 1 | |
| } | |
| } | |
| context_enlargeIn--; | |
| if (context_enlargeIn == 0) { | |
| context_enlargeIn = Math.pow(2, context_numBits); | |
| context_numBits++ | |
| } | |
| delete context_dictionaryToCreate[context_w] | |
| } else { | |
| value = context_dictionary[context_w]; | |
| for (i = 0; i < context_numBits; i++) { | |
| context_data_val = | |
| context_data_val << 1 | value & 1; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data_position = 0; | |
| context_data.push(getCharFromInt(context_data_val)); | |
| context_data_val = 0 | |
| } else context_data_position++; | |
| value = value >> 1 | |
| } | |
| } | |
| context_enlargeIn--; | |
| if (context_enlargeIn == 0) { | |
| context_enlargeIn = Math.pow(2, context_numBits); | |
| context_numBits++ | |
| } | |
| context_dictionary[context_wc] = context_dictSize++; | |
| context_w = String(context_c) | |
| } | |
| } | |
| if (context_w !== "") { | |
| if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) { | |
| if (context_w.charCodeAt(0) < | |
| 256) { | |
| for (i = 0; i < context_numBits; i++) { | |
| context_data_val = context_data_val << 1; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data_position = 0; | |
| context_data.push(getCharFromInt(context_data_val)); | |
| context_data_val = 0 | |
| } else context_data_position++ | |
| } | |
| value = context_w.charCodeAt(0); | |
| for (i = 0; i < 8; i++) { | |
| context_data_val = context_data_val << 1 | value & 1; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data_position = 0; | |
| context_data.push(getCharFromInt(context_data_val)); | |
| context_data_val = 0 | |
| } else context_data_position++; | |
| value = | |
| value >> 1 | |
| } | |
| } else { | |
| value = 1; | |
| for (i = 0; i < context_numBits; i++) { | |
| context_data_val = context_data_val << 1 | value; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data_position = 0; | |
| context_data.push(getCharFromInt(context_data_val)); | |
| context_data_val = 0 | |
| } else context_data_position++; | |
| value = 0 | |
| } | |
| value = context_w.charCodeAt(0); | |
| for (i = 0; i < 16; i++) { | |
| context_data_val = context_data_val << 1 | value & 1; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data_position = 0; | |
| context_data.push(getCharFromInt(context_data_val)); | |
| context_data_val = 0 | |
| } else context_data_position++; | |
| value = value >> 1 | |
| } | |
| } | |
| context_enlargeIn--; | |
| if (context_enlargeIn == 0) { | |
| context_enlargeIn = Math.pow(2, context_numBits); | |
| context_numBits++ | |
| } | |
| delete context_dictionaryToCreate[context_w] | |
| } else { | |
| value = context_dictionary[context_w]; | |
| for (i = 0; i < context_numBits; i++) { | |
| context_data_val = context_data_val << 1 | value & 1; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data_position = 0; | |
| context_data.push(getCharFromInt(context_data_val)); | |
| context_data_val = 0 | |
| } else context_data_position++; | |
| value = value >> 1 | |
| } | |
| } | |
| context_enlargeIn--; | |
| if (context_enlargeIn == | |
| 0) { | |
| context_enlargeIn = Math.pow(2, context_numBits); | |
| context_numBits++ | |
| } | |
| } | |
| value = 2; | |
| for (i = 0; i < context_numBits; i++) { | |
| context_data_val = context_data_val << 1 | value & 1; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data_position = 0; | |
| context_data.push(getCharFromInt(context_data_val)); | |
| context_data_val = 0 | |
| } else context_data_position++; | |
| value = value >> 1 | |
| } | |
| while (true) { | |
| context_data_val = context_data_val << 1; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data.push(getCharFromInt(context_data_val)); | |
| break | |
| } else context_data_position++ | |
| } | |
| return context_data.join("") | |
| }, | |
| decompress: function(compressed) { | |
| if (compressed == null) return ""; | |
| if (compressed == "") return null; | |
| return LZString._decompress(compressed.length, 32768, function(index) { | |
| return compressed.charCodeAt(index) | |
| }) | |
| }, | |
| _decompress: function(length, resetValue, getNextValue) { | |
| var dictionary = [], | |
| next, enlargeIn = 4, | |
| dictSize = 4, | |
| numBits = 3, | |
| entry = "", | |
| result = [], | |
| i, w, bits, resb, maxpower, power, c, data = { | |
| val: getNextValue(0), | |
| position: resetValue, | |
| index: 1 | |
| }; | |
| for (i = 0; i < 3; i += 1) dictionary[i] = i; | |
| bits = 0; | |
| maxpower = Math.pow(2, 2); | |
| power = 1; | |
| while (power != maxpower) { | |
| resb = | |
| data.val & data.position; | |
| data.position >>= 1; | |
| if (data.position == 0) { | |
| data.position = resetValue; | |
| data.val = getNextValue(data.index++) | |
| } | |
| bits |= (resb > 0 ? 1 : 0) * power; | |
| power <<= 1 | |
| } | |
| switch (next = bits) { | |
| case 0: | |
| bits = 0; | |
| maxpower = Math.pow(2, 8); | |
| power = 1; | |
| while (power != maxpower) { | |
| resb = data.val & data.position; | |
| data.position >>= 1; | |
| if (data.position == 0) { | |
| data.position = resetValue; | |
| data.val = getNextValue(data.index++) | |
| } | |
| bits |= (resb > 0 ? 1 : 0) * power; | |
| power <<= 1 | |
| } | |
| c = f(bits); | |
| break; | |
| case 1: | |
| bits = 0; | |
| maxpower = Math.pow(2, 16); | |
| power = 1; | |
| while (power != maxpower) { | |
| resb = data.val & | |
| data.position; | |
| data.position >>= 1; | |
| if (data.position == 0) { | |
| data.position = resetValue; | |
| data.val = getNextValue(data.index++) | |
| } | |
| bits |= (resb > 0 ? 1 : 0) * power; | |
| power <<= 1 | |
| } | |
| c = f(bits); | |
| break; | |
| case 2: | |
| return "" | |
| } | |
| dictionary[3] = c; | |
| w = c; | |
| result.push(c); | |
| while (true) { | |
| if (data.index > length) return ""; | |
| bits = 0; | |
| maxpower = Math.pow(2, numBits); | |
| power = 1; | |
| while (power != maxpower) { | |
| resb = data.val & data.position; | |
| data.position >>= 1; | |
| if (data.position == 0) { | |
| data.position = resetValue; | |
| data.val = getNextValue(data.index++) | |
| } | |
| bits |= (resb > 0 ? 1 : 0) * power; | |
| power <<= 1 | |
| } | |
| switch (c = bits) { | |
| case 0: | |
| bits = | |
| 0; | |
| maxpower = Math.pow(2, 8); | |
| power = 1; | |
| while (power != maxpower) { | |
| resb = data.val & data.position; | |
| data.position >>= 1; | |
| if (data.position == 0) { | |
| data.position = resetValue; | |
| data.val = getNextValue(data.index++) | |
| } | |
| bits |= (resb > 0 ? 1 : 0) * power; | |
| power <<= 1 | |
| } | |
| dictionary[dictSize++] = f(bits); | |
| c = dictSize - 1; | |
| enlargeIn--; | |
| break; | |
| case 1: | |
| bits = 0; | |
| maxpower = Math.pow(2, 16); | |
| power = 1; | |
| while (power != maxpower) { | |
| resb = data.val & data.position; | |
| data.position >>= 1; | |
| if (data.position == 0) { | |
| data.position = resetValue; | |
| data.val = getNextValue(data.index++) | |
| } | |
| bits |= (resb > 0 ? 1 : 0) * power; | |
| power <<= 1 | |
| } | |
| dictionary[dictSize++] = f(bits); | |
| c = dictSize - 1; | |
| enlargeIn--; | |
| break; | |
| case 2: | |
| return result.join("") | |
| } | |
| if (enlargeIn == 0) { | |
| enlargeIn = Math.pow(2, numBits); | |
| numBits++ | |
| } | |
| if (dictionary[c]) entry = dictionary[c]; | |
| else if (c === dictSize) entry = w + w.charAt(0); | |
| else return null; | |
| result.push(entry); | |
| dictionary[dictSize++] = w + entry.charAt(0); | |
| enlargeIn--; | |
| w = entry; | |
| if (enlargeIn == 0) { | |
| enlargeIn = Math.pow(2, numBits); | |
| numBits++ | |
| } | |
| } | |
| } | |
| }; | |
| return LZString | |
| }(); | |
| if (typeof define === "function" && define.amd) define("LZString", function() { | |
| return LZString | |
| }); | |
| else if (typeof module !== "undefined" && module != null) module.exports = LZString; | |
| else if (typeof angular !== "undefined" && angular != null) angular.module("LZString", []).factory("LZString", function() { | |
| return LZString | |
| }); | |
| (function(global) { | |
| var checkIfIteratorIsSupported = function() { | |
| try { | |
| return !!Symbol.iterator | |
| } catch (error) { | |
| return false | |
| } | |
| }; | |
| var iteratorSupported = checkIfIteratorIsSupported(); | |
| var createIterator = function(items) { | |
| var iterator = { | |
| next: function() { | |
| var value = items.shift(); | |
| return { | |
| done: value === void 0, | |
| value: value | |
| } | |
| } | |
| }; | |
| if (iteratorSupported) iterator[Symbol.iterator] = function() { | |
| return iterator | |
| }; | |
| return iterator | |
| }; | |
| var serializeParam = function(value) { | |
| return encodeURIComponent(value).replace(/%20/g, "+") | |
| }; | |
| var deserializeParam = function(value) { | |
| return decodeURIComponent(value).replace(/\+/g, " ") | |
| }; | |
| var polyfillURLSearchParams = function() { | |
| var URLSearchParams = function(searchString) { | |
| Object.defineProperty(this, "_entries", { | |
| value: {} | |
| }); | |
| if (typeof searchString === "string") { | |
| if (searchString !== "") { | |
| searchString = searchString.replace(/^\?/, ""); | |
| var attributes = searchString.split("\x26"); | |
| var attribute; | |
| for (var i = 0; i < attributes.length; i++) { | |
| attribute = attributes[i].split("\x3d"); | |
| this.append(deserializeParam(attribute[0]), attribute.length > 1 ? deserializeParam(attribute[1]) : "") | |
| } | |
| } | |
| } else if (searchString instanceof URLSearchParams) { | |
| var _this = this; | |
| searchString.forEach(function(value, name) { | |
| _this.append(value, name) | |
| }) | |
| } | |
| }; | |
| var proto = URLSearchParams.prototype; | |
| proto.append = function(name, value) { | |
| if (name in this._entries) this._entries[name].push(value.toString()); | |
| else this._entries[name] = [value.toString()] | |
| }; | |
| proto.delete = function(name) { | |
| delete this._entries[name] | |
| }; | |
| proto.get = function(name) { | |
| return name in this._entries ? this._entries[name][0] : null | |
| }; | |
| proto.getAll = function(name) { | |
| return name in this._entries ? this._entries[name].slice(0) : [] | |
| }; | |
| proto.has = function(name) { | |
| return name in this._entries | |
| }; | |
| proto.set = function(name, value) { | |
| this._entries[name] = [value.toString()] | |
| }; | |
| proto.forEach = function(callback, thisArg) { | |
| var entries; | |
| for (var name in this._entries) | |
| if (this._entries.hasOwnProperty(name)) { | |
| entries = | |
| this._entries[name]; | |
| for (var i = 0; i < entries.length; i++) callback.call(thisArg, entries[i], name, this) | |
| } | |
| }; | |
| proto.keys = function() { | |
| var items = []; | |
| this.forEach(function(value, name) { | |
| items.push(name) | |
| }); | |
| return createIterator(items) | |
| }; | |
| proto.values = function() { | |
| var items = []; | |
| this.forEach(function(value) { | |
| items.push(value) | |
| }); | |
| return createIterator(items) | |
| }; | |
| proto.entries = function() { | |
| var items = []; | |
| this.forEach(function(value, name) { | |
| items.push([name, value]) | |
| }); | |
| return createIterator(items) | |
| }; | |
| if (iteratorSupported) proto[Symbol.iterator] = | |
| proto.entries; | |
| proto.toString = function() { | |
| var searchArray = []; | |
| this.forEach(function(value, name) { | |
| searchArray.push(serializeParam(name) + "\x3d" + serializeParam(value)) | |
| }); | |
| return searchArray.join("\x26") | |
| }; | |
| global.URLSearchParams = URLSearchParams | |
| }; | |
| if (!("URLSearchParams" in global) || (new URLSearchParams("?a\x3d1")).toString() !== "a\x3d1") polyfillURLSearchParams() | |
| })(typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : this); | |
| (function(global) { | |
| var checkIfURLIsSupported = | |
| function() { | |
| try { | |
| var u = new URL("b", "http://a"); | |
| u.pathname = "c%20d"; | |
| return u.href === "http://a/c%20d" && u.searchParams | |
| } catch (e) { | |
| return false | |
| } | |
| }; | |
| var polyfillURL = function() { | |
| var _URL = global.URL; | |
| var URL = function(url, base) { | |
| if (typeof url !== "string") url = String(url); | |
| var doc = document, | |
| baseElement; | |
| if (base && (global.location === void 0 || base !== global.location.href)) { | |
| doc = document.implementation.createHTMLDocument(""); | |
| baseElement = doc.createElement("base"); | |
| baseElement.href = base; | |
| doc.head.appendChild(baseElement); | |
| try { | |
| if (baseElement.href.indexOf(base) !== | |
| 0) throw new Error(baseElement.href); | |
| } catch (err) { | |
| throw new Error("URL unable to set base " + base + " due to " + err); | |
| } | |
| } | |
| var anchorElement = doc.createElement("a"); | |
| anchorElement.href = url; | |
| if (baseElement) { | |
| doc.body.appendChild(anchorElement); | |
| anchorElement.href = anchorElement.href | |
| } | |
| if (anchorElement.protocol === ":" || !/:/.test(anchorElement.href)) throw new TypeError("Invalid URL"); | |
| Object.defineProperty(this, "_anchorElement", { | |
| value: anchorElement | |
| }) | |
| }; | |
| var proto = URL.prototype; | |
| var linkURLWithAnchorAttribute = function(attributeName) { | |
| Object.defineProperty(proto, | |
| attributeName, { | |
| get: function() { | |
| return this._anchorElement[attributeName] | |
| }, | |
| set: function(value) { | |
| this._anchorElement[attributeName] = value | |
| }, | |
| enumerable: true | |
| }) | |
| }; | |
| ["hash", "host", "hostname", "port", "protocol", "search"].forEach(function(attributeName) { | |
| linkURLWithAnchorAttribute(attributeName) | |
| }); | |
| Object.defineProperties(proto, { | |
| "toString": { | |
| get: function() { | |
| var _this = this; | |
| return function() { | |
| return _this.href | |
| } | |
| } | |
| }, | |
| "href": { | |
| get: function() { | |
| return this._anchorElement.href.replace(/\?$/, "") | |
| }, | |
| set: function(value) { | |
| this._anchorElement.href = | |
| value | |
| }, | |
| enumerable: true | |
| }, | |
| "pathname": { | |
| get: function() { | |
| return this._anchorElement.pathname.replace(/(^\/?)/, "/") | |
| }, | |
| set: function(value) { | |
| this._anchorElement.pathname = value | |
| }, | |
| enumerable: true | |
| }, | |
| "origin": { | |
| get: function() { | |
| var expectedPort = { | |
| "http:": 80, | |
| "https:": 443, | |
| "ftp:": 21 | |
| }[this._anchorElement.protocol]; | |
| var addPortToOrigin = this._anchorElement.port != expectedPort && this._anchorElement.port !== ""; | |
| return this._anchorElement.protocol + "//" + this._anchorElement.hostname + (addPortToOrigin ? ":" + this._anchorElement.port : "") | |
| }, | |
| enumerable: true | |
| }, | |
| "password": { | |
| get: function() { | |
| return "" | |
| }, | |
| set: function(value) {}, | |
| enumerable: true | |
| }, | |
| "username": { | |
| get: function() { | |
| return "" | |
| }, | |
| set: function(value) {}, | |
| enumerable: true | |
| }, | |
| "searchParams": { | |
| get: function() { | |
| var searchParams = new URLSearchParams(this.search); | |
| var _this = this; | |
| ["append", "delete", "set"].forEach(function(methodName) { | |
| var method = searchParams[methodName]; | |
| searchParams[methodName] = function() { | |
| method.apply(searchParams, arguments); | |
| _this.search = searchParams.toString() | |
| } | |
| }); | |
| return searchParams | |
| }, | |
| enumerable: true | |
| } | |
| }); | |
| URL.createObjectURL = function(blob) { | |
| return _URL.createObjectURL.apply(_URL, arguments) | |
| }; | |
| URL.revokeObjectURL = function(url) { | |
| return _URL.revokeObjectURL.apply(_URL, arguments) | |
| }; | |
| global.URL = URL | |
| }; | |
| if (!checkIfURLIsSupported()) polyfillURL(); | |
| if (global.location !== void 0 && !("origin" in global.location)) { | |
| var getOrigin = function() { | |
| return global.location.protocol + "//" + global.location.hostname + (global.location.port ? ":" + global.location.port : "") | |
| }; | |
| try { | |
| Object.defineProperty(global.location, "origin", { | |
| get: getOrigin, | |
| enumerable: true | |
| }) | |
| } catch (e) { | |
| setInterval(function() { | |
| global.location.origin = | |
| getOrigin() | |
| }, 100) | |
| } | |
| } | |
| })(typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : this); | |
| (function(window, document) { | |
| var html = document.documentElement; | |
| var define = function(object, property, getter) { | |
| if (typeof object[property] === "undefined") Object.defineProperty(object, property, { | |
| get: getter | |
| }) | |
| }; | |
| define(window, "innerWidth", function() { | |
| return html.clientWidth | |
| }); | |
| define(window, "innerHeight", function() { | |
| return html.clientHeight | |
| }); | |
| define(window, "scrollX", function() { | |
| return window.pageXOffset || | |
| html.scrollLeft | |
| }); | |
| define(window, "scrollY", function() { | |
| return window.pageYOffset || html.scrollTop | |
| }); | |
| define(document, "width", function() { | |
| var htmlMax, documentMax; | |
| if (document.body) documentMax = Math.max(document.body.scrollWidth, document.body.offsetWidth, document.body.clientWidth); | |
| if (html) htmlMax = Math.max(html.scrollWidth, html.offsetWidth, html.clientWidth); | |
| var width = Math.max(documentMax, htmlMax); | |
| return width != width ? undefined : width | |
| }); | |
| define(document, "height", function() { | |
| var htmlMax, documentMax; | |
| if (document.body) documentMax = | |
| Math.max(document.body.scrollHeight, document.body.offsetHeight, document.body.clientHeight); | |
| if (html) htmlMax = Math.max(html.scrollHeight, html.offsetHeight, html.clientHeight); | |
| var height = Math.max(documentMax, htmlMax); | |
| return height != height ? undefined : height | |
| }); | |
| return define | |
| })(window, document); | |
| if (typeof Range.prototype.createContextualFragment == "undefined") Range.prototype.createContextualFragment = function() { | |
| var doc = document.implementation.createHTMLDocument(""), | |
| range = doc.createRange(), | |
| body = doc.body; | |
| return function(html) { | |
| body.innerHTML = | |
| html; | |
| range.selectNodeContents(body); | |
| return range.extractContents() | |
| } | |
| }(); | |
| if (!Array.prototype.includes) Object.defineProperty(Array.prototype, "includes", { | |
| value: function(searchElement, fromIndex) { | |
| if (this == null) throw new TypeError('"this" is null or not defined'); | |
| var o = Object(this); | |
| var len = o.length >>> 0; | |
| if (len === 0) return false; | |
| var n = fromIndex | 0; | |
| var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); | |
| function sameValueZero(x, y) { | |
| return x === y || typeof x === "number" && typeof y === "number" && isNaN(x) && isNaN(y) | |
| } | |
| while (k < len) { | |
| if (sameValueZero(o[k], | |
| searchElement)) return true; | |
| k++ | |
| } | |
| return false | |
| } | |
| }); | |
| if (!Object.prototype.enswatch) Object.defineProperty(Object.prototype, "enswatch", { | |
| enumerable: false, | |
| configurable: true, | |
| writable: false, | |
| value: function(prop, handler) { | |
| var old = this[prop]; | |
| var cur = old; | |
| var getter = function() { | |
| return cur | |
| }; | |
| var setter = function(val) { | |
| old = cur; | |
| cur = handler.call(this, prop, old, val); | |
| if (this.setAttribute) this.setAttribute(prop, cur); | |
| return cur | |
| }; | |
| if (delete this[prop]) Object.defineProperty(this, prop, { | |
| get: getter, | |
| set: setter, | |
| enumerable: true, | |
| configurable: true | |
| }) | |
| } | |
| }); | |
| if (!Array.prototype.filter) Array.prototype.filter = function(func, thisArg) { | |
| if (!((typeof func === "Function" || typeof func === "function") && this)) throw new TypeError; | |
| var len = this.length >>> 0, | |
| res = new Array(len), | |
| t = this, | |
| c = 0, | |
| i = -1; | |
| if (thisArg === undefined) | |
| while (++i !== len) { | |
| if (i in this) | |
| if (func(t[i], i, t)) res[c++] = t[i] | |
| } else | |
| while (++i !== len) | |
| if (i in this) | |
| if (func.call(thisArg, t[i], i, t)) res[c++] = t[i]; | |
| res.length = c; | |
| return res | |
| }; | |
| var privacyStart; | |
| var gatewayConfig = function() { | |
| var events = ["load", "abort", "error"]; | |
| var elementMethods = ["appendChild", "insertBefore", "replaceChild", "removeChild"]; | |
| if (document.insertAdjacentElement || window.Element && Element.prototype.insertAdjacentElement || window.HTMLElement && HTMLElement.prototype.insertAdjacentElement) elementMethods.push("insertAdjacentElement"); | |
| var excList = new RegExp("nodeName|scopeName|tagName|" + "fileSize|outerHTML|start|contentEditable|href|nameProp|outerText|innerText|innerHTML"); | |
| var elementTypes = ["Anchor", "Area", "Body", "Button", "Canvas", "Div", "Form", "Frame", "Head", "Html", "IFrame", | |
| "Input", "Label", "LI", "Link", "Map", "OList", "Option", "Paragraph", "Span", "Table", "TableCell", "TableCol", "TableRow", "TableSection", "UList", "Unknown" | |
| ]; | |
| var eventHandlers = ["abort", "error", "KeyDown", "KeyPress", "KeyUp", "load"]; | |
| var forwardMethods = ["cloneNode", "attachEvent"]; | |
| var getters = ["ElementsByClassName", "ClientRects", "BoundingClientRect", "Attribute", "ElementsByTagName", "ElementsByTagNameNS", "AttributeNS", "UserData", "AttributeNode", "AttributeNodeNS", "Height", "Width", "Style", "Opacity", "Dimensions", "OffsetParent", | |
| "ElementsBySelector", "InlineOpacity", "Styles" | |
| ]; | |
| var unbound = {}; | |
| return { | |
| events: events, | |
| elementMethods: elementMethods, | |
| excList: excList, | |
| elementTypes: elementTypes, | |
| eventHandlers: eventHandlers, | |
| forwardMethods: forwardMethods, | |
| getters: getters, | |
| unbound: unbound | |
| } | |
| }(); | |
| var utilities = function() { | |
| return { | |
| addStyleElement: function(cssStyleDef) { | |
| var head = document.head || document.getElementsByTagName("head")[0]; | |
| var styleTag = document.createElement("style"); | |
| styleTag.type = "text/css"; | |
| if (styleTag.styleSheet) styleTag.styleSheet.cssText = | |
| cssStyleDef; | |
| else styleTag.appendChild(document.createTextNode(cssStyleDef)); | |
| head.appendChild(styleTag) | |
| }, | |
| arrayToRegex: function(arr) { | |
| if (Array.isArray(arr)) { | |
| if (arr && arr.length > 0 && arr.join) return new RegExp(arr.join("|")); | |
| return new RegExp("a^") | |
| } | |
| }, | |
| attachEvents: function(object, fn, timeStamp) { | |
| if (object.addEventListener) utilities.each(gatewayConfig.events, function(event) { | |
| object.addEventListener(event, fn(timeStamp, event), false) | |
| }); | |
| else if (object.attachEvent) utilities.each(gatewayConfig.events, function(event) { | |
| object.attachEvent("on" + | |
| event, fn(timeStamp, event)) | |
| }) | |
| }, | |
| bind: function(fn, context, args) { | |
| args = Array.prototype.slice.call(arguments); | |
| fn = args.shift(); | |
| context = args.shift(); | |
| return function() { | |
| return fn.apply(context, args.concat(Array.prototype.slice.call(arguments))) | |
| } | |
| }, | |
| browserSupportsMutationObserver: function() { | |
| var returnVal; | |
| var prefixes = ["WebKit", "Moz", "O", "Ms", ""]; | |
| for (var i = 0; i < prefixes.length; i++) | |
| if (prefixes[i] + "MutationObserver" in window) returnVal = true; | |
| return returnVal | |
| }, | |
| couldNotBind: function(key) { | |
| gatewayConfig.unbound[key] = true | |
| }, | |
| createEventHandler: function(timeStamp, status) { | |
| return function() { | |
| gateway.resourceComplete(this, timeStamp, status) | |
| } | |
| }, | |
| deleteCookie: function(clientName, cookieKey) { | |
| clientName = clientName.toUpperCase(); | |
| var cookieString = clientName + "_ENSIGHTEN_PRIVACY_" + utilities.parseCookieSuffix(cookieKey); | |
| var cookies = document.cookie.split(";"); | |
| for (var i = 0; i < cookies.length; i++) { | |
| var cookie = cookies[i]; | |
| var eqPos = cookie.indexOf("\x3d"); | |
| var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie; | |
| if (name.trim() === cookieString.trim()) document.cookie = | |
| name + "\x3d; path\x3d/; expires\x3dThu, 01 Jan 1970 00:00:00 GMT" | |
| } | |
| }, | |
| domReady: function(callback) { | |
| var ready = false; | |
| var detach = function() { | |
| if (document.addEventListener) { | |
| document.removeEventListener("DOMContentLoaded", completed); | |
| window.removeEventListener("load", completed) | |
| } else { | |
| document.detachEvent("onreadystatechange", completed); | |
| window.detachEvent("onload", completed) | |
| } | |
| }; | |
| var completed = function() { | |
| if (!ready && (document.addEventListener || event.type === "load" || document.readyState === "complete")) { | |
| ready = true; | |
| detach(); | |
| callback() | |
| } | |
| }; | |
| if (document.readyState === "complete") callback(); | |
| else if (document.addEventListener) { | |
| document.addEventListener("DOMContentLoaded", completed); | |
| window.addEventListener("load", completed) | |
| } else { | |
| document.attachEvent("onreadystatechange", completed); | |
| window.attachEvent("onload", completed); | |
| var top = false; | |
| try { | |
| top = window.frameElement === null && document.documentElement | |
| } catch (e) {} | |
| if (top && top.doScroll)(function scrollCheck() { | |
| if (ready) return; | |
| try { | |
| top.doScroll("left") | |
| } catch (e) { | |
| return setTimeout(scrollCheck, 50) | |
| } | |
| ready = | |
| true; | |
| detach(); | |
| callback() | |
| })() | |
| } | |
| }, | |
| each: function(list, fn, context) { | |
| if (list === undefined || !("length" in list)) list = { | |
| length: 0 | |
| }; | |
| for (var i = 0; i < list.length; i++) fn.call(context, list[i], i, list) | |
| }, | |
| getBrowserLocale: function() { | |
| var locale = window.navigator.userLanguage || window.navigator.language; | |
| if (locale) { | |
| locale = locale.split("-"); | |
| if (locale[0] && locale[1]) locale = locale[0] + "-" + locale[1].toUpperCase(); | |
| else locale = locale[0] | |
| } else locale = "en"; | |
| return locale | |
| }, | |
| getFunctionString: function(fn) { | |
| if (!fn || typeof fn !== "function" && typeof fn !== | |
| "object") return false; | |
| if (fn.toString !== undefined) return fn.toString(); | |
| return fn + "" | |
| }, | |
| getUrlParamVal: function(key) { | |
| var hash, queryStringObject = {}; | |
| var hashes = window.location.href.slice(window.location.href.indexOf("?") + 1).split("\x26"); | |
| for (var i = 0; i < hashes.length; i++) { | |
| hash = hashes[i].split("\x3d"); | |
| queryStringObject[hash[0]] = hash[1] | |
| } | |
| var returnVal = ""; | |
| if (queryStringObject[key]) returnVal = queryStringObject[key]; | |
| return returnVal | |
| }, | |
| handleReference: function(arg) { | |
| var reference = arg ? arg.__reference : false; | |
| var tagName; | |
| if (reference) tagName = reference.tagName.toUpperCase(); | |
| if (reference && (tagName === "SCRIPT" || tagName === "IFRAME" || tagName === "IMAGE" || tagName === "IMG")) { | |
| for (var property in reference) | |
| if (Object.prototype.hasOwnProperty.call(reference, property) && typeof arg[property] === "string") | |
| if (!gatewayConfig.excList.test(property) && (arg[property] || reference[property] && !arg[property])) | |
| if (reference[property] !== arg[property] && arg[property] !== reference.__histLog[property]) try { | |
| reference[property] = arg[property] | |
| } catch (e) { | |
| try { | |
| if (reference.tagName && | |
| reference.tagName.toUpperCase() === "SCRIPT" && property === "text") reference.text = arg["text"]; | |
| else if (reference.tagName && reference.tagName.toUpperCase() === "SCRIPT" && property === "innerHTML") reference.innerHTML = arg["innerHTML"]; | |
| else reference.setAttribute(property, arg[property]) | |
| } catch (ex) {} | |
| } | |
| tagName = null; | |
| return reference | |
| } | |
| return arg | |
| }, | |
| decodeUriComponent: function(str) { | |
| var decodedUri = str; | |
| try { | |
| if (typeof str === "string") decodedUri = decodeURIComponent(str) | |
| } catch (e) { | |
| console.warn("URI: " + str + ". Could not decoded properly. Original string was returned") | |
| } | |
| return decodedUri | |
| }, | |
| isIE8OrLower: function() { | |
| return document.all && !document.getSelection | |
| }, | |
| isIE: false || !!document.documentMode, | |
| isNative: function(fn) { | |
| var re = new RegExp("function\\s+.+?\\(\\s*\\)" + "\\s*{\\s*\\[native code\\]\\s*}"), | |
| re2 = new RegExp("function\\s+.+?\\" + "(\\s*\\)\\s*{\\s*\\/\\*\\s*" + "source code not available\\s*\\*\\/\\s*}"), | |
| fnStr = utilities.getFunctionString(fn); | |
| var retValue = re.test(fnStr) || re2.test(fnStr); | |
| re = re2 = fnStr = null; | |
| return retValue | |
| }, | |
| map: function(list, fn, context) { | |
| if (list === undefined || !("length" in list)) list = { | |
| length: 0 | |
| }; | |
| for (var i = 0; i < list.length; i++) list[i] = fn.call(context, list[i], i, list) | |
| }, | |
| noop: function() {}, | |
| overrideHelper: function(object, fnName) { | |
| var objectNameString = object + ""; | |
| if (!object || !object[fnName] || object + "" === "[Interface prototype object]") return false; | |
| var method = object[fnName]; | |
| var proxiedMethod = function() { | |
| var args = Array.prototype.slice.call(arguments); | |
| var node = args[0]; | |
| if (typeof node === "string") node = args[1]; | |
| var tagName = this.tagName; | |
| if (tagName === undefined || tagName === null) tagName = ""; | |
| else tagName = | |
| tagName.toUpperCase(); | |
| var argTagName = node.tagName; | |
| if (argTagName === undefined || argTagName === null) argTagName = ""; | |
| else argTagName = argTagName.toUpperCase(); | |
| if (tagName !== "SCRIPT" && tagName !== "IMG" && tagName !== "IMAGE" && tagName !== "IFRAME" && argTagName !== "SCRIPT" && argTagName !== "IMG" && argTagName !== "IMAGE" && argTagName !== "IFRAME") return Function.prototype.apply.call(method, this, args); | |
| else { | |
| node = utilities.processElement(fnName, node); | |
| if (node) return Function.prototype.apply.call(method, this, args) | |
| } | |
| }; | |
| var nodeName = ""; | |
| if (objectNameString !== | |
| "[xpconnect wrapped native prototype]" && objectNameString !== "[object XPC_WN_ModsAllowed_NoCall_Proto_JSClass]") | |
| if (window.DocumentFragment && window.DocumentFragment.prototype && object === window.DocumentFragment.prototype) nodeName = ""; | |
| else if (window.Element && window.Element.prototype && object === window.Element.prototype) nodeName = ""; | |
| else nodeName = object.nodeName || ""; | |
| nodeName = nodeName.toUpperCase(); | |
| if (nodeName.toUpperCase() === "EMBED") try { | |
| object[fnName] = proxiedMethod | |
| } catch (e) {} else object[fnName] = proxiedMethod | |
| }, | |
| processElement: function(source, elementNode) { | |
| var processed = elementNode.tagName; | |
| if (typeof processed === "undefined" || processed === null || elementNode === null || elementNode.__gateway) return elementNode; | |
| var timeStamp = +new Date, | |
| request = new Request; | |
| request.id = timeStamp; | |
| request.source = source; | |
| elementNode.__gateway = timeStamp; | |
| var tagName = request.type = elementNode.tagName.toLowerCase(); | |
| if (tagName === "iframe" || tagName === "script" || tagName === "img") { | |
| request.destination = typeof elementNode.src === "string" && elementNode.src ? | |
| elementNode.src : ""; | |
| if (!gateway.onBefore(request, elementNode)) { | |
| elementNode.src = utilities.getBlockedSrcString(tagName, request); | |
| gateway.onBlock(request, elementNode) | |
| } else utilities.attachEvents(elementNode, utilities.createEventHandler, timeStamp) | |
| } | |
| utilities.each(elementNode.children, utilities.bind(utilities.processElement, this, source)); | |
| processed = timeStamp = request = tagName = null; | |
| return elementNode | |
| }, | |
| getBlockedSrcString: function(tagName, request) { | |
| if (gateway.dataGovernanceManager.shouldMaskData(request)) return gateway.dataGovernanceManager.getMaskedDataString(request.destination); | |
| else if (gateway.dataGovernanceManager.shouldRedactData(request)) return gateway.dataGovernanceManager.getRedactedDataString(request.destination); | |
| else if (tagName === "img") return ""; | |
| else return "//javascript:;" | |
| }, | |
| processHTML: function(source, html) { | |
| var containsSrc = /src\s*=/i.test(html); | |
| if (!containsSrc) { | |
| containsSrc = null; | |
| return html | |
| } | |
| var srcs = html.match(/src\s*=\s*(.+?)(\s|$|>)/ig); | |
| if (srcs) { | |
| utilities.map(srcs, function(src) { | |
| var replacedString = src.replace(/\s*src\s*=\s*('|")?(.*?)('|")?(\s|$|>)/i, "$2"); | |
| return replacedString | |
| }); | |
| utilities.each(srcs, function(src) { | |
| var timeStamp = +new Date, | |
| request = new Request; | |
| request.id = timeStamp; | |
| request.source = source; | |
| request.destination = src.indexOf("javascript:") ? src : (new URL(src, window.location)).href; | |
| var node = {}; | |
| if (!gateway.onBefore(request, node)) { | |
| if (gateway.dataGovernanceManager.shouldMaskData(request)) html = html.replace(src, gateway.dataGovernanceManager.getMaskedDataString(request.destination)); | |
| else html = html.replace(src, "//javascript:;"); | |
| gateway.onBlock(request, node) | |
| } | |
| }) | |
| } | |
| containsSrc = srcs = | |
| null; | |
| return html | |
| }, | |
| getCookieTLD: function() { | |
| return ["ac", "com", "co", "org", "edu", "info", "gov", "net", "mod", "nhs", "plc", "sch", "ltd"] | |
| }, | |
| getCookieSLD: function() { | |
| return ["af", "ax", "al", "dz", "as", "ad", "ao", "ai", "aq", "ag", "ar", "am", "aw", "au", "at", "az", "bh", "bs", "bd", "bb", "by", "be", "bz", "bj", "bm", "bt", "bo", "bq", "ba", "bw", "bv", "br", "io", "bn", "bg", "bf", "bi", "kh", "cm", "ca", "cv", "ky", "cf", "td", "cl", "cn", "cx", "cc", "co", "km", "cg", "cd", "ck", "cr", "ci", "hr", "cu", "cw", "cy", "cz", "dk", "dj", "dm", "do", "ec", "eg", "sv", "gq", "er", | |
| "ee", "et", "fk", "fo", "fj", "fi", "fr", "gf", "pf", "tf", "ga", "gm", "ge", "de", "gh", "gi", "gr", "gl", "gd", "gp", "gu", "gt", "gg", "gn", "gw", "gy", "ht", "hm", "va", "hn", "hk", "hu", "is", "in", "id", "ir", "iq", "ie", "im", "il", "it", "jm", "jp", "je", "jo", "kz", "ke", "ki", "kp", "kr", "kw", "kg", "la", "lv", "lb", "ls", "lr", "ly", "li", "lt", "lu", "mo", "mk", "mg", "mw", "my", "mv", "ml", "mt", "mh", "mq", "mr", "mu", "yt", "mx", "fm", "md", "mc", "mn", "me", "ms", "ma", "mz", "mm", "na", "nr", "np", "nl", "nc", "nz", "ni", "ne", "ng", "nu", "nf", "mp", "no", "om", "pk", "pw", "ps", | |
| "pa", "pg", "py", "pe", "ph", "pn", "pl", "pt", "pr", "qa", "ro", "ru", "rw", "bl", "sh", "kn", "lc", "mf", "pm", "vc", "ws", "sm", "st", "sa", "sn", "rs", "sc", "sl", "sg", "sx", "sk", "si", "sb", "so", "za", "gs", "ss", "es", "lk", "sd", "sr", "sj", "sz", "se", "ch", "sy", "tw", "tj", "tz", "th", "tl", "tg", "tk", "to", "tt", "tn", "tr", "tm", "tc", "tv", "ug", "ua", "uk", "ae", "gb", "us", "um", "uy", "uz", "vu", "ve", "vn", "vg", "vi", "wf", "eh", "ye", "zm", "zw" | |
| ] | |
| }, | |
| createRegex: function() { | |
| var tld = this.getCookieTLD(), | |
| tldLength = tld.length, | |
| sld = this.getCookieSLD(), | |
| sldLength = | |
| sld.length, | |
| combinedDomains = []; | |
| for (var i = 0; i < tldLength; i++) | |
| for (var j = 0; j < sldLength; j++) combinedDomains.push("." + tld[i] + "\\." + sld[j]); | |
| return combinedDomains.join("|") | |
| }, | |
| cookieNameToCookieType: function(clientName, cookieName) { | |
| return cookieName.replace(clientName.toUpperCase() + "_ENSIGHTEN_PRIVACY_", "") | |
| }, | |
| ieVersion: function() { | |
| var ua = window.navigator.userAgent; | |
| var msie = ua.indexOf("MSIE "); | |
| if (msie > 0) return parseInt(ua.substring(msie + 5, ua.indexOf(".", msie)), 10); | |
| var trident = ua.indexOf("Trident/"); | |
| if (trident > | |
| 0) { | |
| var rv = ua.indexOf("rv:"); | |
| return parseInt(ua.substring(rv + 3, ua.indexOf(".", rv)), 10) | |
| } | |
| var edge = ua.indexOf("Edge/"); | |
| if (edge > 0) return parseInt(ua.substring(edge + 5, ua.indexOf(".", edge)), 10); | |
| return null | |
| } | |
| } | |
| }(); | |
| var writeLnObserver = function() { | |
| var writeln = document.writeln; | |
| document.writeln = function(html) { | |
| html = utilities.processHTML("writeln", html); | |
| return Function.prototype.call.call(writeln, document, html) | |
| }; | |
| return !utilities.isNative(document.writeln) | |
| }; | |
| var writeObserver = function() { | |
| var write = document.write; | |
| document.write = | |
| function(html, cb) { | |
| html = utilities.processHTML("write", html); | |
| if (cb) return cb(html); | |
| return Function.prototype.call.call(write, document, html) | |
| }; | |
| return !utilities.isNative(document.write) | |
| }; | |
| var elementObserver = function() { | |
| function observeElementHelper() { | |
| utilities.each(gatewayConfig.elementTypes, function(type) { | |
| if (window["HTML" + type + "Element"] && window["HTML" + type + "Element"].prototype) utilities.each(gatewayConfig.elementMethods, function(method) { | |
| utilities.overrideHelper(window["HTML" + type + "Element"].prototype, | |
| method) | |
| }); | |
| else utilities.couldNotBind("HTML" + type + "Element") | |
| }) | |
| } | |
| if (window.DocumentFragment && window.DocumentFragment.prototype && window.DocumentFragment.prototype.appendChild) utilities.each(gatewayConfig.elementMethods, utilities.bind(utilities.overrideHelper, null, window.DocumentFragment.prototype)); | |
| else utilities.couldNotBind("DocumentFramgment"); | |
| if (window.Element && window.Element.prototype && window.Element.prototype.appendChild) utilities.each(gatewayConfig.elementMethods, utilities.bind(utilities.overrideHelper, | |
| null, window.Element.prototype)); | |
| else utilities.couldNotBind("Element"); | |
| if (utilities.isNative(document.createElement("div").appendChild)) { | |
| var div = document.createElement("div"); | |
| var proto = div; | |
| var escape = 0; | |
| while (!Object.prototype.hasOwnProperty.call(proto, "appendChild")) { | |
| proto = Object.getPrototypeOf(proto); | |
| if (escape++ > 5) { | |
| utilities.couldNotBind("div.appendChild"); | |
| break | |
| } | |
| } | |
| utilities.each(gatewayConfig.elementMethods, utilities.bind(utilities.overrideHelper, null, proto)); | |
| div = proto = escape = null | |
| } | |
| if (utilities.isNative(document.createElement("div").appendChild)) observeElementHelper(); | |
| return | |
| }; | |
| var MutationObserverFactory = function() { | |
| ensClientConfig.ensCreateElement = document.createElement; | |
| var ensMutationObserver = new MutationObserver(function(mutations) { | |
| for (var index = 0; index < mutations.length; index++) { | |
| var mutation = mutations[index]; | |
| if (mutation.type == "attributes") utilities.processElement("mutationObserverA", mutation.target); | |
| if (mutation.type == "childList") { | |
| var mutationLength = mutation.addedNodes.length; | |
| for (var i = 0; i < mutationLength; i++) { | |
| var item; | |
| if (Object.prototype.toString.call(mutation.addedNodes) === | |
| "[object Array]") item = mutation.addedNodes[i]; | |
| else item = mutation.addedNodes.item(i); | |
| utilities.processElement("mutationObserverCL", item) | |
| } | |
| } | |
| } | |
| }); | |
| var watchTheDOM = function() { | |
| var docBody = document; | |
| var innerHTMLObservCfg = { | |
| attributes: true, | |
| childList: true, | |
| subtree: true, | |
| characterData: false, | |
| attributeFilter: ["src"] | |
| }; | |
| ensMutationObserver.observe(docBody, innerHTMLObservCfg); | |
| var oldSetAttribute = HTMLIFrameElement.prototype.setAttribute; | |
| HTMLIFrameElement.prototype.setAttribute = function(name, value) { | |
| var parsedSrc; | |
| if (name == | |
| "src" || name == "ng-src") { | |
| var timeStamp = +new Date; | |
| var request = new Request; | |
| request.id = timeStamp; | |
| request.source = "HTMLIFRAME_SETATTRIBUTE"; | |
| request.destination = value.indexOf("javascript:") ? value : (new URL(value, window.location)).href; | |
| var elementNode = this; | |
| request.type = elementNode.tagName.toLowerCase(); | |
| var parsedSrc = value; | |
| if (!gateway.onBefore(request, elementNode)) { | |
| parsedSrc = utilities.getBlockedSrcString("iframe", request); | |
| this[name] = parsedSrc; | |
| if (this.parentNode && parsedSrc === "//javascript:;") this.parentNode.removeChild(this); | |
| gateway.onBlock(request, elementNode); | |
| return oldSetAttribute.call(this, name, parsedSrc) | |
| } else utilities.attachEvents(elementNode, utilities.createEventHandler, timeStamp) | |
| } | |
| return oldSetAttribute.call(this, name, parsedSrc || value) | |
| }; | |
| if (utilities.isIE) { | |
| var originalSet = Object.getOwnPropertyDescriptor(HTMLElement.prototype, "innerHTML").set; | |
| Object.defineProperty(HTMLElement.prototype, "innerHTML", { | |
| set: function(val) { | |
| var new_value = utilities.processHTML("innerHTML", val); | |
| return originalSet.call(this, new_value) | |
| } | |
| }) | |
| } | |
| }; | |
| document.createElement = function(tagName) { | |
| var element = Function.prototype.apply.call(ensClientConfig.ensCreateElement, document, arguments); | |
| if (tagName.match(/img|image|iframe|script/i)) { | |
| var config = { | |
| attributes: true, | |
| childList: false, | |
| characterData: false, | |
| attributeFilter: ["src"] | |
| }; | |
| ensMutationObserver.observe(element, config) | |
| } | |
| return element | |
| }; | |
| window.Image = function(w, h) { | |
| var img = document.createElement("img"); | |
| if (utilities.IE) img.enswatch("src", function(prop, old, curr) { | |
| if (prop == "src") { | |
| var timeStamp = +new Date; | |
| var request = | |
| new Request; | |
| request.id = timeStamp; | |
| request.source = "IMAGE_DOMAttrModified"; | |
| var src = curr; | |
| request.destination = src.indexOf("javascript:") ? src : (new URL(src, window.location)).href; | |
| var elementNode = this; | |
| request.type = elementNode.tagName.toLowerCase(); | |
| if (!gateway.onBefore(request, elementNode)) { | |
| src = utilities.getBlockedSrcString("img", request); | |
| gateway.onBlock(request, elementNode) | |
| } else utilities.attachEvents(elementNode, utilities.createEventHandler, timeStamp); | |
| return src | |
| } | |
| }); | |
| if (typeof w != "undefined") img.setAttribute("width", | |
| w); | |
| if (typeof h != "undefined") img.setAttribute("height", h); | |
| return img | |
| }; | |
| var init = function() { | |
| watchTheDOM() | |
| }() | |
| }; | |
| var Reporter = function() { | |
| var that; | |
| function getReportHeader() { | |
| return { | |
| version: "1.0.0", | |
| gateway: that.gatewayVersion, | |
| clientId: that.clientId, | |
| publishPath: that.publishPath, | |
| instanceId: that.instanceId, | |
| packet: that.beaconCounter, | |
| mode: that.gatewayMode, | |
| cookies: that.privacyCookies | |
| } | |
| } | |
| function generateRawReportString(resources) { | |
| var report = getReportHeader(); | |
| report.requests = resources; | |
| return JSON.stringify(report) | |
| } | |
| function generateReportString(resources) { | |
| var reportString = generateRawReportString(resources); | |
| var stat = {}; | |
| stat.rawLength = reportString.length; | |
| reportString = LZString.compressToEncodedURIComponent(reportString); | |
| stat.compressedLength = reportString.length; | |
| that.stats.push(stat); | |
| return reportString | |
| } | |
| function doReport() { | |
| var overCapacityResources = [], | |
| beacons = []; | |
| if (this.enabled === false || this.unreportedResources.length === 0) return false; | |
| while (this.unreportedResources.length > 0) { | |
| var reportString = generateReportString(this.unreportedResources); | |
| if (reportString.length + 50 < this.options.maxUrlSize) { | |
| beacons.push(beacon.call(this, reportString)); | |
| this.reportedResources = this.reportedResources.concat(this.unreportedResources); | |
| this.unreportedResources = overCapacityResources; | |
| overCapacityResources = []; | |
| if (this.stats.length > 0) this.stats[this.stats.length - 1].written = true | |
| } else overCapacityResources.push(this.unreportedResources.pop()) | |
| } | |
| return beacons | |
| } | |
| function beacon(data) { | |
| var Img = this.imageReference; | |
| var beaconRootUrl = "//" + this.nexusDomain + "/privacy/v1/b/1.gif"; | |
| var beacon = new Img; | |
| var encodedBeaconURL = beaconRootUrl + "?" + "n\x3d" + this.beaconCounter++ + "\x26c\x3d" + this.clientId + "\x26i\x3d" + this.instanceId; | |
| if (this.publishPath) encodedBeaconURL += "\x26p\x3d" + encodeURIComponent(this.publishPath); | |
| encodedBeaconURL += "\x26d\x3d" + data; | |
| beacon.src = encodedBeaconURL; | |
| return encodedBeaconURL | |
| } | |
| function startTimer() { | |
| var self = this; | |
| if (!this.enabled) return false; | |
| doReport.call(this); | |
| return setTimeout(function() { | |
| startTimer.call(self) | |
| }, this.options.reportInterval) | |
| } | |
| function Reporter(imageReference, | |
| clientId, publishPath, usesWhitelist, gatewayVersion, reportingEnabled, options, nexusDomain, filterRegex) { | |
| this.instanceId = ((1 + Math.random()) * 268435456 | 0).toString(36); | |
| this.imageReference = imageReference; | |
| this.nexusDomain = nexusDomain; | |
| this.unreportedResources = []; | |
| this.reportedResources = []; | |
| this.beaconCounter = 0; | |
| this.enabled = reportingEnabled === false ? false : true; | |
| this.clientId = clientId; | |
| this.publishPath = publishPath; | |
| this.gatewayMode = usesWhitelist ? "whitelist" : "blacklist"; | |
| this.privacyCookies = []; | |
| this.gatewayVersion = gatewayVersion; | |
| this.stats = []; | |
| this.filterRegex = filterRegex || /a^/; | |
| if (options) this.setOptions(options); | |
| startTimer.call(this); | |
| that = this | |
| } | |
| Reporter.prototype = { | |
| options: { | |
| maxUrlSize: 32E3, | |
| reportInterval: 2500 | |
| }, | |
| addResource: function(resource) { | |
| if (this.enabled && !this.filter(resource.destination)) this.unreportedResources.push(resource) | |
| }, | |
| filter: function(url) { | |
| return this.filterRegex.test(url) | |
| }, | |
| setCookies: function(cookies) { | |
| this.privacyCookies = cookies | |
| }, | |
| setOptions: function(options) { | |
| for (var p in options) | |
| if (options.hasOwnProperty(p)) this.options[p] = | |
| options[p] | |
| }, | |
| _generateRawReportString: generateRawReportString, | |
| _generateReportString: generateReportString, | |
| _doReport: doReport, | |
| _beacon: beacon, | |
| _startTimer: startTimer | |
| }; | |
| return Reporter | |
| }(); | |
| function CookieManager(clientName, customGetter, customSetter) { | |
| this.deleteAllCookies = function() { | |
| var cookies = document.cookie.split(";"); | |
| for (var i = 0; i < cookies.length; i++) { | |
| var cookie = cookies[i]; | |
| var eqPos = cookie.indexOf("\x3d"); | |
| var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie; | |
| document.cookie = name + "\x3d; path\x3d/; expires\x3dThu, 01 Jan 1970 00:00:00 GMT; domain\x3d" + | |
| this.getCookieDomain() | |
| } | |
| }; | |
| this.deleteCookie = function(cookieType) { | |
| clientName = clientName.toUpperCase(); | |
| var cookieString = clientName + "_ENSIGHTEN_PRIVACY_" + this._parseCookieSuffix(cookieType); | |
| var cookies = document.cookie.split(";"); | |
| for (var i = 0; i < cookies.length; i++) { | |
| var cookie = cookies[i]; | |
| var eqPos = cookie.indexOf("\x3d"); | |
| var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie; | |
| if (name.trim() === cookieString.trim()) document.cookie = name + "\x3d; path\x3d/; expires\x3dThu, 01 Jan 1970 00:00:00 GMT; domain\x3d" + this.getCookieDomain() | |
| } | |
| }; | |
| this.getCookie = function(key) { | |
| if (customGetter !== undefined) return customGetter(key); | |
| return this.defaultGetCookie(key) | |
| }; | |
| this.defaultGetCookie = function(key) { | |
| var cookieName = this._parseCookieSuffix(key); | |
| var match = document.cookie.match(new RegExp(cookieName + "\x3d([^;]+)")); | |
| if (match) return match[1]; | |
| else { | |
| var legacyMatch = document.cookie.match(new RegExp(cookieName + "\x3d([^;]+)")); | |
| if (legacyMatch) return legacyMatch[1] | |
| } | |
| }; | |
| this.getCookiesFromTypes = function(cookieTypes) { | |
| var cookies = {}; | |
| for (var i = 0; i < cookieTypes.length; i++) { | |
| var cookieName = | |
| cookieTypes[i], | |
| cookieValue = this.getCookie(cookieName); | |
| if (cookieValue !== "undefinded" && cookieValue !== null) cookies[clientName.toUpperCase() + "_ENSIGHTEN_PRIVACY_" + this._parseCookieSuffix(cookieName)] = cookieValue | |
| } | |
| return cookies | |
| }; | |
| this.setCookie = function(cookieType, value) { | |
| if (customSetter !== undefined) return customSetter(cookieType, value); | |
| return this.defaultSetCookie(cookieType, value) | |
| }; | |
| this.setCookies = function(cookies) { | |
| for (var key in cookies) this.defaultSetCookie(key, cookies[key]) | |
| }; | |
| this.defaultSetCookie = function(cookieType, | |
| value) { | |
| var prefix = clientName.toUpperCase() + "_ENSIGHTEN_PRIVACY_"; | |
| var suffix = this._parseCookieSuffix(cookieType); | |
| document.cookie = prefix + suffix + "\x3d" + value + "; path\x3d/; domain\x3d" + this.cookieDomain + "; expires\x3d" + (new Date(+new Date + 1E3 * 60 * 60 * 24 * 365)).toUTCString() | |
| }; | |
| this.setCookieDomain = function(newCookieDomain) { | |
| this.cookieDomain = newCookieDomain | |
| }; | |
| this.getCookieDomain = function() { | |
| return this.cookieDomain | |
| }; | |
| this._parseCookieSuffix = function(cookieType) { | |
| return cookieType.replace(/ /g, "_") | |
| }; | |
| this.calculateCookieDomain = | |
| function(domain) { | |
| var regExStr = utilities.createRegex(); | |
| var host = domain || document.location.hostname; | |
| var re = new RegExp(regExStr); | |
| var isIP = /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/gm; | |
| var domainIsIpAddress = isIP.test(host); | |
| if (host !== "localhost" && !domainIsIpAddress) { | |
| var hostHasTwoPartSuffix = re.test(host); | |
| host = host.split("."); | |
| var finalHostString; | |
| if (hostHasTwoPartSuffix) finalHostString = host.slice(host.length - 3, host.length); | |
| else finalHostString = | |
| host.slice(host.length - 2, host.length); | |
| finalHostString = finalHostString.join("."); | |
| return finalHostString | |
| } else return host | |
| }; | |
| this.cookieDomain = this.calculateCookieDomain(window.location.hostname) | |
| } | |
| function XhrManager() { | |
| var open = window.XMLHttpRequest.prototype.open, | |
| send = window.XMLHttpRequest.prototype.send, | |
| voidURL = "//javascript:;"; | |
| function openReplacement(method, url, async, user, password) { | |
| var parsedUrl = processURL(url, this); | |
| if (parsedUrl && parsedUrl !== voidURL) return open.apply(this, arguments); | |
| this.setRequestHeader = | |
| function() {}; | |
| this.send = function() {} | |
| } | |
| function sendReplacement(value) { | |
| this.url = processURL(this.url, this); | |
| return send.apply(this, arguments) | |
| } | |
| function processURL(url, xhr) { | |
| if (url === undefined) return undefined; | |
| var timeStamp = +new Date; | |
| var request = new Request; | |
| request.id = timeStamp; | |
| request.source = "XHR_MANAGER"; | |
| var src = url; | |
| request.destination = src === voidURL ? voidURL : (new URL(src, window.location)).href; | |
| var elementNode = xhr; | |
| request.type = "xhr"; | |
| this.historyId = timeStamp; | |
| if (!gateway.onBefore(request, elementNode)) { | |
| src = | |
| utilities.getBlockedSrcString("xhr", request); | |
| gateway.onBlock(request, elementNode) | |
| } else gateway.resourceComplete(this, timeStamp, "load"); | |
| return src | |
| } | |
| window.XMLHttpRequest.prototype.send = sendReplacement; | |
| window.XMLHttpRequest.prototype.open = openReplacement | |
| } | |
| var EnvironmentManager = function(document, environmentConfigs, defaultEnvName, clientName, cookieManager) { | |
| var activeEnvironment = null, | |
| environmentChangeCallbacks = [], | |
| environmentsCount = environmentConfigs.length, | |
| clearEnvironment = function(clientName) { | |
| cookieManager.deleteCookie("LOCALE"); | |
| setEnvironment() | |
| }, | |
| environmentExists = function(locale) { | |
| return getEnvironmentByLocale(locale) !== null | |
| }, | |
| evalCondition = function(condition) { | |
| var conditionValue; | |
| var conditionIsSatisfied = false; | |
| switch (condition.type) { | |
| case "host": | |
| conditionValue = document.location.hostname; | |
| break; | |
| case "url": | |
| conditionValue = document.URL; | |
| break; | |
| case "cookie": | |
| conditionValue = getCookie(condition.key); | |
| break; | |
| case "jsVar": | |
| conditionValue = getJSVarValue(condition.key); | |
| break; | |
| default: | |
| console.warn("Error evaluating environment target") | |
| } | |
| switch (condition.operator) { | |
| case "equals": | |
| conditionIsSatisfied = | |
| evaluateEquals(conditionValue, condition); | |
| break; | |
| case "contains": | |
| conditionIsSatisfied = evaluateContains(conditionValue, condition); | |
| break; | |
| case "exists": | |
| conditionIsSatisfied = evaluateExists(conditionValue, condition); | |
| break; | |
| case "regexp": | |
| conditionIsSatisfied = evaluateRegExp(conditionValue, condition); | |
| break; | |
| default: | |
| console.warn("Error evaluating comparator for environment") | |
| } | |
| if (condition.shouldBePositive === false) | |
| if (conditionIsSatisfied === true) conditionIsSatisfied = false; | |
| else conditionIsSatisfied = true; | |
| if (conditionIsSatisfied === | |
| true && condition._and) conditionIsSatisfied = evalCondition(condition._and); | |
| if (conditionIsSatisfied === false && condition._or) conditionIsSatisfied = evalCondition(condition._or); | |
| return conditionIsSatisfied | |
| }, | |
| evaluateContains = function(value, condition) { | |
| if (value) return value.indexOf(condition.value) !== -1; | |
| else return false | |
| }, | |
| evaluateEquals = function(value, condition) { | |
| return value == condition.value | |
| }, | |
| evaluateExists = function(value) { | |
| var objectExists = false; | |
| if (value) objectExists = true; | |
| return objectExists | |
| }, | |
| evaluateRegExp = | |
| function(value, condition) { | |
| return value === undefined || value === "" ? false : (new RegExp(condition.value)).test(value) | |
| }, | |
| fireEnvironmentChangeCallbacks = function() { | |
| var callbacksCount = environmentChangeCallbacks.length; | |
| for (var i = 0; i < callbacksCount; i++) | |
| if (typeof environmentChangeCallbacks[i] === "function") environmentChangeCallbacks[i](activeEnvironment) | |
| }, | |
| getActiveEnvironment = function() { | |
| return activeEnvironment | |
| }, | |
| getActiveLocale = function() { | |
| return activeEnvironment.languageCode | |
| }, | |
| getAvailableLocales = function() { | |
| var availableLocales = []; | |
| for (var i = 0; i < environmentsCount; i++) availableLocales.push(environmentConfigs[i].languageCode); | |
| return availableLocales | |
| }, | |
| getCookie = function(key) { | |
| var match = document.cookie.match(new RegExp(key + "\x3d([^;]+)")); | |
| if (match) return match[1] | |
| }, | |
| getDefaultEnvironment = function() { | |
| var environment = null; | |
| for (var i = 0; i < environmentConfigs.length; i++) | |
| if (defaultEnvName && environmentConfigs[i].name == defaultEnvName) { | |
| environment = environmentConfigs[i]; | |
| break | |
| } | |
| return environment | |
| }, | |
| getEnvironmentByConditions = function() { | |
| var locale = | |
| utilities.getBrowserLocale(); | |
| for (var i = 0; i < environmentsCount; i++) | |
| if (hasConditions(environmentConfigs[i])) { | |
| if (evalCondition(environmentConfigs[i].condition)) return environmentConfigs[i] | |
| } else if (localeMatches(environmentConfigs[i], locale)) return environmentConfigs[i]; | |
| return null | |
| }, | |
| hasConditions = function(environment) { | |
| return environment.condition && environment.condition.type && environment.condition.operator | |
| }, | |
| getEnvironmentByLocale = function(locale) { | |
| var environment = null; | |
| for (var i = 0; i < environmentsCount; i++) | |
| if (localeMatches(environmentConfigs[i], | |
| locale)) environment = environmentConfigs[i]; | |
| return environment | |
| }, | |
| localeMatches = function(environment, locale) { | |
| if (environment) | |
| if (environment.languageCode === locale) return true; | |
| else { | |
| var trimmedLocale = locale.split("-"); | |
| var language = trimmedLocale[0]; | |
| if (environment.languageCode === language) return true | |
| } | |
| return false | |
| }, | |
| getEnvironmentByLocaleCookie = function() { | |
| var environment = null; | |
| var cookieVal = this.cookieManager.getCookie("LOCALE"); | |
| if (cookieVal) environment = getEnvironmentByLocale(cookieVal); | |
| return environment | |
| }, | |
| initializeActiveEnvironment = | |
| function() { | |
| var environment = null; | |
| environment = getEnvironmentByLocaleCookie(); | |
| if (!environment) environment = getEnvironmentByConditions(); | |
| if (!environment) environment = getDefaultEnvironment(); | |
| if (environment && environment.translation) { | |
| environment.translation.save = environment.translation.save || "SAVE"; | |
| environment.translation.cancel = environment.translation.cancel || "CANCEL"; | |
| environment.translation.close = environment.translation.close || "CLOSE" | |
| } | |
| activeEnvironment = environment | |
| }, | |
| registerEnvironmentChangeCallback = function(callback) { | |
| environmentChangeCallbacks.push(callback) | |
| }, | |
| setEnvironment = function(locale) { | |
| if (environmentExists(locale)) { | |
| var oldCookies = cookieManager.getCookiesFromTypes(["LOCALE"]); | |
| cookieManager.setCookie("LOCALE", locale); | |
| var newCookies = cookieManager.getCookiesFromTypes(["LOCALE"]); | |
| consentReporter.sendReport(oldCookies, newCookies); | |
| activeEnvironment = getEnvironmentByLocale(locale); | |
| fireEnvironmentChangeCallbacks(activeEnvironment) | |
| } else if (!locale) { | |
| initializeActiveEnvironment(); | |
| activeEnvironment = getActiveEnvironment(); | |
| fireEnvironmentChangeCallbacks(activeEnvironment) | |
| } | |
| }, | |
| getJSVarValue = function(key) { | |
| var value = typeof window[key] !== "undefined" ? window[key] : undefined; | |
| if (key && typeof key === "string" && !value) { | |
| var currentValue, i = 0, | |
| objKeys = key.split("."), | |
| len = objKeys.length; | |
| for (; i < len; i++) { | |
| currentValue = currentValue ? currentValue[objKeys[i]] : window[objKeys[i]]; | |
| value = typeof currentValue !== "undefined" ? currentValue : undefined | |
| } | |
| } | |
| return value | |
| }, | |
| init = function() { | |
| initializeActiveEnvironment() | |
| }(); | |
| return { | |
| environmentExists: environmentExists, | |
| clearEnvironment: clearEnvironment, | |
| getActiveEnvironment: getActiveEnvironment, | |
| getActiveLocale: getActiveLocale, | |
| getAvailableLocales: getAvailableLocales, | |
| registerEnvironmentChangeCallback: registerEnvironmentChangeCallback, | |
| evalCondition: evalCondition, | |
| setEnvironment: setEnvironment | |
| } | |
| }; | |
| var DataGovernanceManager = function(enabled, dataMonitoringParams, environment) { | |
| (function init() { | |
| updateEnvironment(environment) | |
| })(); | |
| var blockURLParamsRegex; | |
| var dataMonitoringAllowedDomainsRegex; | |
| var mode; | |
| function updateEnvironment(env) { | |
| var activeMonitoringParams; | |
| if (env && env.hasOwnProperty("dataMonitoring")) activeMonitoringParams = | |
| env.dataMonitoring || {}; | |
| else activeMonitoringParams = dataMonitoringParams || {}; | |
| activeMonitoringParams.blockURLParamsRegex = activeMonitoringParams.blockURLParamsRegex || []; | |
| activeMonitoringParams.mode = activeMonitoringParams.mode || "block"; | |
| activeMonitoringParams.domainsAllowed = activeMonitoringParams.domainsAllowed || []; | |
| blockURLParamsRegex = utilities.arrayToRegex(activeMonitoringParams.blockURLParamsRegex); | |
| dataMonitoringAllowedDomainsRegex = utilities.arrayToRegex(activeMonitoringParams.domainsAllowed); | |
| mode = activeMonitoringParams.mode | |
| } | |
| function allowRequest(request, hostName) { | |
| var dataMonitoringCheckPasses = true; | |
| var url = request.destination; | |
| if (enabled) { | |
| dataMonitoringCheckPasses = false; | |
| var decodedURLString = utilities.decodeUriComponent(url); | |
| dataMonitoringCheckPasses = !blockURLParamsRegex.test(decodedURLString); | |
| if (dataMonitoringCheckPasses === false) dataMonitoringCheckPasses = dataMonitoringAllowedDomainsRegex.test(hostName); | |
| if (!dataMonitoringCheckPasses) request.addReason("DATA_MONITORING") | |
| } | |
| return dataMonitoringCheckPasses | |
| } | |
| function editQueryString(queryString, | |
| replacementStringChars) { | |
| var replacementString = replacementStringChars || "~~~~~~~~~~~~~~~~~~~~"; | |
| if (replacementStringChars === "") replacementString = ""; | |
| var newStringVal = utilities.decodeUriComponent(queryString); | |
| if (newStringVal !== "" && blockURLParamsRegex.test && blockURLParamsRegex.test(newStringVal)) { | |
| newStringVal = newStringVal.replace(blockURLParamsRegex, replacementString); | |
| newStringVal = editQueryString(newStringVal, replacementString) | |
| } | |
| return newStringVal | |
| } | |
| function getMaskedDataString(dataMonitoringString) { | |
| var newStringVal = | |
| editQueryString(dataMonitoringString, "~~~~~~~~~~"); | |
| return newStringVal | |
| } | |
| function getRedactedDataString(dataMonitoringString) { | |
| var newStringVal = editQueryString(dataMonitoringString, ""); | |
| return newStringVal | |
| } | |
| function shouldMaskData(request) { | |
| var shouldMask = false; | |
| if (mode === "mask" && request.numReasons() === 1 && request.hasReason("DATA_MONITORING")) shouldMask = true; | |
| return shouldMask | |
| } | |
| function shouldRedactData(request) { | |
| var shouldMask = false; | |
| if (mode === "redact" && request.numReasons() === 1 && request.hasReason("DATA_MONITORING")) shouldMask = | |
| true; | |
| return shouldMask | |
| } | |
| return { | |
| allowRequest: allowRequest, | |
| getMaskedDataString: getMaskedDataString, | |
| getRedactedDataString: getRedactedDataString, | |
| shouldMaskData: shouldMaskData, | |
| shouldRedactData: shouldRedactData, | |
| updateEnvironment: updateEnvironment | |
| } | |
| }; | |
| var BusinessRulesManager = function(gatewayData) { | |
| var init = function() { | |
| setStaticVals() | |
| }, | |
| shouldGetEnterpriseModal = false, | |
| shouldGetPrivacyModal = false, | |
| setShouldGetEnterpriseModal = function() { | |
| shouldGetEnterpriseModal = gatewayData.libraryPackage === "enterprise" | |
| }, | |
| setShouldGetPrivacyModal = | |
| function() { | |
| shouldGetPrivacyModal = gatewayData.libraryPackage && gatewayData.libraryPackage === "privacy" | |
| }, | |
| setStaticVals = function() { | |
| setShouldGetEnterpriseModal(); | |
| setShouldGetPrivacyModal() | |
| }; | |
| init(); | |
| return { | |
| shouldGetEnterpriseModal: shouldGetEnterpriseModal, | |
| shouldGetPrivacyModal: shouldGetPrivacyModal | |
| } | |
| }; | |
| var PathFilterManager = function(activeList, shouldAddCategoryToList, environment, gatewayData) { | |
| var shouldAddCategoryToList = shouldAddCategoryToList, | |
| tagsWithFiltersRegEx, tagsWithAllowPaths = [], | |
| tagsWithBlockPaths = [], | |
| BLOCKED_KEY = gatewayData.info.name + "_ENSIGHTEN_BLOCKED_URLS", | |
| ALLOWED_KEY = gatewayData.info.name + "_ENSIGHTEN_ALLOWED_URLS"; | |
| var allowRequest = function(domain, path, targetListCheckPasses) { | |
| var allowRequest = targetListCheckPasses; | |
| if (tagsWithFiltersRegEx.test(domain)) { | |
| if (path === "") return allowRequest; | |
| for (var tagsWithAllowPathsCount = 0; tagsWithAllowPathsCount < tagsWithAllowPaths.length; tagsWithAllowPathsCount++) { | |
| var allowPathRegEx = new RegExp(tagsWithAllowPaths[tagsWithAllowPathsCount]["tag"]); | |
| if (allowPathRegEx.test(domain)) { | |
| var allowReg = []; | |
| allowReg = allowReg.concat(tagsWithAllowPaths[tagsWithAllowPathsCount]["paths"]); | |
| allowReg = utilities.arrayToRegex(allowReg); | |
| if (allowReg.test(path)) { | |
| allowRequest = true; | |
| return allowRequest | |
| } else allowRequest = false | |
| } | |
| } | |
| for (var tagsWithBlockPathsCount = 0; tagsWithBlockPathsCount < tagsWithBlockPaths.length; tagsWithBlockPathsCount++) { | |
| var domainRegEx = new RegExp(tagsWithBlockPaths[tagsWithBlockPathsCount]["tag"]); | |
| if (domainRegEx.test(domain)) { | |
| var blockReg = []; | |
| blockReg = blockReg.concat(tagsWithBlockPaths[tagsWithBlockPathsCount]["paths"]); | |
| blockReg = utilities.arrayToRegex(blockReg); | |
| if (blockReg.test(path)) { | |
| allowRequest = false; | |
| return allowRequest | |
| } else allowRequest = true | |
| } | |
| } | |
| } | |
| return allowRequest | |
| }, | |
| buildPathFilterList = function() { | |
| var tagsWithFilters = []; | |
| var filteredCategoryList = []; | |
| for (var category in activeList) { | |
| filteredCategoryList.push(activeList[category]); | |
| if (shouldAddCategoryToList(category)) parseCategoriesForPath(activeList[category], tagsWithFilters, tagsWithBlockPaths, tagsWithAllowPaths); | |
| var allowedURLS = localStorage.getItem(ALLOWED_KEY) ? JSON.parse(localStorage.getItem(ALLOWED_KEY)) : | |
| ""; | |
| if (allowedURLS) parseCategoriesForPath(allowedURLS, tagsWithFilters, tagsWithBlockPaths, tagsWithAllowPaths); | |
| var blockedURLs = localStorage.getItem(BLOCKED_KEY) ? JSON.parse(localStorage.getItem(BLOCKED_KEY)) : ""; | |
| if (blockedURLs) parseCategoriesForPath(blockedURLs, tagsWithFilters, tagsWithBlockPaths, tagsWithAllowPaths) | |
| } | |
| tagsWithFiltersRegEx = utilities.arrayToRegex(tagsWithFilters) | |
| }, | |
| update = function() { | |
| buildPathFilterList() | |
| }, | |
| init = function() { | |
| buildPathFilterList() | |
| }; | |
| init(); | |
| return { | |
| allowRequest: allowRequest, | |
| update: update | |
| } | |
| }; | |
| function parseCategoriesForPath(tagList, tagsWithFilters, tagsWithBlockPaths, tagsWithAllowPaths) { | |
| for (var index = 0; index < tagList.length; index++) { | |
| var tagItem = tagList[index]; | |
| if (tagItem["filter"]) { | |
| tagsWithFilters.push(tagItem["tag"]); | |
| if (tagItem["filter"] === "blockPaths") tagsWithBlockPaths.push({ | |
| tag: tagItem["tag"], | |
| paths: tagItem["paths"] | |
| }); | |
| else if (tagItem["filter"] == "allowPaths") tagsWithAllowPaths.push({ | |
| tag: tagItem["tag"], | |
| paths: tagItem["paths"] | |
| }) | |
| } | |
| } | |
| } | |
| var ListManager = function(environment, gatewayData, defaultCategory, | |
| cookieManager) { | |
| var activeList, environment = environment, | |
| listRegex, alwaysAllowedListRegex, pathFilterManager = null, | |
| usesPathFilter = false, | |
| usesWhiteList = true, | |
| BLOCKED_KEY = gatewayData.info.name + "_ENSIGHTEN_BLOCKED_URLS", | |
| initalized = false, | |
| ALLOWED_KEY = gatewayData.info.name + "_ENSIGHTEN_ALLOWED_URLS"; | |
| var init = function() { | |
| buildListRegex(environment); | |
| initalized = true | |
| }, | |
| buildListRegex = function(environment) { | |
| setUsesWhitelist(environment); | |
| setActiveList(environment); | |
| if (usesWhiteList === true) buildListRegexForAlwaysAllowedDomains(); | |
| var list = getList(), | |
| reg = []; | |
| var listUsesObject = false; | |
| for (var cat in list) | |
| if (list[cat][0] && typeof list[cat][0] === "object") listUsesObject = true; | |
| var addToList = function(listVals) { | |
| if (listUsesObject) reg = reg.concat(getObjectsVals(list[listVals], "tag")); | |
| else reg = reg.concat(list[listVals]) | |
| }; | |
| for (var category in list) | |
| if (shouldAddToListRegex(category)) addToList(category); | |
| var allowedURLS = localStorage.getItem(ALLOWED_KEY) ? JSON.parse(localStorage.getItem(ALLOWED_KEY)) : ""; | |
| var blockedURLs = localStorage.getItem(BLOCKED_KEY) ? | |
| JSON.parse(localStorage.getItem(BLOCKED_KEY)) : ""; | |
| if (usesWhiteList) { | |
| if (allowedURLS) reg = reg.concat(getObjectsVals(allowedURLS, "tag")); | |
| if (blockedURLs) reg = reg.filter(function(element) { | |
| return !getObjectsVals(blockedURLs, "tag").includes(element) | |
| }) | |
| } else { | |
| if (blockedURLs) reg = reg.concat(getObjectsVals(blockedURLs, "tag")); | |
| if (allowedURLS) reg = reg.filter(function(element) { | |
| return !getObjectsVals(allowedURLS, "tag").includes(element) | |
| }) | |
| } | |
| listRegex = utilities.arrayToRegex(reg) | |
| }, | |
| shouldAddToListRegex = function(category) { | |
| var shouldAddToListRegex = | |
| false; | |
| if (category == defaultCategory) { | |
| shouldAddToListRegex = true; | |
| return shouldAddToListRegex | |
| } | |
| if (usesWhiteList) | |
| if (this.cookieManager.getCookie(category) == "1") shouldAddToListRegex = true; | |
| else { | |
| if (this.cookieManager.getCookie(category) !== "0" && environmentOptsValEquals(category, 1)) shouldAddToListRegex = true | |
| } else if (this.cookieManager.getCookie(category) == "0") shouldAddToListRegex = true; | |
| else if (this.cookieManager.getCookie(category) !== "1" && environmentOptsValEquals(category, 0)) shouldAddToListRegex = true; | |
| return shouldAddToListRegex | |
| }, | |
| environmentOptsValEquals = function(opt, val) { | |
| return environment && environment.optVals[opt] == val | |
| }, | |
| getObjectsVals = function(arrayOfObjects, key) { | |
| var arrayOfObjectVals = []; | |
| for (var i = 0; i < arrayOfObjects.length; i++) { | |
| var val = arrayOfObjects[i][key]; | |
| arrayOfObjectVals.push(val); | |
| if (arrayOfObjects["filter"]) usesPathFilter = true | |
| } | |
| if (usesPathFilter) pathFilterManager = new PathFilterManager(getList(), shouldAddToListRegex, environment, gatewayData); | |
| return arrayOfObjectVals | |
| }, | |
| getList = function() { | |
| return activeList | |
| }, | |
| getListRegex = | |
| function() { | |
| return listRegex | |
| }, | |
| getCategoryTranslations = function(category) { | |
| if (environment.translation && environment.translation.purposes) | |
| for (var i = 0; i < category.length; i++) { | |
| var translatedPurposes = []; | |
| if (category[i].purpose) | |
| for (var j = 0; j < category[i].purpose.length; j++) translatedPurposes.push(environment.translation.purposes[category[i].purpose[j]]); | |
| category[i].purpose = translatedPurposes | |
| } | |
| return category | |
| }, | |
| getTranslatedList = function() { | |
| var fullList = getList(), | |
| translatedList = fullList; | |
| for (var category in fullList) | |
| if (category !== | |
| "default") translatedList[category] = getCategoryTranslations(fullList[category]); | |
| return translatedList | |
| }, | |
| getUsesWhitelist = function() { | |
| return usesWhiteList | |
| }, | |
| setUsesWhitelist = function(environment) { | |
| if (environment && environment.hasOwnProperty("usesWhitelist")) usesWhiteList = environment.usesWhitelist; | |
| else if (gatewayData.featureToggles.hasOwnProperty("usesWhitelist")) usesWhiteList = gatewayData.featureToggles.usesWhitelist; | |
| else usesWhiteList = true | |
| }, | |
| setActiveList = function(environment) { | |
| if (usesWhiteList) | |
| if (environment && | |
| environment.hasOwnProperty("whitelist")) activeList = environment.whitelist; | |
| else activeList = gatewayData.whitelist || {}; | |
| else if (environment && environment.hasOwnProperty("blacklist")) activeList = environment.blacklist; | |
| else activeList = gatewayData.blacklist || {}; | |
| if (!activeList.hasOwnProperty(defaultCategory) && usesWhiteList === true) activeList[defaultCategory] = []; | |
| var listUsesObject = false; | |
| for (var cat in activeList) | |
| if (activeList[cat][0] && typeof activeList[cat][0] === "object") listUsesObject = true; | |
| if (usesWhiteList && !initalized) { | |
| var nexusDomain = | |
| gatewayData.info.nexus || "nexus.ensighten.com"; | |
| if (listUsesObject) { | |
| activeList[defaultCategory].push({ | |
| tag: location.hostname | |
| }); | |
| activeList[defaultCategory].push({ | |
| tag: nexusDomain | |
| }) | |
| } else { | |
| activeList[defaultCategory].push(location.hostname); | |
| activeList[defaultCategory].push(nexusDomain) | |
| } | |
| } | |
| }, | |
| allowRequest = function(hostName, pathName, targetListCheckPasses) { | |
| var listRegEx = getListRegex(); | |
| var targetListCheckPasses = false; | |
| if (getUsesWhitelist() === false) { | |
| if (listRegEx.test && !listRegEx.test(hostName)) targetListCheckPasses = | |
| true | |
| } else if (listRegEx.test && listRegEx.test(hostName)) targetListCheckPasses = true; | |
| if (pathFilterManager) targetListCheckPasses = pathFilterManager.allowRequest(hostName, pathName, targetListCheckPasses, listRegEx); | |
| return targetListCheckPasses | |
| }, | |
| updateListValues = function() { | |
| buildListRegex(environment); | |
| pathFilterManager.update() | |
| }, | |
| updateEnvironment = function(newEnv) { | |
| environment = newEnv; | |
| buildListRegex(newEnv); | |
| pathFilterManager.update() | |
| }, | |
| buildListRegexForAlwaysAllowedDomains = function() { | |
| var alwaysAllowedDomains = getList() ? | |
| getList()[defaultCategory] || [] : []; | |
| var objectValues = getObjectsVals(alwaysAllowedDomains, "tag"); | |
| alwaysAllowedListRegex = utilities.arrayToRegex(objectValues) | |
| }, | |
| getAlwaysAllowedListRegex = function() { | |
| return alwaysAllowedListRegex || new RegExp("a^") | |
| }; | |
| init(); | |
| return { | |
| getList: getList, | |
| getListRegex: getListRegex, | |
| getTranslatedList: getTranslatedList, | |
| getUsesWhitelist: getUsesWhitelist, | |
| allowRequest: allowRequest, | |
| updateEnvironment: updateEnvironment, | |
| updateListValues: updateListValues, | |
| getAlwaysAllowedListRegex: getAlwaysAllowedListRegex, | |
| ALLOWED_KEY: ALLOWED_KEY, | |
| BLOCKED_KEY: BLOCKED_KEY | |
| } | |
| }; | |
| var Banner = function(gatewayData, environment, cookieModal, cookieManager) { | |
| var e = document.createElement("div"); | |
| var bannerCopy = environment.translation.notificationBannerContent; | |
| var bannerViewed = function() { | |
| var oldCookies = cookieManager.getCookiesFromTypes(["BANNER_VIEWED"]); | |
| cookieManager.setCookie("BANNER_VIEWED", "1"); | |
| var newCookies = cookieManager.getCookiesFromTypes(["BANNER_VIEWED"]); | |
| consentReporter.sendReport(oldCookies, newCookies) | |
| }; | |
| var checkCopyForLinks = | |
| function() { | |
| bannerCopy = bannerCopy.replace(/{{/i, "\x3cspan id\x3d'ensModalLink' class\x3d'ensModalLink'\x3e"); | |
| bannerCopy = bannerCopy.replace(/}}/i, "\x3c/span\x3e") | |
| }; | |
| var closeEnsBanner = function() { | |
| bannerViewed(); | |
| var banner = document.getElementById("ensNotifyBanner"); | |
| banner.style.display = "none" | |
| }; | |
| var ensBannerShowModal = function() { | |
| closeEnsBanner(); | |
| if (cookieModal.openModal) cookieModal.openModal() | |
| }; | |
| var openBannerCheck = function() { | |
| var ensBannerHasBeenViewed = cookieManager.getCookie("BANNER_VIEWED"); | |
| if (!ensBannerHasBeenViewed) openEnsBanner() | |
| }; | |
| var openEnsBanner = function() { | |
| var banner = document.getElementById("ensNotifyBanner"); | |
| banner.style.display = "block"; | |
| var parentWidth = window.innerWidth / 2; | |
| var elementWidth = parseInt(window.getComputedStyle(banner).width) / 2; | |
| banner.style.left = parentWidth - elementWidth + "px" | |
| }; | |
| var styleString = "" + ".ensNotifyBanner{" + "background-color: #191B23;" + "color: #EDEDED;" + "opacity: 0.8;" + "width:60%;" + "border-radius: 10px;" + "padding:20px;" + "font-family: Roboto, 'Helvetica Neue', Helvetica, Arial;" + "position: fixed;" + "bottom:50px;" + | |
| "display: none;" + "z-index: 9999;" + "}" + ".ensButtons{" + "clear: both;" + "margin-top: 15px;" + "float: right;" + "}" + ".ensButtons .button{" + "display: inline-block;" + "position: relative;" + "width: 120px;" + "height: 32px;" + "line-height: 32px;" + "border-radius: 2px;" + "font-size: 0.9em;" + "background-color: #fff;" + "color: #646464;" + "margin-left: 20px;" + "text-align: center;" + "}" + ".ensButtons .button{" + "cursor: pointer;" + "}" + ".ensButtons .button.grey {" + "background-color: #eee;" + "}" + ".ensButtons .button.blue {" + "background-color: #4285f4;" + | |
| "color: #fff;" + "}" + ".ensButtons .button.raised {" + "transition: box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);" + "transition-delay: 0.2s;" + "box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);" + "}" + ".ensButtons .button.raised:active {" + "box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2);" + "transition-delay: 0s;" + "}" + ".ensClear{" + " clear:both;" + "}" + ".ensModalLink{" + " cursor: pointer;" + " text-decoration: underline;" + "}" + ".ensModalLink:hover{" + " color: #4285f4;" + "}"; | |
| var setBannerCopy = function(copy) { | |
| bannerCopy = copy; | |
| checkCopyForLinks() | |
| }; | |
| var setBannerMarkup = function(translation) { | |
| bannerMarkup = "\x3cdiv id\x3d'ensNotifyBanner' class\x3d'ensNotifyBanner'\x3e" + "\x3cdiv\x3e" + bannerCopy + "\x3c/div\x3e" + "\x3cdiv class\x3d'ensButtons'\x3e" + "\x3cdiv id\x3d'ensCloseBanner' class\x3d'button raised blue'\x3e" + translation.close + "\x3c/div\x3e" + "\x3c/div\x3e" + "\x3cdiv class\x3d'ensClear'\x3e\x3c/div\x3e" + "\x3c/div\x3e" | |
| }; | |
| var getBannerMarkup = function() { | |
| return bannerMarkup | |
| }; | |
| var isEnabledPrivacyNotice = function(env) { | |
| return env && env.hasOwnProperty("enablePrivacyNotice") ? | |
| env.enablePrivacyNotice : gatewayData.featureToggles.enablePrivacyNotice | |
| }; | |
| var update = function(env) { | |
| if (isEnabledPrivacyNotice(env)) { | |
| var banner = document.getElementById("ensNotifyBanner"); | |
| var modal = document.getElementById("ensModalWrapper"); | |
| if (banner === null) { | |
| checkCopyForLinks(); | |
| setBannerMarkup(env.translation); | |
| e.innerHTML = bannerMarkup; | |
| var injectBanner = function() { | |
| setTimeout(function() { | |
| document.body.insertBefore(e, document.body.lastChild); | |
| utilities.addStyleElement(styleString); | |
| addEventListeners(); | |
| openBannerCheck() | |
| }, | |
| 100) | |
| }; | |
| utilities.domReady(injectBanner) | |
| } else { | |
| bannerDisplayStyle = banner.style.display; | |
| modalDisplayStyle = modal.style.display; | |
| setBannerCopy(env.translation.notificationBannerContent); | |
| setBannerMarkup(env.translation); | |
| e.innerHTML = bannerMarkup; | |
| if (bannerDisplayStyle === "block") openEnsBanner(); | |
| if (modalDisplayStyle === "block") ensBannerShowModal(); | |
| addEventListeners() | |
| } | |
| } | |
| }; | |
| var addEventListeners = function() { | |
| var openModalLink = document.getElementsByClassName("ensModalLink"); | |
| var closeBannerButton = document.getElementById("ensCloseBanner"); | |
| for (var i = 0; i < openModalLink.length; i++) openModalLink[i].addEventListener("click", ensBannerShowModal); | |
| closeBannerButton.addEventListener("click", closeEnsBanner) | |
| }; | |
| var init = function() { | |
| update(environment) | |
| }(); | |
| var testObject = { | |
| bannerViewed: bannerViewed, | |
| ensBannerShowModal: ensBannerShowModal | |
| }; | |
| return { | |
| closeEnsBanner: closeEnsBanner, | |
| openEnsBanner: openEnsBanner, | |
| update: update | |
| } | |
| }; | |
| var ConsentModal = function(gatewayData, environment, tagPurposes, cookieManager, updateLists, consentReporter) { | |
| var styleString = "" + ".ensCenter{" + | |
| "text-align: center;" + "}" + "#ensModalWrapper{" + "border: 1px solid #333;" + "position: fixed;" + "max-width: 60%;" + "border: 1px solid #000;" + "display: block;" + "box-shadow: 5px 5px 5px grey;" + "background-color:#fff;" + "padding: 20px 0;" + "z-index: 9999;" + "}" + ".ensModal {" + "font-family: Roboto, 'Helvetica Neue', Helvetica, Arial;" + "min-width: 400px;" + "max-width: 400px;" + "}" + ".ensModal input[type\x3d'checkbox'] {" + "display: none;" + "}" + ".ensModal input[type\x3d'checkbox']:checked ~ .toggle {" + "background: #fff;" + | |
| "left: 36px;" + "transition: .5s;" + "}" + ".ensModal input[type\x3d'checkbox']:checked ~ .switch {" + "background: #43A047;" + "transition: .5s;" + "}" + ".ensModal .switch {" + "display: block;" + "width: 50px;" + "height: 15px;" + "background: #939393;" + "border-radius: 10px;" + "position: absolute;" + "top: 0;" + "transition: .5s;" + "}" + ".ensModal .toggle {" + "height: 17px;" + "width: 17px;" + "border-radius: 50%;" + "background: white;" + "position: absolute;" + "top: -2px;" + "left: -2px;" + "box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);" + | |
| "transition: .5s;" + "}" + ".ensModal .card {" + "display: inline-block;" + "margin: 9px;" + "margin: 5px;" + "width: 50px;" + "height: 20px;" + "text-align: center;" + "position: relative;" + "float:right;" + "}" + ".ensModal{" + "font-size: 18px;" + "color: #333;" + "padding: 20px 20px 0px 20px;" + "}" + ".ensToggleRow{" + "margin-bottom: 10px;" + "}" + ".ensToggleLabel{" + "margin-right: 5px;" + "}" + ".ensButtons{" + "clear: both;" + "margin-top: 15px;" + "float: right;" + "}" + ".ensButtons .button{" + "display: inline-block;" + "position: relative;" + | |
| "width: 120px;" + "height: 32px;" + "line-height: 32px;" + "border-radius: 2px;" + "font-size: 0.9em;" + "background-color: #fff;" + "color: #646464;" + "margin-left: 20px;" + "}" + ".ensButtons .button.grey {" + "background-color: #eee;" + "}" + ".ensButtons .button.blue {" + "background-color: #4285f4;" + "color: #fff;" + "}" + ".ensButtons .button.raised {" + "transition: box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);" + "transition-delay: 0.2s;" + "box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);" + "}" + ".ensButtons .button.raised:active {" + | |
| "box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2);" + "transition-delay: 0s;" + "}" + ".ensModal .ensTitle {" + "margin:5px;" + "width:95%;" + "color: #74736F;" + "position: absolute;" + "top:-5px;" + "left:-5px;" + "padding-left:5%;" + "padding-top:13px;" + "padding-bottom: 3px;" + "text-align: center;" + "}" + ".ensModal .consentDescription {" + "color:#333;" + "font-size: 14px;" + "}" + ".ensModal hr {" + "color: #C5C5C5" + "}" + ".ensModal .description {" + "max-width:600px;" + "font-size: 12px;" + "marin-top:15px;" + "clear: both;" + "}" + ".mdl-shadow--2dp {" + | |
| "box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), 0 3px 1px -2px rgba(0,0,0,.2), 0 1px 5px 0 rgba(0,0,0,.12);" + "}" + ".mdl-data-table {" + "position: relative;" + "border: 1px solid rgba(0,0,0,.12);" + "border-collapse: collapse;" + "white-space: nowrap;" + "font-size: 13px;" + "background-color: #fff;" + "}" + ".mdl-data-table thead {" + "padding-bottom: 3px;" + "}" + "tr{" + "display: table-row;" + "vertical-align: inherit;" + "border-color: inherit;" + "}" + ".mdl-data-table td:first-of-type, .mdl-data-table th:first-of-type {" + "padding-left: 24px;" + | |
| "}" + ".mdl-data-table__cell--non-numeric.mdl-data-table__cell--non-numeric {" + "text-align: left;" + "}" + "tbody {" + "display: table-row-group;" + "vertical-align: middle;" + "border-color: inherit;" + "}" + ".mdl-data-table tbody tr {" + "position: relative;" + "height: 48px;" + "transition-duration: .28s;" + "transition-timing-function: cubic-bezier(.4,0,.2,1);" + "transition-property: background-color;" + "}" + ".mdl-data-table td:first-of-type, .mdl-data-table th:first-of-type {" + "padding-left: 24px;" + "}" + ".mdl-data-table td, .mdl-data-table td .mdl-data-table__select {" + | |
| "vertical-align: middle;" + "}" + ".mdl-data-table td {" + "position: relative;" + "height: 48px;" + "border-top: 1px solid rgba(0,0,0,.12);" + "border-bottom: 1px solid rgba(0,0,0,.12);" + "padding: 12px 18px;" + "box-sizing: border-box;" + "}" + ".mdl-data-table th {" + "position: relative;" + "vertical-align: bottom;" + "text-overflow: ellipsis;" + "font-weight: 700;" + "line-height: 24px;" + "letter-spacing: 0;" + "height: 48px;" + "font-size: 12px;" + "color: rgba(0,0,0,.54);" + "padding-bottom: 8px;" + "box-sizing: border-box;" + "}" + | |
| ".mdl-data-table th {" + "padding: 0 18px 12px 18px;" + "text-align: right;" + "}" + ".mdl-navigation__link {" + "color: #424242;" + "margin: 0;" + "font-size: 14px;" + "font-weight: 400;" + "line-height: 24px;" + "letter-spacing: 0;" + "opacity: .87;" + "}"; | |
| ensShowMore = function() { | |
| var showMoreLink = document.getElementById("ensShowMoreLink"); | |
| var tagsTable = document.getElementById("ensTagsTable"); | |
| if (showMoreLink.innerText === "Show More") { | |
| showMoreLink.innerText = "Show Less"; | |
| tagsTable.style.display = "block" | |
| } else { | |
| showMoreLink.innerText = | |
| "Show More"; | |
| tagsTable.style.display = "none" | |
| } | |
| }; | |
| var isEnabledConsentModal = function(env) { | |
| return env && env.hasOwnProperty("enableConsentModal") ? env.enableConsentModal : gatewayData.featureToggles.enableConsentModal | |
| }; | |
| var that = this; | |
| this.environment = environment; | |
| this.cookieVals = []; | |
| this.allowAll = function() { | |
| var clientName = gatewayData.info.name, | |
| oldCookies = cookieManager.getCookiesFromTypes(gatewayData.cookieTypes); | |
| for (var i = 0; i < gatewayData.cookieTypes.length; i++) cookieManager.setCookie(gatewayData.cookieTypes[i], | |
| 1); | |
| var newCookies = cookieManager.getCookiesFromTypes(gatewayData.cookieTypes); | |
| consentReporter.sendReport(oldCookies, newCookies) | |
| }; | |
| this.closeModal = function() { | |
| that.divElement.style.display = "none" | |
| }; | |
| this.denyAll = function() { | |
| var clientName = gatewayData.info.name, | |
| oldCookies = cookieManager.getCookiesFromTypes(gatewayData.cookieTypes); | |
| for (var i = 0; i < gatewayData.cookieTypes.length; i++) cookieManager.setCookie(gatewayData.cookieTypes[i], 0); | |
| var newCookies = cookieManager.getCookiesFromTypes(clientName, gatewayData.cookieTypes); | |
| consentReporter.sendReport(oldCookies, newCookies) | |
| }; | |
| this.divElement = document.createElement("div"); | |
| this.getInnerModalString = function() { | |
| return "" | |
| }; | |
| this.init = function() { | |
| that.update(environment) | |
| }; | |
| this.injectModal = function() { | |
| utilities.addStyleElement(styleString); | |
| document.body.insertBefore(that.divElement, document.body.lastChild); | |
| that.setHTMLBindings(); | |
| that.openModalCheck() | |
| }; | |
| this.modalViewed = function() { | |
| var clientName = gatewayData.info.name, | |
| oldCookies = cookieManager.getCookiesFromTypes(["MODAL_VIEWED"]); | |
| var topLevelDomain = | |
| document.location.hostname; | |
| cookieManager.setCookie("MODAL_VIEWED", "1"); | |
| var newCookies = cookieManager.getCookiesFromTypes(["MODAL_VIEWED"]); | |
| consentReporter.sendReport(oldCookies, newCookies) | |
| }; | |
| this.openModal = function() { | |
| that.divElement.style.display = "block"; | |
| var parentWidth = window.innerWidth / 2; | |
| var parentHeight = window.innerHeight / 2; | |
| var modalObject = parseInt(window.getComputedStyle(that.divElement)); | |
| var elementWidth = parseInt(window.getComputedStyle(that.divElement).width) / 2; | |
| var elementHeight = parseInt(window.getComputedStyle(that.divElement).height) / | |
| 2; | |
| that.divElement.style.left = parentWidth - elementWidth + "px"; | |
| that.divElement.style.top = parentHeight - elementHeight + "px" | |
| }; | |
| this.openModalCheck = function() { | |
| var ensModalHasBeenViewed = cookieManager.getCookie("MODAL_VIEWED"); | |
| if (!ensModalHasBeenViewed) that.openModal() | |
| }; | |
| this.getModalHtmlString = function() { | |
| var modalHtmlString = "\x3cdiv class\x3d'ensModal'\x3e" + "\x3cdiv class\x3d'ensTitle'\x3e" + that.environment.translation["consentTitle"] + "\x3c/div\x3e" + "\x3cdiv class\x3d'consentDescription'\x3e" + that.environment.translation["consentDescription"] + | |
| "\x3c/div\x3e" + "\x3cdiv\x3e\x3c/div\x3e" + "\x3cbr\x3e" + "\x3cdiv style\x3d'float:right;'\x3e\x3ca class\x3d'mdl-navigation__link closed' onclick\x3d'ensShowMore()' id\x3d'ensShowMoreLink' href\x3d'#' style\x3d'text-decoration: underline;'\x3eShow More\x3c/a\x3e\x3c/div\x3e" + "\x3cdiv\x3e\x3cbr\x3e\x3cbr\x3e\x3c/div\x3e" + "\x3cdiv style\x3d'max-height:300px; overflow-y: scroll; max-width: 100%'\x3e" + "\x3ctable id\x3d'ensTagsTable' class\x3d'mdl-data-table mdl-js-data-table mdl-data-table--selectable mdl-shadow--2dp' style\x3d'display:none;'\x3e" + | |
| "\x3ctr\x3e\x3cth class\x3d'mdl-data-table__cell--non-numeric'\x3eTag\x3c/th\x3e\x3cth class\x3d'mdl-data-table__cell--non-numeric'\x3ePurposes\x3c/th\x3e\x3c/tr\x3e"; | |
| for (var cat in tagPurposes) | |
| if (cat !== "default") | |
| for (var i = 0; i < tagPurposes[cat].length; i++) modalHtmlString += "\x3ctr\x3e\x3ctd class\x3d'mdl-data-table__cell--non-numeric'\x3e" + tagPurposes[cat][i].displayName + "\x3c/td\x3e\x3ctd class\x3d'mdl-data-table__cell--non-numeric'\x3e" + tagPurposes[cat][i].purpose.join(", ") + "\x3c/td\x3e\x3c/tr\x3e"; | |
| modalHtmlString += "\x3c/table\x3e" + "\x3c/div\x3e" + "\x3cpaper-ripple fit\x3e\x3c/paper-ripple\x3e" + "\x3c/div\x3e" + "\x3cdiv style\x3d'padding:0 20px;'\x3e" + that.getInnerModalString() + "\x3c/div\x3e" + "\x3cdiv style\x3d'clear:both; font-size:8px; text-align: center; padding-top:20px;'\x3e\x3ca href\x3d'https://www.ensighten.com/products/enterprise-tag-management/privacy/' target\x3d'_blank' style\x3d'text-decoration: none; color: #424242;'\x3eGDPR Compliance - Powered By Ensighten\x3c/a\x3e\x3c/div\x3e"; | |
| return modalHtmlString | |
| }; | |
| this.setHTMLBindings = function() {}; | |
| this.update = function(environment) { | |
| if (isEnabledConsentModal(environment)) { | |
| that.environment = environment; | |
| that.divElement.innerHTML = that.getModalHtmlString(); | |
| if (document.getElementById(that.divElement.id) === null) utilities.domReady(that.injectModal) | |
| } | |
| }; | |
| this.divElement.id = "ensModalWrapper"; | |
| return this | |
| }; | |
| var ConsentWidget = function(environment, gatewayData) { | |
| var that = this; | |
| this.widgetString = ""; | |
| this.styleString = "" + ".consentWidget {" + "border-radius: 2px;" + | |
| "font-size:10px;" + "position: fixed;" + "bottom: 0px;" + "right: 5%;" + "cursor: default;" + "background-color: #323232;" + "z-index: 3;" + "display: block;" + " font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif;" + "}" + ".consentWidget__text {" + "padding: 14px 12px;" + "vertical-align: middle;" + "color: #fff;" + "float: left;" + "}"; | |
| this.divElement = document.createElement("div"); | |
| this.divElement.id = "ensConsentWidget"; | |
| this.divElement.className = "consentWidget"; | |
| var isEnabledConsentModal = function(env) { | |
| return env && env.hasOwnProperty("enableConsentModal") ? | |
| env.enableConsentModal : gatewayData.featureToggles.enableConsentModal | |
| }; | |
| this.update = function(environment) { | |
| if (isEnabledConsentModal(environment)) { | |
| that.setWidgetString(environment); | |
| that.divElement.innerHTML = that.getWidgetString(); | |
| if (document.getElementById("ensConsentWidget") === null) utilities.domReady(that.injectWidget) | |
| } | |
| }; | |
| this.setWidgetString = function(environment) { | |
| that.widgetString = "\x3cdiv class\x3d'consentWidget__text' id\x3d'consentWidget__text'\x3e" + environment.translation["consentWidgetCopy"] + "\x3c/div\x3e" | |
| }; | |
| this.getWidgetString = function() { | |
| return that.widgetString | |
| }; | |
| this.injectWidget = function() { | |
| setTimeout(function() { | |
| utilities.addStyleElement(that.styleString); | |
| document.body.insertBefore(that.divElement, document.body.lastChild); | |
| that.setHTMLBindings() | |
| }, 100) | |
| }; | |
| this.setHTMLBindings = function() { | |
| document.getElementById("ensConsentWidget").addEventListener("click", updateConsent); | |
| function updateConsent() { | |
| if (Bootstrapper.gateway.openModal) Bootstrapper.gateway.openModal() | |
| } | |
| }; | |
| this.update(environment); | |
| return this | |
| }; | |
| var NoTogglesConsentModal = | |
| function(gatewayData, environment, tagPurposes, cookieManager, updateLists, consentReporter) { | |
| var modal = new ConsentModal(gatewayData, environment, tagPurposes, cookieManager, [], consentReporter); | |
| modal.getInnerModalString = function() { | |
| return "\x3cdiv class\x3d'ensButtons'\x3e" + "\x3cdiv id\x3d'ensDeny' class\x3d'button raised grey'\x3e" + "\x3cdiv class\x3d'ensCenter'\x3e" + environment.translation.deny + "\x3c/div\x3e" + "\x3cpaper-ripple fit\x3e\x3c/paper-ripple\x3e" + "\x3c/div\x3e" + "\x3cdiv id\x3d'ensAllow' class\x3d'button raised blue'\x3e" + | |
| "\x3cdiv class\x3d'ensCenter' fit\x3e" + environment.translation.allow + "\x3c/div\x3e" + "\x3cpaper-ripple fit\x3e\x3c/paper-ripple\x3e" + "\x3c/div\x3e" + "\x3c/div\x3e" + "\x3c/div\x3e" | |
| }; | |
| modal.setHTMLBindings = function() { | |
| var allowButton = document.getElementById("ensAllow"); | |
| var denyButton = document.getElementById("ensDeny"); | |
| allowButton.addEventListener("click", function() { | |
| modal.allowAll(); | |
| modal.closeModal(); | |
| modal.modalViewed(); | |
| updateLists() | |
| }); | |
| denyButton.addEventListener("click", function() { | |
| modal.denyAll(); | |
| modal.closeModal(); | |
| modal.modalViewed(); | |
| updateLists() | |
| }) | |
| }; | |
| modal.init(); | |
| return modal | |
| }; | |
| var CookieModal = function(cookieManager, updateLists, consentReporter, environment, gatewayData) { | |
| var e = document.createElement("div"); | |
| e.id = "ensModalWrapper"; | |
| var cookieVals = []; | |
| var modalHtmlString = ""; | |
| var getCurrentCookieVal = function(key) { | |
| var checkBox = document.getElementById(key + "Slide"); | |
| var retVal = 0; | |
| if (checkBox.checked) retVal = 1; | |
| return retVal | |
| }; | |
| var saveNewCookieValues = function() { | |
| var oldCookies = cookieManager.getCookiesFromTypes(gatewayData.cookieTypes); | |
| for (var i = 0; i < gatewayData.cookieTypes.length; i++) cookieManager.setCookie(gatewayData.cookieTypes[i], getCurrentCookieVal(gatewayData.cookieTypes[i])); | |
| var newCookies = cookieManager.getCookiesFromTypes(gatewayData.cookieTypes); | |
| consentReporter.sendReport(oldCookies, newCookies); | |
| closeModal() | |
| }; | |
| var cookieTypesCount = gatewayData.cookieTypes.length; | |
| var openModal = function() { | |
| e.style.display = "block"; | |
| var parentWidth = window.innerWidth / 2; | |
| var parentHeight = window.innerHeight / 2; | |
| var modalObject = parseInt(window.getComputedStyle(e)); | |
| var elementWidth = parseInt(window.getComputedStyle(e).width) / 2; | |
| var elementHeight = parseInt(window.getComputedStyle(e).height) / 2; | |
| e.style.left = parentWidth - elementWidth + "px"; | |
| e.style.top = parentHeight - elementHeight + "px" | |
| }; | |
| var closeModal = function() { | |
| e.style.display = "none" | |
| }; | |
| var shouldOptBeChecked = function(defaultVal, cookieKey) { | |
| var shouldBeChecked = ""; | |
| var localCookieVal = cookieManager.getCookie(cookieKey); | |
| if (defaultVal == 1 || localCookieVal == "1") shouldBeChecked = " checked "; | |
| if (!localCookieVal && defaultVal != 1 || localCookieVal == | |
| "0" && defaultVal == 1) shouldBeChecked = ""; | |
| return shouldBeChecked | |
| }; | |
| var styleString = "" + ".ensCenter{" + "text-align: center;" + "}" + "#ensModalWrapper{" + "border: 1px solid #333;" + "position: fixed;" + "max-width: 80%;" + "border: 1px solid #000;" + "display: none;" + "box-shadow: 5px 5px 5px grey;" + "background-color:#fff;" + "padding: 20px 0;" + "z-index: 9999;" + "}" + ".ensModal {" + "font-family: Roboto, 'Helvetica Neue', Helvetica, Arial;" + "}" + ".ensModal input[type\x3d'checkbox'] {" + "display: none;" + "}" + ".ensModal input[type\x3d'checkbox']:checked ~ .toggle {" + | |
| "background: #fff;" + "left: 36px;" + "transition: .5s;" + "}" + ".ensModal input[type\x3d'checkbox']:checked ~ .switch {" + "background: #43A047;" + "transition: .5s;" + "}" + ".ensModal .switch {" + "display: block;" + "width: 50px;" + "height: 15px;" + "background: #939393;" + "border-radius: 10px;" + "position: absolute;" + "top: 0;" + "transition: .5s;" + "}" + ".ensModal .toggle {" + "height: 17px;" + "width: 17px;" + "border-radius: 50%;" + "background: white;" + "position: absolute;" + "top: -2px;" + "left: -2px;" + "box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);" + | |
| "transition: .5s;" + "}" + ".ensModal .card {" + "display: inline-block;" + "margin: 9px;" + "margin: 5px;" + "width: 50px;" + "height: 20px;" + "text-align: center;" + "position: relative;" + "float:right;" + "}" + ".ensModal{" + "font-size: 18px;" + "color: #333;" + "padding: 20px;" + "}" + ".ensToggleRow{" + "margin-bottom: 10px;" + "}" + ".ensToggleLabel{" + "margin-right: 5px;" + "}" + ".ensButtons{" + "clear: both;" + "margin-top: 15px;" + "float: right;" + "}" + ".ensButtons .button{" + "display: inline-block;" + "position: relative;" + "width: 120px;" + | |
| "height: 32px;" + "line-height: 32px;" + "border-radius: 2px;" + "font-size: 0.9em;" + "background-color: #fff;" + "color: #646464;" + "margin-left: 20px;" + "}" + ".ensButtons .button.grey {" + "background-color: #eee;" + "}" + ".ensButtons .button.blue {" + "background-color: #4285f4;" + "color: #fff;" + "}" + ".ensButtons .button.raised {" + "transition: box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);" + "transition-delay: 0.2s;" + "box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);" + "}" + ".ensButtons .button.raised:active {" + "box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2);" + | |
| "transition-delay: 0s;" + "}" + ".ensModal .ensTitle {" + "margin:5px;" + "width:95%;" + "color: #74736F;" + "position: absolute;" + "top:-5px;" + "left:-5px;" + "padding-left:5%;" + "padding-top:13px;" + "padding-bottom: 3px;" + "text-align: center;" + "}" + ".ensModal .consentDescription {" + "color:#333;" + "font-size: 14px;" + "}" + ".ensModal hr {" + "color: #C5C5C5" + "}" + ".ensModal .description {" + "max-width:600px;" + "font-size: 12px;" + "marin-top:15px;" + "clear: both;" + "}"; | |
| var getModalHtmlString = function() { | |
| return modalHtmlString | |
| }; | |
| var setModalHtmlString = function(optVals, translation, showTrustedDomains) { | |
| modalHtmlString = "" + "\x3cdiv class\x3d'ensModal'\x3e" + "\x3cdiv class\x3d'ensTitle'\x3e" + translation["consentTitle"] + "\x3c/div\x3e" + "\x3cdiv class\x3d'consentDescription'\x3e" + translation["consentDescription"] + "\x3c/div\x3e" + "\x3chr\x3e"; | |
| for (var propertyName in optVals) cookieVals.push(optVals[propertyName]); | |
| for (var prop in translation.cookies) | |
| if (showTrustedDomains === true && prop === "default") modalHtmlString = modalHtmlString + "\x3cdiv class\x3d'ensToggleRow' style\x3d'opacity: .5;'\x3e" + | |
| "\x3clabel class\x3d'ensToggleLabel'\x3e" + translation.cookies[prop]["title"] + "\x3cdiv class\x3d'card'\x3e" + "\x3cinput class\x3d'ensCheckbox' type\x3d'checkbox' name\x3d'check' disabled\x3d'disabled' checked\x3d'checked'/\x3e" + "\x3cspan class\x3d'switch'\x3e\x3c/span\x3e\x3cspan class\x3d'toggle'\x3e\x3c/span\x3e" + "\x3c/div\x3e" + "\x3c/label\x3e" + "\x3cdiv class\x3d'description'\x3e" + translation.cookies[prop]["description"] + "\x3c/div\x3e" + "\x3c/div\x3e" + "\x3chr\x3e"; | |
| else modalHtmlString = modalHtmlString + | |
| "\x3cdiv class\x3d'ensToggleRow'\x3e" + "\x3clabel for\x3d'" + prop + "Slide' class\x3d'ensToggleLabel'\x3e" + translation.cookies[prop]["title"] + "\x3cdiv class\x3d'card'\x3e" + "\x3cinput class\x3d'ensCheckbox' " + "type\x3d'checkbox' id\x3d'" + prop + "Slide' " + "name\x3d'" + prop + "Slide' " + shouldOptBeChecked(optVals[prop], prop) + "/\x3e" + "\x3cspan class\x3d'switch'\x3e\x3c/span\x3e\x3cspan class\x3d'toggle'\x3e\x3c/span\x3e" + "\x3c/div\x3e" + "\x3c/label\x3e" + "\x3cdiv class\x3d'description'\x3e" + translation.cookies[prop]["description"] + | |
| "\x3c/div\x3e" + "\x3c/div\x3e" + "\x3chr\x3e"; | |
| modalHtmlString = modalHtmlString + "\x3cdiv class\x3d'ensButtons'\x3e" + "\x3cdiv onclick\x3d'gateway.cookieModal.closeModal();' class\x3d'button raised grey'\x3e" + "\x3cdiv class\x3d'ensCenter'\x3e" + translation.cancel + "\x3c/div\x3e" + "\x3cpaper-ripple fit\x3e\x3c/paper-ripple\x3e" + "\x3c/div\x3e" + "\x3cdiv id\x3d'ensSave' class\x3d'button raised blue'\x3e" + "\x3cdiv class\x3d'ensCenter' fit\x3e" + translation.save + "\x3c/div\x3e" + "\x3cpaper-ripple fit\x3e\x3c/paper-ripple\x3e" + | |
| "\x3c/div\x3e" + "\x3c/div\x3e" + "\x3c/div\x3e" | |
| }; | |
| var isEnabledConsentModal = function(env) { | |
| return env && env.hasOwnProperty("enableConsentModal") ? env.enableConsentModal : gatewayData.featureToggles.enableConsentModal | |
| }; | |
| var isShowedTrustedDomains = function(env) { | |
| return env && env.hasOwnProperty("showTrustedDomains") ? env.showTrustedDomains : gatewayData.featureToggles.showTrustedDomains | |
| }; | |
| var addEventListeners = function() { | |
| var saveButton = document.getElementById("ensSave"); | |
| saveButton.addEventListener("click", function() { | |
| saveNewCookieValues(); | |
| updateLists() | |
| }) | |
| }; | |
| var update = function(env) { | |
| if (isEnabledConsentModal(env)) { | |
| setModalHtmlString(env.optVals, env.translation, isShowedTrustedDomains(env)); | |
| e.innerHTML = getModalHtmlString(); | |
| if (document.getElementById("ensModalWrapper") === null) { | |
| var injectModal = function() { | |
| setTimeout(function() { | |
| utilities.addStyleElement(styleString); | |
| document.body.insertBefore(e, document.body.lastChild); | |
| addEventListeners() | |
| }, 100) | |
| }; | |
| utilities.domReady(injectModal) | |
| } else addEventListeners() | |
| } | |
| }; | |
| (function init() { | |
| update(environment) | |
| })(); | |
| return { | |
| closeModal: closeModal, | |
| openModal: openModal, | |
| update: update | |
| } | |
| }; | |
| function ConsentReporter(imageReference, environmentName, modalType, defaultOptions, clientId, clientName, publishPath, mode, cookiesTypes, gatewayVersion, enableReporting, options, nexusDomain, customReporter) { | |
| var beaconCounter = 0, | |
| version = "1.0.0", | |
| nexusURL = "//" + nexusDomain + "/privacy/v1/c/1.gif", | |
| instanceId = ((1 + Math.random()) * 268435456 | 0).toString(36); | |
| this.sendReport = function(oldCookies, newCookies) { | |
| if (!enableReporting) return; | |
| var beaconRootUrl = nexusURL; | |
| var beacon = imageReference; | |
| var encodedBeaconURL = beaconRootUrl + "?" + "n\x3d" + beaconCounter++ + "\x26c\x3d" + clientId + "\x26i\x3d" + instanceId; | |
| if (this.publishPath) encodedBeaconURL += "\x26p\x3d" + encodeURIComponent(this.publishPath); | |
| var settings = { | |
| "modal": modalType, | |
| "environment": environmentName, | |
| "defaults": defaultOptions | |
| }; | |
| var rawBody = this.buildBody(oldCookies, newCookies, settings); | |
| var encodedBody = this.generateReportString(rawBody); | |
| encodedBeaconURL += "\x26d\x3d" + encodedBody; | |
| beacon.src = encodedBeaconURL; | |
| if (typeof customReporter == | |
| "function") this._executeCustomReporter(oldCookies, newCookies); | |
| return encodedBeaconURL | |
| }; | |
| this.generateReportString = function(resources) { | |
| var reportString = JSON.stringify(resources); | |
| return LZString.compressToEncodedURIComponent(reportString) | |
| }; | |
| this.buildBody = function(oldCookies, newCookies, settings) { | |
| var body = { | |
| version: version, | |
| gateway: gatewayVersion, | |
| clientId: clientId, | |
| clientName: clientName, | |
| publishPath: publishPath, | |
| mode: mode, | |
| cookies: cookieManager.getCookiesFromTypes(cookiesTypes.concat(["MODAL_VIEWED", "LOCALE", | |
| "BANNER_VIEWED" | |
| ])), | |
| dt: Date.now(), | |
| settings: settings | |
| }; | |
| body.events = this.buildEvents(oldCookies, newCookies); | |
| return body | |
| }; | |
| this.buildEvents = function(previousCookies, newCookies) { | |
| var events = []; | |
| for (var cookieName in newCookies) | |
| if (previousCookies.hasOwnProperty(cookieName)) { | |
| if (newCookies[cookieName] !== previousCookies[cookieName]) { | |
| var event = this._buildEvent(cookieName, newCookies[cookieName]); | |
| events.push(event) | |
| } | |
| } else { | |
| var event = this._buildEvent(cookieName, newCookies[cookieName]); | |
| events.push(event) | |
| } | |
| return events | |
| }; | |
| this._buildEvent = function(cookieName, value) { | |
| var event = { | |
| "event": "cookieChanged", | |
| "dt": Date.now() | |
| }; | |
| event[utilities.cookieNameToCookieType(clientName, cookieName)] = value; | |
| return event | |
| }; | |
| this._executeCustomReporter = function(oldCookies, newCookies) { | |
| var events = this.buildEvents(oldCookies, newCookies); | |
| for (var index = 0; index < events.length; index++) { | |
| var event = events[index]; | |
| var cookieName = Object.keys(event)[2]; | |
| customReporter(cookieName, event[cookieName]) | |
| } | |
| } | |
| } | |
| var ConsentUIManager = function(gatewayData, environment, businessRulesManager, | |
| listManager, cookieManager, consentReporter) { | |
| var consentModal = null; | |
| var init = function() { | |
| if (businessRulesManager.shouldGetPrivacyModal) { | |
| var translatedPurposeList = listManager.getTranslatedList(); | |
| consentModal = new NoTogglesConsentModal(gatewayData, environment, translatedPurposeList, cookieManager, listManager.updateListValues, consentReporter) | |
| } else if (businessRulesManager.shouldGetEnterpriseModal) consentModal = new CookieModal(cookieManager, listManager.updateListValues, consentReporter, environment, gatewayData); | |
| else consentModal = new CookieModal(cookieManager, listManager.updateListValues, consentReporter, environment, gatewayData) | |
| }, | |
| getConsentModal = function() { | |
| return consentModal | |
| }; | |
| init(); | |
| return { | |
| getConsentModal: getConsentModal | |
| } | |
| }; | |
| var Gateway = function(gatewayData) { | |
| var banner, dataGovernanceManager, businessRulesManager, consentWidget, consentUIManager, environment, environmentManager, cookieDomain, cookieTypes = [], | |
| defaultCategory = "default", | |
| gatewayHasEnvironment, listManager, log = gatewayData.privacyLog = [], | |
| modal = {}, | |
| options, pathFilterManager = | |
| null, | |
| reporter; | |
| gatewayData.featureToggles.enableDataMonitoring = gatewayData.featureToggles.enableDataMonitoring || false; | |
| gatewayData.featureToggles.disableXHRManager = gatewayData.featureToggles.disableXHRManager || false; | |
| modal.openModal = function() { | |
| if (gatewayHasEnvironment === false) throw new Error("Ensighten API Error: No gateway environment found, the modal cannot work without it."); | |
| else throw new Error("Ensighten API Error: You must first register your modal before you can call it. Use Bootstrapper.gateway.setOpenModal to register a function that opens your modal."); | |
| }; | |
| var history = { | |
| before: {}, | |
| complete: {} | |
| }; | |
| var closeBanner = function() { | |
| try { | |
| banner.closeEnsBanner() | |
| } catch (err) { | |
| throw new Error("Ensighten API error: Your banner is not initialized in your client config " + err); | |
| } | |
| }; | |
| options = { | |
| clientName: gatewayData.info.name, | |
| enableFiltering: gatewayData.featureToggles.enableFiltering | |
| }; | |
| function resetEnvironment() { | |
| utilities.deleteCookie(gatewayData.info.name, "LOCALE"); | |
| environmentManager.setEnvironment(); | |
| setEnvironment(environmentManager.getActiveEnvironment()) | |
| } | |
| function allowRequest(req, | |
| testLocation) { | |
| var locationProtocol = testLocation || window.location.protocol; | |
| var url = req.destination, | |
| shouldAllowRequest = true, | |
| hostName = parseURLHost(url), | |
| pathName = parseURLPath(url), | |
| protocol = parseURLProtocol(url); | |
| var SSLCheckPasses = true; | |
| if (gatewayData.featureToggles.requireSSL === true && url !== "") { | |
| SSLCheckPasses = false; | |
| if (locationProtocol === "https:" && protocol === "https:" || locationProtocol === "http:") SSLCheckPasses = true; | |
| if (!SSLCheckPasses) req.addReason("SSL") | |
| } | |
| var targetListCheckPasses = true; | |
| if (gatewayData.featureToggles.enableFiltering && | |
| gatewayHasEnvironment === true) { | |
| targetListCheckPasses = false; | |
| targetListCheckPasses = listManager.allowRequest(hostName, pathName, targetListCheckPasses); | |
| if (!targetListCheckPasses) req.addReason("List") | |
| } | |
| var dataMonitoringCheckPasses = dataGovernanceManager.allowRequest(req, hostName); | |
| if (targetListCheckPasses === false || SSLCheckPasses === false || dataMonitoringCheckPasses === false) shouldAllowRequest = false; | |
| return shouldAllowRequest | |
| } | |
| function updateEnvironment(env) { | |
| setEnvironment(env); | |
| modal.update(env); | |
| banner.update(env); | |
| if (gatewayData.featureToggles.consentWidget) consentWidget.update(env); | |
| listManager.updateEnvironment(env); | |
| dataGovernanceManager.updateEnvironment(env) | |
| } | |
| function getLog() { | |
| if (window.JSON) { | |
| for (var id in history.complete) log.push({ | |
| resource: history.complete[id].request | |
| }); | |
| if (console && console.dir) console.dir(log); | |
| alert(JSON.stringify(log)) | |
| } | |
| } | |
| function historyGarbageCollector() { | |
| for (var id in history.before) { | |
| if (!history.before.hasOwnProperty(id)) continue; | |
| var timeStamp = +new Date; | |
| if (history.before[id].request !== | |
| undefined && timeStamp - history.before[id].request.start > 5E3) { | |
| resourceComplete(history.before.nodeRef, id, "timeout"); | |
| delete history.before[id] | |
| } | |
| } | |
| } | |
| function onBlock(request, node) { | |
| var status = "blocked"; | |
| if (dataGovernanceManager.shouldMaskData(request)) status = "masked"; | |
| if (dataGovernanceManager.shouldRedactData(request)) status = "redact"; | |
| request.end = +new Date; | |
| request.status = status; | |
| history.complete[request.id] = new HistoryEntry(request, node); | |
| resourceComplete(node, request.id, status); | |
| delete history.before[request.id] | |
| } | |
| function modalDomCleanup() { | |
| if (gatewayData.featureToggles.enableConsentModal) { | |
| var domElement = document.getElementById("ensModalWrapper"); | |
| domElement.parentElement.removeChild(domElement) | |
| } | |
| } | |
| function bannerDomCleanup() { | |
| var domElement = document.getElementById("ensNotifyBanner"); | |
| domElement.parentElement.removeChild(domElement) | |
| } | |
| function setOpenModal(clientDefinedOverrideFunction) { | |
| modal.openModal = clientDefinedOverrideFunction; | |
| modalDomCleanup() | |
| } | |
| function setOpenBanner(clientDefinedOverrideFunction) { | |
| banner.openBanner = | |
| clientDefinedOverrideFunction; | |
| bannerDomCleanup() | |
| } | |
| function openBanner() { | |
| try { | |
| banner.openEnsBanner() | |
| } catch (err) { | |
| if (gatewayHasEnvironment === false) throw new Error("Ensighten API Error: No gateway environment found, the banner cannot work without it." + err); | |
| else throw new Error("Ensighten API error: Your banner is not initialzed in your client config " + err); | |
| } | |
| } | |
| function openModal() { | |
| try { | |
| modal.openModal() | |
| } catch (err) { | |
| if (gatewayHasEnvironment === false) throw new Error("Ensighten API Error: No gateway environment found, the modal cannot work without it." + | |
| err); | |
| else throw new Error("Ensighten API error: Your modal is not initialzed in your client config " + err); | |
| } | |
| } | |
| function onBefore(req, node) { | |
| if (!node.__reference) history.before[req.id] = new HistoryEntry(req, node); | |
| return allowRequest(req) | |
| } | |
| function createAnchorElement(url) { | |
| if (url.indexOf("javascript:") !== -1) url = window.location; | |
| var a = Function.prototype.apply.call(gatewayData.ensCreateElement, document, ["a"]); | |
| a.href = url; | |
| return a | |
| } | |
| function parseURLPath(url) { | |
| var a = createAnchorElement(url); | |
| if (utilities.isIE && utilities.ieVersion() && | |
| utilities.ieVersion() < 13) return "/" + a.pathname; | |
| return a.pathname | |
| } | |
| function parseURLHost(url) { | |
| var a = createAnchorElement(url); | |
| var hostname = a.hostname; | |
| if (hostname === "" || hostname === undefined || hostname === null) hostname = location.hostname; | |
| return hostname | |
| } | |
| function parseURLProtocol(url) { | |
| var a = createAnchorElement(url); | |
| var protocol = a.protocol; | |
| if (protocol === "" || protocol === undefined || protocol === null) protocol = location.protocol; | |
| return protocol | |
| } | |
| function resourceComplete(node, id, status) { | |
| id = id || node.__gateway; | |
| var before = | |
| history.before[id]; | |
| if (!before) return false; | |
| var request = before.request; | |
| request.end = +new Date; | |
| request.status = status; | |
| history.complete[id] = new HistoryEntry(request, node); | |
| ensLogger.consoleLog("resourceComplete: ", status, ": ", request); | |
| reporter.addResource(request); | |
| delete history.before[id] | |
| } | |
| function setEnvironment(env) { | |
| environment = env | |
| } | |
| function getVersion() { | |
| return ensGatewayVersion.version | |
| } | |
| var consentCookies = { | |
| getCookie: function(cookieType) { | |
| return cookieManager.getCookie(cookieType) | |
| }, | |
| setCookie: function(cookieType, | |
| value) { | |
| var clientName = gatewayData.info.name; | |
| var oldCookies = cookieManager.getCookiesFromTypes([cookieType]); | |
| cookieManager.setCookie(cookieType, value); | |
| var newCookies = cookieManager.getCookiesFromTypes([cookieType]); | |
| if (consentReporter !== null) consentReporter.sendReport(oldCookies, newCookies); | |
| if (gatewayData.featureToggles.enableConsentModal) modal.update(environment) | |
| }, | |
| setCookies: function(cookies) { | |
| var cookieTypes = []; | |
| for (var key in cookies) cookieTypes.push(key); | |
| var oldCookies = cookieManager.getCookiesFromTypes(cookieTypes); | |
| cookieManager.setCookies(cookies); | |
| var newCookies = cookieManager.getCookiesFromTypes(cookieTypes); | |
| if (consentReporter !== null) consentReporter.sendReport(oldCookies, newCookies); | |
| if (gatewayData.featureToggles.enableConsentModal) modal.update(environment) | |
| }, | |
| getCookieTypes: function() { | |
| return cookieTypes | |
| }, | |
| calculateCookieDomain: function(domain) { | |
| return cookieManager.calculateCookieDomain(domain) | |
| }, | |
| setCookieDomain: function(newCookieDomain) { | |
| cookieManager.setCookieDomain(newCookieDomain) | |
| }, | |
| getCookieDomain: function() { | |
| return cookieManager.getCookieDomain() | |
| } | |
| }; | |
| var enableGateway = true; | |
| var isInitialized = false; | |
| var init = function() { | |
| cookieManager = new CookieManager(gatewayData.info.name, gatewayData.getCookie, gatewayData.setCookie); | |
| businessRulesManager = new BusinessRulesManager(gatewayData); | |
| environmentManager = new EnvironmentManager(document, gatewayData.environmentConfigs, gatewayData.defaultEnv, gatewayData.info.name, cookieManager); | |
| if (gatewayData.featureToggles.enableEnvironmentMatching === true && environmentManager.getActiveEnvironment() === null) { | |
| enableGateway = false; | |
| return | |
| } | |
| setEnvironment(environmentManager.getActiveEnvironment()); | |
| environmentManager.registerEnvironmentChangeCallback(updateEnvironment); | |
| listManager = new ListManager(environment, gatewayData, defaultCategory, cookieManager); | |
| environmentManager.registerEnvironmentChangeCallback(listManager.updateListValues); | |
| dataGovernanceManager = new DataGovernanceManager(gatewayData.featureToggles.enableDataMonitoring, gatewayData.dataMonitoring, environment); | |
| if (environment) { | |
| gatewayHasEnvironment = true; | |
| consentReporter = new ConsentReporter(new window.Image, | |
| environment.name || "", gatewayData.libraryPackage, environment.optVals, gatewayData.info.clientId, gatewayData.info.name, gatewayData.info.publishPath, listManager.getUsesWhitelist() ? "whitelist" : "blacklist", gatewayData.cookieTypes, getVersion(), gatewayData.featureToggles.enableReporting, options, gatewayData.info.nexus || "nexus.ensighten.com", gatewayData.onConsent); | |
| cookieTypes = gatewayData.cookieTypes || function() { | |
| var result = []; | |
| for (var key in whitelist) | |
| if (key !== defaultCategory) result.push(key); | |
| return result | |
| }(); | |
| consentUIManager = new ConsentUIManager(gatewayData, environment, businessRulesManager, listManager, cookieManager, consentReporter); | |
| modal = consentUIManager.getConsentModal(); | |
| banner = new Banner(gatewayData, environment, modal, cookieManager); | |
| if (gatewayData.featureToggles.consentWidget) consentWidget = new ConsentWidget(environment, gatewayData) | |
| } else gatewayHasEnvironment = false; | |
| var options = null; | |
| var reportingFilterRegex = null; | |
| if (gatewayData.featureToggles.enableAllowedDomainsReporting === false) reportingFilterRegex = listManager.getAlwaysAllowedListRegex(); | |
| reporter = new Reporter(window.Image, gatewayData.info.clientId, gatewayData.info.publishPath, listManager.getUsesWhitelist(), getVersion(), gatewayData.featureToggles.enableReporting, {}, gatewayData.info.nexus || "nexus.ensighten.com", reportingFilterRegex); | |
| reporter.setCookies(getPrivacyCookies()); | |
| log.push({ | |
| location: window.location.href || null | |
| }); | |
| log.push({ | |
| cookie: document.cookie || null | |
| }); | |
| if (!options) options = { | |
| enableFiltering: false, | |
| enableObserving: true | |
| }; | |
| new MutationObserverFactory; | |
| if (gatewayData.featureToggles.disableXHRManager === | |
| false) new XhrManager; | |
| elementObserver(); | |
| writeObserver(); | |
| writeLnObserver(); | |
| setInterval(historyGarbageCollector, 250); | |
| gatewayConfig.unbound.script = document.all && !document.addEventListener; | |
| isInitialized = true | |
| }(); | |
| if (!enableGateway) { | |
| isInitialized = false; | |
| return { | |
| isInitialized: isInitialized | |
| } | |
| } | |
| function getPrivacyCookies() { | |
| var cookies = {}; | |
| function cookieHelper(key) { | |
| var cookieVal = consentCookies.getCookie(key); | |
| if (cookieVal !== undefined) cookies[key] = cookieVal | |
| } | |
| var types = consentCookies.getCookieTypes(); | |
| for (var i = 0; i < types.length; i++) cookieHelper(types[i]); | |
| cookieHelper("MODAL_VIEWED"); | |
| cookieHelper("BANNER_VIEWED"); | |
| cookieHelper("LOCALE"); | |
| return cookies | |
| } | |
| var allowTag = function(tag) { | |
| if (validateTag(tag) && localStorage) { | |
| var ALLOWED_KEY = listManager.ALLOWED_KEY; | |
| var BLOCKED_KEY = listManager.BLOCKED_KEY; | |
| var allowedURLS = localStorage.getItem(ALLOWED_KEY) ? JSON.parse(localStorage.getItem(ALLOWED_KEY)) : []; | |
| if (!allowedURLS.includes(JSON.stringify(tag))) { | |
| allowedURLS.push(tag); | |
| localStorage.setItem(ALLOWED_KEY, JSON.stringify(allowedURLS)) | |
| } | |
| var blockedURLS = localStorage.getItem(BLOCKED_KEY) ? | |
| JSON.parse(localStorage.getItem(BLOCKED_KEY)) : []; | |
| blockedURLS = blockedURLS.filter(function(element) { | |
| return JSON.stringify(element) !== JSON.stringify(tag) | |
| }); | |
| localStorage.setItem(BLOCKED_KEY, JSON.stringify(blockedURLS)); | |
| listManager.updateListValues(); | |
| return tag | |
| } | |
| return Error("invalid tag") | |
| }; | |
| var blockTag = function(tag) { | |
| if (validateTag(tag) && localStorage) { | |
| var BLOCKED_KEY = listManager.BLOCKED_KEY; | |
| var ALLOWED_KEY = listManager.ALLOWED_KEY; | |
| var blockedURLS = localStorage.getItem(BLOCKED_KEY) ? JSON.parse(localStorage.getItem(BLOCKED_KEY)) : []; | |
| if (!blockedURLS.includes(JSON.stringify(tag))) { | |
| blockedURLS.push(tag); | |
| localStorage.setItem(BLOCKED_KEY, JSON.stringify(blockedURLS)) | |
| } | |
| var allowedURLS = localStorage.getItem(ALLOWED_KEY) ? JSON.parse(localStorage.getItem(ALLOWED_KEY)) : []; | |
| allowedURLS = allowedURLS.filter(function(element) { | |
| return JSON.stringify(element) !== JSON.stringify(tag) | |
| }); | |
| localStorage.setItem(ALLOWED_KEY, JSON.stringify(allowedURLS)); | |
| listManager.updateListValues(); | |
| return tag | |
| } | |
| return Error("invalid tag") | |
| }; | |
| var getList = function() { | |
| var tagList = | |
| listManager.getList(); | |
| if (localStorage) { | |
| var BLOCKED_KEY = listManager.BLOCKED_KEY; | |
| var ALLOWED_KEY = listManager.ALLOWED_KEY; | |
| tagList["CUSTOM_ALLOW"] = localStorage.getItem(ALLOWED_KEY) ? JSON.parse(localStorage.getItem(ALLOWED_KEY)) : []; | |
| tagList["CUSTOM_BLOCK"] = localStorage.getItem(BLOCKED_KEY) ? JSON.parse(localStorage.getItem(BLOCKED_KEY)) : [] | |
| } | |
| return tagList | |
| }; | |
| var clearTags = function() { | |
| localStorage.setItem(listManager.ALLOWED_KEY, ""); | |
| localStorage.setItem(listManager.BLOCKED_KEY, ""); | |
| listManager.updateListValues() | |
| }; | |
| function validateTag(tag) { | |
| return tag && tag.tag | |
| } | |
| testElements = { | |
| allowRequest: allowRequest, | |
| parseURLPath: parseURLPath, | |
| parseURLHost: parseURLHost | |
| }; | |
| return { | |
| isInitialized: isInitialized, | |
| cookieModal: modal, | |
| consentCookies: consentCookies, | |
| closeBanner: closeBanner, | |
| dataGovernanceManager: dataGovernanceManager, | |
| environment: environment, | |
| environmentManager: environmentManager, | |
| getLog: getLog, | |
| getList: getList, | |
| getVersion: getVersion, | |
| history: history, | |
| allowTag: allowTag, | |
| blockTag: blockTag, | |
| clearTags: clearTags, | |
| historyGarbageCollector: historyGarbageCollector, | |
| modal: modal, | |
| onBefore: onBefore, | |
| onBlock: onBlock, | |
| openBanner: openBanner, | |
| openModal: openModal, | |
| options: options, | |
| reporter: reporter, | |
| resourceComplete: resourceComplete, | |
| resetEnvironment: resetEnvironment, | |
| setOpenModal: setOpenModal, | |
| setOpenBanner: setOpenBanner, | |
| updatePreferences: listManager.updateListValues, | |
| testElements: testElements | |
| } | |
| }; | |
| var HistoryEntry = function() { | |
| function HistoryEntry(request, node) { | |
| this.request = request; | |
| this.nodeRef = node | |
| } | |
| return HistoryEntry | |
| }(); | |
| var Request = function() { | |
| function Request(destination) { | |
| this.destination = | |
| destination || ""; | |
| this.type = null; | |
| this.start = +new Date; | |
| this.end = -1; | |
| this.source = null; | |
| this.status = null; | |
| this.reasons = [] | |
| } | |
| Request.prototype.addReason = function(reason) { | |
| this.reasons.push(reason) | |
| }; | |
| Request.prototype.hasReason = function(reason) { | |
| if (this.reasons.length > 0) return (new RegExp(this.reasons.join("|"))).test(reason); | |
| return false | |
| }; | |
| Request.prototype.numReasons = function() { | |
| return this.reasons.length | |
| }; | |
| return Request | |
| }(); | |
| ensLogger = function() { | |
| var consoleLoggingEnabled = false, | |
| checkForConsoleLoggingParam = function() { | |
| var hash, | |
| queryStringObject = {}; | |
| var hashes = window.location.href.slice(window.location.href.indexOf("?") + 1).split("\x26"); | |
| for (var i = 0; i < hashes.length; i++) { | |
| hash = hashes[i].split("\x3d"); | |
| queryStringObject[hash[0]] = hash[1] | |
| } | |
| if (queryStringObject["ensLogger"] && queryStringObject["ensLogger"] === "true") enableConsoleLogging() | |
| }, | |
| disableConsoleLogging = function() { | |
| setConsoleLoggingState(false) | |
| }, | |
| enableConsoleLogging = function() { | |
| setConsoleLoggingState(true) | |
| }, | |
| getConsoleLoggingState = function() { | |
| return consoleLoggingEnabled | |
| }, | |
| init = | |
| function() { | |
| checkForConsoleLoggingParam() | |
| }, | |
| consoleLog = function() { | |
| if (consoleLoggingEnabled && window.console) console.log(arguments) | |
| }, | |
| setConsoleLoggingState = function(state) { | |
| consoleLoggingEnabled = state | |
| }; | |
| init(); | |
| return { | |
| disableConsoleLogging: disableConsoleLogging, | |
| enableConsoleLogging: enableConsoleLogging, | |
| getConsoleLoggingState: getConsoleLoggingState, | |
| consoleLog: consoleLog | |
| } | |
| }(); | |
| var ensGatewayVersion = ensGatewayVersion || {}; | |
| ensGatewayVersion["version"] = "2.1.176"; | |
| if (document.elementFromPoint && !utilities.isIE8OrLower()) { | |
| ensBrowserSupported = | |
| true; | |
| if (typeof Bootstrapper === "undefined") Bootstrapper = {}; | |
| if (Bootstrapper.hasOwnProperty("privacy") && typeof Bootstrapper.privacy.onBeforeInit === "function") Bootstrapper.privacy.onBeforeInit(ensClientConfig); | |
| gateway = new Gateway(ensClientConfig); | |
| if (gateway.isInitialized) Bootstrapper.gateway = { | |
| closeBanner: gateway.closeBanner, | |
| environment: gateway.environment, | |
| environmentExists: gateway.environmentManager.environmentExists, | |
| getActiveEnvironment: gateway.environmentManager.getActiveEnvironment, | |
| getActiveLocale: gateway.environmentManager.getActiveLocale, | |
| getAvailableLocales: gateway.environmentManager.getAvailableLocales, | |
| getCookie: gateway.consentCookies.getCookie, | |
| getCookieTypes: gateway.consentCookies.getCookieTypes, | |
| getVersion: gateway.getVersion, | |
| openBanner: gateway.openBanner, | |
| openModal: gateway.openModal, | |
| registerEnvironmentChangeCallback: gateway.environmentManager.registerEnvironmentChangeCallback, | |
| getList: gateway.getList, | |
| resetEnvironment: gateway.resetEnvironment, | |
| setCookie: gateway.consentCookies.setCookie, | |
| setCookies: gateway.consentCookies.setCookies, | |
| setCookieDomain: gateway.consentCookies.setCookieDomain, | |
| setEnvironment: gateway.environmentManager.setEnvironment, | |
| setOpenModal: gateway.setOpenModal, | |
| setOpenBanner: gateway.setOpenBanner, | |
| updatePreferences: gateway.updatePreferences, | |
| allowTag: gateway.allowTag, | |
| blockTag: gateway.blockTag, | |
| clearTags: gateway.clearTags | |
| }; | |
| else Bootstrapper.gateway = {} | |
| } else ensBrowserSupported = false; | |
| if (!ensBrowserSupported && ensClientConfig.browserNotSupportedURL && ensClientConfig.browserNotSupportedURL !== "") window.location = ensClientConfig.browserNotSupportedURL; | |
| var privacyEnd | |
| }, 2693771, [2697112], | |
| 544087, [544086]); | |
| Bootstrapper.getServerComponent(Bootstrapper.getExtraParams ? Bootstrapper.getExtraParams() : undefined); | |
| } | |
| })(); | |
| (function ensightenInit() { | |
| var ensightenOptions = { | |
| client: "altair", | |
| clientId: 2538, | |
| publishPath: "prod", | |
| isPublic: 1, | |
| serverComponentLocation: "nexus.ensighten.com/altair/prod/serverComponent.php", | |
| staticJavascriptPath: "nexus.ensighten.com/altair/prod/code/", | |
| ns: 'Bootstrapper', | |
| nexus: "nexus.ensighten.com", | |
| scUseCacheBuster: "true", | |
| enableTagAuditBeacon: "false", | |
| enablePagePerfBeacon: "false", | |
| registryNs: "ensBootstraps", | |
| generatedOn: "Thu Nov 08 22:02:35 GMT 2018", | |
| beaconSamplingSeedValue: 11 | |
| }; | |
| if (!window[ensightenOptions.ns]) { | |
| window[ensightenOptions.registryNs] || (window[ensightenOptions.registryNs] = {}); | |
| window[ensightenOptions.registryNs][ensightenOptions.ns] = window[ensightenOptions.ns] = function(f) { | |
| function l(a) { | |
| this.name = "DependencyNotAvailableException"; | |
| this.message = "Dependency with id " + a + "is missing" | |
| } | |
| function m(a) { | |
| this.name = "BeaconException"; | |
| this.message = "There was an error durring beacon initialization"; | |
| a = a || {}; | |
| this.lineNumber = a.lineNumber || a.line; | |
| this.fileName = a.fileName | |
| } | |
| function n() { | |
| for (var a = b.dataDefinitionIds.length, c = !0, d = 0; d < a; d++) { | |
| var e = b.dataDefinitions[b.dataDefinitionIds[d]]; | |
| if (!e || | |
| null == e.endRegistration) { | |
| c = !1; | |
| break | |
| } | |
| } | |
| c && b.callOnDataDefintionComplete() | |
| } | |
| var e = {}, | |
| b = {}; | |
| b.ensightenOptions = ensightenOptions; | |
| b.scDataObj = {}; | |
| e.version = "1.26.0"; | |
| e.nexus = f.nexus || "nexus.ensighten.com"; | |
| e.rand = -1; | |
| e.currSec = (new Date).getSeconds(); | |
| e.options = { | |
| interval: f.interval || 100, | |
| erLoc: f.errorLocation || e.nexus + "/error/e.gif", | |
| scLoc: f.serverComponentLocation || e.nexus + "/" + f.client + "/serverComponent.php", | |
| sjPath: f.staticJavascriptPath || e.nexus + "/" + f.client + "/code/", | |
| alLoc: f.alertLocation || e.nexus + "/alerts/a.gif", | |
| publishPath: f.publishPath, | |
| isPublic: f.isPublic, | |
| client: f.client, | |
| clientId: f.clientId, | |
| enableTagAuditBeacon: f.enableTagAuditBeacon, | |
| scUseCacheBuster: f.scUseCacheBuster, | |
| beaconSamplingSeedValue: f.beaconSamplingSeedValue || -1 | |
| }; | |
| e.ruleList = []; | |
| e.allDeploymentIds = []; | |
| e.runDeploymentIds = []; | |
| e.runRuleIds = []; | |
| e.exceptionList = []; | |
| e.ensightenVariables = {}; | |
| e.test = function(a) { | |
| if (!(a.executionData.hasRun || a.executionData.runTime && 0 < a.executionData.runTime.length)) { | |
| for (var c = 0; c < a.dependencies.length; c++) | |
| if (!1 === a.dependencies[c]()) return; | |
| a.execute() | |
| } | |
| }; | |
| l.prototype = Error(); | |
| l.prototype || (l.prototype = {}); | |
| l.prototype.constructor = l; | |
| e.DependencyNotAvailableException = l; | |
| m.prototype = Error(); | |
| m.prototype || (m.prototype = {}); | |
| m.prototype.constructor = m; | |
| e.BeaconException = m; | |
| e.checkForInvalidDependencies = function(a, c, d, h) { | |
| for (a = 0; a < d.length; a++) | |
| if ("DEPENDENCYNEVERAVAILABLE" === d[a]) return b.currentRuleId = this.id, b.currentDeploymentId = this.deploymentId, b.reportException(new e.DependencyNotAvailableException(h[a])), c && -1 !== c && e.allDeploymentIds.push(c), !0; | |
| return !1 | |
| }; | |
| b.currentRuleId = -1; | |
| b.currentDeploymentId = -1; | |
| b.reportedErrors = []; | |
| b.reportedAlerts = []; | |
| b.AF = []; | |
| b._serverTime = ""; | |
| b._clientIP = ""; | |
| b.sampleBeacon = function() { | |
| var a = !1; | |
| try { | |
| var c = (e.currSec || 0) % 20, | |
| b = e.options.beaconSamplingSeedValue; - 1 === b ? a = !0 : 0 !== c && 0 === b % c && (a = !0) | |
| } catch (h) {} | |
| return a | |
| }; | |
| b.getServerComponent = function(a) { | |
| b.callOnGetServerComponent(); | |
| b.insertScript(window.location.protocol + "//" + e.options.scLoc, !1, a || !0, e.options.scUseCacheBuster) | |
| }; | |
| b.setVariable = function(a, c) { | |
| e.ensightenVariables[a] = | |
| c | |
| }; | |
| b.getVariable = function(a) { | |
| return a in e.ensightenVariables ? e.ensightenVariables[a] : null | |
| }; | |
| b.testAll = function() { | |
| for (var a = 0; a < e.ruleList.length; a++) e.test(e.ruleList[a]) | |
| }; | |
| b.executionState = { | |
| DOMParsed: !1, | |
| DOMLoaded: !1, | |
| dataDefinitionComplete: !1, | |
| conditionalRules: !1, | |
| readyForServerComponent: !1 | |
| }; | |
| b.reportException = function(a) { | |
| a.timestamp = (new Date).getTime(); | |
| e.exceptionList.push(a); | |
| a = window.location.protocol + "//" + e.options.erLoc + "?msg=" + encodeURIComponent(a.message || "") + "&lnn=" + encodeURIComponent(a.lineNumber || | |
| a.line || -1) + "&fn=" + encodeURIComponent(a.fileName || "") + "&cid=" + encodeURIComponent(e.options.clientId || -1) + "&client=" + encodeURIComponent(e.options.client || "") + "&publishPath=" + encodeURIComponent(e.options.publishPath || "") + "&rid=" + encodeURIComponent(b.currentRuleId || -1) + "&did=" + encodeURIComponent(b.currentDeploymentId || -1) + "&errorName=" + encodeURIComponent(a.name || ""); | |
| a = b.imageRequest(a); | |
| a.timestamp = (new Date).getTime(); | |
| this.reportedErrors.push(a) | |
| }; | |
| b.Rule = function(a) { | |
| this.execute = function() { | |
| this.executionData.runTime.push(new Date); | |
| b.currentRuleId = this.id; | |
| b.currentDeploymentId = this.deploymentId; | |
| try { | |
| this.code() | |
| } catch (c) { | |
| window[ensightenOptions.ns].reportException(c) | |
| } finally { | |
| this.executionData.hasRun = !0, -1 !== this.deploymentId && (e.runDeploymentIds.push(this.deploymentId), e.runRuleIds.push(this.id)), b.testAll() | |
| } | |
| }; | |
| this.id = a.id; | |
| this.deploymentId = a.deploymentId; | |
| this.dependencies = a.dependencies || []; | |
| this.code = a.code; | |
| this.executionData = { | |
| hasRun: !1, | |
| runTime: [] | |
| } | |
| }; | |
| b.registerRule = function(a) { | |
| if (b.getRule(a.id) && -1 !== a.id) return !1; | |
| e.ruleList.push(a); - 1 !== a.deploymentId && e.allDeploymentIds.push(a.deploymentId); | |
| b.testAll(); | |
| return !0 | |
| }; | |
| b.getRule = function(a) { | |
| for (var c = 0; c < e.ruleList.length; c++) | |
| if (e.ruleList[c].id === a) return e.ruleList[c]; | |
| return !1 | |
| }; | |
| b.getRuleList = function() { | |
| return e.ruleList | |
| }; | |
| b.clearRuleList = function() { | |
| e.ruleList = [] | |
| }; | |
| b.getAllDeploymentIds = function() { | |
| return e.allDeploymentIds | |
| }; | |
| b.getRunRuleIds = function() { | |
| return e.runRuleIds | |
| }; | |
| b.getRunDeploymentIds = function() { | |
| return e.runDeploymentIds | |
| }; | |
| b.hasRuleRun = function(a) { | |
| return (a = b.getRule(a)) ? a.executionData.hasRun : | |
| !1 | |
| }; | |
| e.toTwoChar = function(a) { | |
| return (2 === a.toString().length ? "" : "0") + a | |
| }; | |
| b.Alert = function(a) { | |
| var c = new Date; | |
| c = c.getFullYear() + "-" + e.toTwoChar(c.getMonth()) + "-" + e.toTwoChar(c.getDate()) + " " + e.toTwoChar(c.getHours()) + ":" + e.toTwoChar(c.getMinutes()) + ":" + e.toTwoChar(c.getSeconds()); | |
| this.severity = a.severity || 1; | |
| this.subject = a.subject || ""; | |
| this.type = a.type || 1; | |
| this.ruleId = a.ruleId || -1; | |
| this.severity = encodeURIComponent(this.severity); | |
| this.date = encodeURIComponent(c); | |
| this.subject = encodeURIComponent(this.subject); | |
| this.type = encodeURIComponent(this.type) | |
| }; | |
| b.generateAlert = function(a) { | |
| a = b.imageRequest(window.location.protocol + "//" + e.options.alLoc + "?d=" + a.date + "&su=" + a.subject + "&se=" + a.severity + "&t=" + a.type + "&cid=" + e.options.clientId + "&client=" + e.options.client + "&publishPath=" + e.options.publishPath + "&rid=" + b.currentRuleId + "&did=" + b.currentDeploymentId); | |
| a.timestamp = (new Date).getTime(); | |
| this.reportedAlerts.push(a) | |
| }; | |
| b.imageRequest = function(a) { | |
| var c = new Image(0, 0); | |
| c.src = a; | |
| return c | |
| }; | |
| b.insertScript = function(a, c, d, h) { | |
| var p = | |
| document.getElementsByTagName("script"), | |
| g; | |
| h = void 0 !== h ? h : !0; | |
| if (void 0 !== c ? c : 1) | |
| for (g = 0; g < p.length; g++) | |
| if (p[g].src === a && p[g].readyState && /loaded|complete/.test(p[g].readyState)) return; | |
| if (d) { | |
| d = 1 == d && "object" == typeof b.scDataObj ? b.scDataObj : d; | |
| e.rand = Math.random() * ("1E" + (10 * Math.random()).toFixed(0)); | |
| c = window.location.href; | |
| "object" === typeof d && d.PageID && (c = d.PageID, delete d.PageID); | |
| if ("object" === typeof d) | |
| for (g in d) { | |
| g = ~c.indexOf("#") ? c.slice(c.indexOf("#"), c.length) : ""; | |
| c = c.slice(0, g.length ? c.length - g.length : | |
| c.length); | |
| c += ~c.indexOf("?") ? "&" : "?"; | |
| for (k in d) c += k + "=" + d[k] + "&"; | |
| c = c.slice(0, -1) + g; | |
| break | |
| } | |
| a += "?"; | |
| h && (a += "r=" + e.rand + "&"); | |
| a += "ClientID=" + encodeURIComponent(e.options.clientId) + "&PageID=" + encodeURIComponent(c) | |
| }(function(a, c, b) { | |
| var d = c.head || c.getElementsByTagName("head"); | |
| setTimeout(function() { | |
| if ("item" in d) { | |
| if (!d[0]) { | |
| setTimeout(arguments.callee, 25); | |
| return | |
| } | |
| d = d[0] | |
| } | |
| var a = c.createElement("script"); | |
| a.src = b; | |
| a.onload = a.onerror = function() { | |
| this.addEventListener && (this.readyState = "loaded") | |
| }; | |
| d.insertBefore(a, | |
| d.firstChild) | |
| }, 0) | |
| })(window, document, a) | |
| }; | |
| b.loadScriptCallback = function(a, c, b) { | |
| var d = document.getElementsByTagName("script"), | |
| e; | |
| b = d[0]; | |
| for (e = 0; e < d.length; e++) | |
| if (d[e].src === a && d[e].readyState && /loaded|complete/.test(d[e].readyState)) try { | |
| c() | |
| } catch (g) { | |
| window[ensightenOptions.ns].reportException(g) | |
| } finally { | |
| return | |
| } | |
| d = document.createElement("script"); | |
| d.type = "text/javascript"; | |
| d.async = !0; | |
| d.src = a; | |
| d.onerror = function() { | |
| this.addEventListener && (this.readyState = "loaded") | |
| }; | |
| d.onload = d.onreadystatechange = function() { | |
| if (!this.readyState || | |
| "complete" === this.readyState || "loaded" === this.readyState) { | |
| this.onload = this.onreadystatechange = null; | |
| this.addEventListener && (this.readyState = "loaded"); | |
| try { | |
| c.call(this) | |
| } catch (g) { | |
| window[ensightenOptions.ns].reportException(g) | |
| } | |
| } | |
| }; | |
| b.parentNode.insertBefore(d, b) | |
| }; | |
| b.insertPageFiles = function(a) { | |
| var b = 0, | |
| d = 0, | |
| e = function() { | |
| d == a.length - 1 && window[ensightenOptions.ns].callOnPageSpecificCompletion(); | |
| d++ | |
| }; | |
| for (b = 0; b < a.length; ++b) window[ensightenOptions.ns].loadScriptCallback(a[b], e) | |
| }; | |
| b.unobtrusiveAddEvent = function(a, | |
| b, d) { | |
| try { | |
| var c = a[b] ? a[b] : function() {}; | |
| a[b] = function() { | |
| d.apply(this, arguments); | |
| return c.apply(this, arguments) | |
| } | |
| } catch (p) { | |
| window[ensightenOptions.ns].reportException(p) | |
| } | |
| }; | |
| b.anonymous = function(a, c) { | |
| return function() { | |
| try { | |
| b.currentRuleId = c ? c : "anonymous", a() | |
| } catch (d) { | |
| window[ensightenOptions.ns].reportException(d) | |
| } | |
| } | |
| }; | |
| b.setCurrentRuleId = function(a) { | |
| b.currentRuleId = a | |
| }; | |
| b.setCurrentDeploymentId = function(a) { | |
| b.currentDeploymentId = a | |
| }; | |
| b.bindImmediate = function(a, c, d) { | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: d || -1, | |
| dependencies: [], | |
| code: a | |
| }); | |
| else if ("object" !== typeof a) return !1; | |
| b.registerRule(a) | |
| }; | |
| b.bindDOMParsed = function(a, c, d) { | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: d || -1, | |
| dependencies: [function() { | |
| return window[ensightenOptions.ns].executionState.DOMParsed | |
| }], | |
| code: a | |
| }); | |
| else if ("object" !== typeof a) return !1; | |
| b.registerRule(a) | |
| }; | |
| b.bindDOMLoaded = function(a, c, d) { | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: d || -1, | |
| dependencies: [function() { | |
| return window[ensightenOptions.ns].executionState.DOMLoaded | |
| }], | |
| code: a | |
| }); | |
| else if ("object" !== typeof a) return !1; | |
| b.registerRule(a) | |
| }; | |
| b.bindPageSpecificCompletion = function(a, c, d) { | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: d || -1, | |
| dependencies: [function() { | |
| return window[ensightenOptions.ns].executionState.conditionalRules | |
| }], | |
| code: a | |
| }); | |
| else if ("object" !== typeof a) return !1; | |
| b.registerRule(a) | |
| }; | |
| b.bindOnGetServerComponent = function(a, c, d) { | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: d || -1, | |
| dependencies: [function() { | |
| return window[ensightenOptions.ns].executionState.readyForServerComponent | |
| }], | |
| code: a | |
| }); | |
| else if ("object" !== typeof a) return !1; | |
| b.registerRule(a) | |
| }; | |
| b.bindDataDefinitionComplete = function(a, c, d) { | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: d || -1, | |
| dependencies: [function() { | |
| return window[ensightenOptions.ns].executionState.dataDefinitionComplete | |
| }], | |
| code: a | |
| }); | |
| else if ("object" !== typeof a) return !1; | |
| b.registerRule(a) | |
| }; | |
| b.checkHasRun = function(a) { | |
| if (0 === a.length) return !0; | |
| for (var c, d = 0; d < a.length; ++d) | |
| if (c = b.getRule(parseInt(a[d], 10)), !c || !c.executionData.hasRun) return !1; | |
| return !0 | |
| }; | |
| b.bindDependencyImmediate = function(a, c, d, h, f) { | |
| var g = []; | |
| if (!e.checkForInvalidDependencies(c, h, d, f)) { | |
| g.push(function() { | |
| return window[ensightenOptions.ns].checkHasRun(d) | |
| }); | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: h || -1, | |
| dependencies: g, | |
| code: a | |
| }); | |
| else if ("object" !== typeof a) return !1; | |
| b.registerRule(a) | |
| } | |
| }; | |
| b.bindDependencyDOMLoaded = function(a, c, d, h, f) { | |
| var g = []; | |
| if (!e.checkForInvalidDependencies(c, h, d, f)) { | |
| g.push(function() { | |
| return window[ensightenOptions.ns].executionState.DOMLoaded | |
| }); | |
| g.push(function() { | |
| return window[ensightenOptions.ns].checkHasRun(d) | |
| }); | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: h || -1, | |
| dependencies: g, | |
| code: a | |
| }); | |
| else if ("object" !== typeof a) return !1; | |
| b.registerRule(a) | |
| } | |
| }; | |
| b.bindDependencyDOMParsed = function(a, c, d, h, f) { | |
| var g = []; | |
| if (!e.checkForInvalidDependencies(c, h, d, f)) { | |
| g.push(function() { | |
| return window[ensightenOptions.ns].executionState.DOMParsed | |
| }); | |
| g.push(function() { | |
| return window[ensightenOptions.ns].checkHasRun(d) | |
| }); | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: h || -1, | |
| dependencies: g, | |
| code: a | |
| }); | |
| else if ("object" !== | |
| typeof a) return !1; | |
| b.registerRule(a) | |
| } | |
| }; | |
| b.bindDependencyPageSpecificCompletion = function(a, c, d, h, f) { | |
| var g = []; | |
| if (!e.checkForInvalidDependencies(c, h, d, f)) { | |
| g.push(function() { | |
| return window[ensightenOptions.ns].executionState.conditionalRules | |
| }); | |
| g.push(function() { | |
| return window[ensightenOptions.ns].checkHasRun(d) | |
| }); | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: h || -1, | |
| dependencies: g, | |
| code: a | |
| }); | |
| else if ("object" !== typeof a) return !1; | |
| b.registerRule(a) | |
| } | |
| }; | |
| b.bindDependencyOnGetServerComponent = function(a, | |
| c, d, h, f) { | |
| var g = []; | |
| if (!e.checkForInvalidDependencies(c, h, d, f)) { | |
| g.push(function() { | |
| return window[ensightenOptions.ns].executionState.readyForServerComponent | |
| }); | |
| g.push(function() { | |
| return window[ensightenOptions.ns].checkHasRun(d) | |
| }); | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: h || -1, | |
| dependencies: g, | |
| code: a | |
| }); | |
| else if ("object" !== typeof a) return !1; | |
| b.registerRule(a) | |
| } | |
| }; | |
| b.bindDependencyPageSpecificCompletion = function(a, c, d, f, p) { | |
| var g = []; | |
| if (!e.checkForInvalidDependencies(c, f, d, p)) { | |
| g.push(function() { | |
| return window[ensightenOptions.ns].executionState.dataDefinitionComplete | |
| }); | |
| g.push(function() { | |
| return window[ensightenOptions.ns].checkHasRun(d) | |
| }); | |
| if ("function" === typeof a) a = new b.Rule({ | |
| id: c || -1, | |
| deploymentId: f || -1, | |
| dependencies: g, | |
| code: a | |
| }); | |
| else if ("object" !== typeof a) return !1; | |
| b.registerRule(a) | |
| } | |
| }; | |
| b.dataDefintionIds = []; | |
| b.dataDefinitions = []; | |
| b.pageSpecificDataDefinitionsSet = !1; | |
| b.setPageSpecificDataDefinitionIds = function(a) { | |
| for (var c = a ? a.length : 0, d = 0; d < c; d++) { | |
| var e = a[d]; | |
| if (Array.prototype.indexOf) - 1 == b.dataDefinitionIds.indexOf(e) && b.dataDefinitionIds.push(e); | |
| else { | |
| for (var f = !1, g = | |
| b.dataDefinitionIds.length, l = 0; l < g; l++) | |
| if (b.dataDefinitionIds[l] === e) { | |
| f = !0; | |
| break | |
| } | |
| f || b.dataDefinitionIds.push(e) | |
| } | |
| } | |
| b.pageSpecificDataDefinitionsSet = !0; | |
| n() | |
| }; | |
| b.DataDefinition = function(a, b) { | |
| this.id = a; | |
| this.registrationFn = b; | |
| this.endRegistrationTime = this.startRegistrationTime = null; | |
| this.startRegistration = function() { | |
| this.startRegistrationTime = new Date | |
| }; | |
| this.endRegistration = function() { | |
| this.endRegistrationTime = new Date | |
| } | |
| }; | |
| b.registerDataDefinition = function(a, c) { | |
| var d = b.dataDefinitions[c]; | |
| d || (d = new b.DataDefinition(c, | |
| a), b.dataDefinitions[c] = d); | |
| d.startRegistrationTime || (d.startRegistration(), d.registrationFn(), d.endRegistration()); | |
| b.pageSpecificDataDefinitionsSet && n() | |
| }; | |
| b.callOnDataDefintionComplete = function() { | |
| b.executionState.dataDefinitionComplete = !0; | |
| b.testAll() | |
| }; | |
| b.callOnDOMParsed = function() { | |
| window[ensightenOptions.ns].executionState.DOMParsed = !0; | |
| window[ensightenOptions.ns].testAll() | |
| }; | |
| b.callOnDOMLoaded = function() { | |
| window[ensightenOptions.ns].executionState.DOMParsed = !0; | |
| window[ensightenOptions.ns].executionState.DOMLoaded = !0; | |
| window[ensightenOptions.ns].testAll() | |
| }; | |
| b.callOnPageSpecificCompletion = function() { | |
| for (var a = document.getElementsByTagName("script"), b = 0, d = a.length; b < d; b++) | |
| if (a[b].src && a[b].src.match(/\.ensighten\.com\/(.+?)\/code\/.*/i) && "loaded" != a[b].readyState && "complete" != a[b].readyState) { | |
| setTimeout(window[ensightenOptions.ns].callOnPageSpecificCompletion, 50); | |
| return | |
| } | |
| setTimeout(function() { | |
| window[ensightenOptions.ns].executionState.conditionalRules = !0; | |
| window[ensightenOptions.ns].testAll() | |
| }, 1) | |
| }; | |
| b.callOnGetServerComponent = | |
| function() { | |
| window[ensightenOptions.ns].executionState.readyForServerComponent = !0; | |
| window[ensightenOptions.ns].testAll() | |
| }; | |
| b.hasDOMParsed = function() { | |
| return window[ensightenOptions.ns].executionState.DOMParsed | |
| }; | |
| b.hasDOMLoaded = function() { | |
| return window[ensightenOptions.ns].executionState.DOMLoaded | |
| }; | |
| b.hasPageSpecificCompletion = function() { | |
| return window[ensightenOptions.ns].executionState.conditionalRules | |
| }; | |
| var r = function() { | |
| var a = [], | |
| b = !1, | |
| d = !1; | |
| return { | |
| add: function(c) { | |
| b && !d ? c() : "function" == typeof c && (a[a.length] = | |
| c) | |
| }, | |
| exec: function() { | |
| d = !0; | |
| do { | |
| var c = a; | |
| a = []; | |
| b = !0; | |
| for (var e = 0; e < c.length; e++) try { | |
| c[e].call(window) | |
| } catch (g) { | |
| window[ensightenOptions.ns].reportException(g) | |
| } | |
| } while (0 < a.length); | |
| d = !1 | |
| }, | |
| haveRun: function() { | |
| return b | |
| } | |
| } | |
| }; | |
| b.new_fArray = function() { | |
| return r() | |
| }; | |
| e.timer = null; | |
| (function() { | |
| function a(a, b) { | |
| return function() { | |
| a.apply(b, arguments) | |
| } | |
| } | |
| window.console || (window.console = {}); | |
| var b = window.console; | |
| if (!b.log) | |
| if (window.log4javascript) { | |
| var d = log4javascript.getDefaultLogger(); | |
| b.log = a(d.info, d); | |
| b.debug = a(d.debug, d); | |
| b.info = | |
| a(d.info, d); | |
| b.warn = a(d.warn, d); | |
| b.error = a(d.error, d) | |
| } else b.log = function() {}; | |
| b.debug || (b.debug = b.log); | |
| b.info || (b.info = b.log); | |
| b.warn || (b.warn = b.log); | |
| b.error || (b.error = b.log) | |
| })(); | |
| document.addEventListener ? (-1 < navigator.userAgent.indexOf("AppleWebKit/") ? e.timer = window.setInterval(function() { | |
| /loaded|interactive|complete/.test(document.readyState) && (clearInterval(e.timer), b.callOnDOMParsed()) | |
| }, 50) : document.addEventListener("DOMContentLoaded", b.callOnDOMParsed, !1), window.addEventListener("load", b.callOnDOMLoaded, !1)) : (setTimeout(function() { | |
| var a = window.document; | |
| (function() { | |
| try { | |
| if (!document.body) throw "continue"; | |
| a.documentElement.doScroll("left") | |
| } catch (c) { | |
| setTimeout(arguments.callee, 15); | |
| return | |
| } | |
| window[ensightenOptions.ns].callOnDOMParsed() | |
| })() | |
| }, 1), window.attachEvent("onload", function() { | |
| window[ensightenOptions.ns].callOnDOMLoaded() | |
| })); | |
| document.readyState && "complete" === document.readyState && (b.executionState.DOMParsed = !0, b.executionState.DOMLoaded = !0); | |
| "true" === e.options.enableTagAuditBeacon && b.sampleBeacon() && | |
| window.setTimeout(function() { | |
| if (window[ensightenOptions.ns] && !window[ensightenOptions.ns].mobilePlatform) try { | |
| for (var a = [], c, d, h, l, g = 0; g < e.ruleList.length; ++g) d = e.ruleList[g], h = d.executionData.hasRun ? "1" : "0", l = d.deploymentId.toString() + "|" + d.id.toString() + "|" + h, a.push(l); | |
| c = "[" + a.join(";") + "]"; | |
| var m = window.location.protocol + "//" + e.nexus + "/" + encodeURIComponent(f.client) + "/" + encodeURIComponent(f.publishPath) + "/TagAuditBeacon.rnc?cid=" + encodeURIComponent(f.clientId) + "&data=" + c + "&idx=0&r=" + e.rand; | |
| b.imageRequest(m) | |
| } catch (q) { | |
| b.currentRuleId = -1, b.currentDeploymentId = -1, a = new e.BeaconException(q), window[ensightenOptions.ns].reportException(a) | |
| } | |
| }, 3E3); | |
| window.setInterval(b.testAll, e.options.interval); | |
| return b | |
| }(ensightenOptions); | |
| "true" === ensightenOptions.enablePagePerfBeacon && window[ensightenOptions.ns] && window[ensightenOptions.ns].sampleBeacon() && window[ensightenOptions.ns].bindDOMParsed(function() { | |
| if (!window[ensightenOptions.ns].mobilePlatform) { | |
| var f = window.performance; | |
| if (f) { | |
| f = f.timing || {}; | |
| var l = f.navigationStart || 0, | |
| m = { | |
| connectEnd: "ce", | |
| connectStart: "cs", | |
| domComplete: "dc", | |
| domContentLoadedEventEnd: "dclee", | |
| domContentLoadedEventStart: "dcles", | |
| domInteractive: "di", | |
| domLoading: "dl", | |
| domainLookupEnd: "dle", | |
| domainLookupStart: "dls", | |
| fetchStart: "fs", | |
| loadEventEnd: "lee", | |
| loadEventStart: "les", | |
| redirectEnd: "rede", | |
| redirectStart: "reds", | |
| requestStart: "reqs", | |
| responseStart: "resps", | |
| responseEnd: "respe", | |
| secureConnectionStart: "scs", | |
| unloadEventStart: "ues", | |
| unloadEventEnd: "uee" | |
| }; | |
| var n = "&ns=" + encodeURIComponent(f.navigationStart); | |
| for (var e in m) | |
| if (void 0 !== f[e]) { | |
| var b = f[e] - l; | |
| n += "&" + m[e] + "=" + (0 < b ? encodeURIComponent(b) : 0) | |
| } else n += "&" + m[e] + "=-1"; | |
| window[ensightenOptions.ns].timing = n; | |
| e = ensightenOptions.nexus || "nexus.ensighten.com"; | |
| f = ensightenOptions.staticJavascriptPath || | |
| ""; | |
| n = f.indexOf("/", 0); | |
| l = f.indexOf("/code/"); | |
| f = f.substring(n, l) + "/perf.rnc"; | |
| f += "?cid=" + encodeURIComponent(ensightenOptions.clientId) + window[ensightenOptions.ns].timing; | |
| window[ensightenOptions.ns].imageRequest("//" + e + f) | |
| } | |
| } | |
| }); | |
| Bootstrapper.dataDefinitionIds = []; | |
| Bootstrapper.bindImmediate(function() { | |
| var Bootstrapper = window["Bootstrapper"]; | |
| var ensightenOptions = Bootstrapper.ensightenOptions | |
| }, 2674012, 573553); | |
| Bootstrapper.bindDependencyImmediate(function() { | |
| var Bootstrapper = window["Bootstrapper"]; | |
| var ensightenOptions = Bootstrapper.ensightenOptions; | |
| ensClientConfig = { | |
| "info": { | |
| "name": "altair", | |
| "publishPath": "prod", | |
| "clientId": 2538, | |
| "nexus": "nexus.ensighten.com" | |
| }, | |
| "cookieTypes": ["Analytics", "Performance and Functionality", "Social Media"], | |
| "whitelist": { | |
| "default": [{ | |
| "tag": "hyperworks(\\.com\\.(br|mx)|\\.(fr|se))", | |
| "displayName": "Hyperworks" | |
| }, { | |
| "tag": "mediag.com", | |
| "displayName": "MediaG" | |
| }, { | |
| "tag": "slideslive.com", | |
| "displayName": "slideslive" | |
| }, { | |
| "tag": "altair(hyperworks|engineering)?((\\.com(\\.(cn|es))?)|(\\.de|\\-india\\.in|jp\\.co\\.jp|\\.co\\.(kr|za|uk)|\\.se|\\.it|\\.jp|\\.ca))", | |
| "displayName": "Altair" | |
| }, { | |
| "tag": "api.hubapi.com", | |
| "displayName": "Hubspot API" | |
| }, { | |
| "tag": "altairproductdesign.com", | |
| "displayName": "AltairProductDesign" | |
| }, { | |
| "tag": "thinklabs.com", | |
| "displayName": "Thinklab" | |
| }, { | |
| "tag": "pbs((grid)?works|professional)?(\\.com)?\\.(au|br|ca|cn|fr|de|in|it|jp|co\\.(kr|uk)|se|com)", | |
| "displayName": "PBS" | |
| }, { | |
| "tag": "solidthinking\\.(com|fr|jp|co\\.kr)", | |
| "displayName": "SolidThinking" | |
| }, { | |
| "tag": "ensighten\\.com", | |
| "displayName": "Ensighten" | |
| }], | |
| "Analytics": [{ | |
| "tag": "\\.google-analytics\\.com", | |
| "displayName": "Google Analytics" | |
| }, { | |
| "tag": "(googletagmanager\\.com)|(tagmanager.google.com)", | |
| "displayName": "Google Tag Manager" | |
| }, { | |
| "tag": "doubleclick.net", | |
| "displayName": "DoubleClick" | |
| }, { | |
| "tag": "wiredminds\\.de", | |
| "displayName": "WiredMinds" | |
| }], | |
| "Performance and Functionality": [{ | |
| "tag": "youtube.com", | |
| "displayName": "YouTube" | |
| }, { | |
| "tag": "(hs\\-scripts|hsforms|hubspot)\\.(com|net)", | |
| "displayName": "HubSpot" | |
| }, { | |
| "tag": "mailchimp.com", | |
| "displayName": "MailChimp" | |
| }, { | |
| "tag": "wistia\\.com|wistia\\.net|embedwistia", | |
| "displayName": "Wistia" | |
| }, { | |
| "tag": "hellobar.com", | |
| "displayName": "hellobar" | |
| }], | |
| "Social Media": [{ | |
| "tag": "twitter\\.com", | |
| "displayName": "Twitter Conversion Tracking" | |
| }, { | |
| "tag": "facebook\\.com|facebook\\.net", | |
| "displayName": "Facebook Custom Audiences" | |
| }, { | |
| "tag": "(linkedin|licdn)\\.com", | |
| "displayName": "LinkedIn Widget" | |
| }] | |
| }, | |
| "defaultEnv": "", | |
| "featureToggles": { | |
| "enableReporting": true, | |
| "enableAllowedDomainsReporting": false, | |
| "enableFiltering": true, | |
| "enablePrivacyNotice": true, | |
| "enableConsentModal": true, | |
| "showTrustedDomains": false, | |
| "requireSSL": false, | |
| "enableEnvironmentMatching": false, | |
| "enableDataMonitoring": false, | |
| "usesWhitelist": true, | |
| "consentWidget": false | |
| }, | |
| "libraryPackage": "enterprise", | |
| "dataMonitoring": { | |
| "mode": "block", | |
| "blockURLParamsRegex": [], | |
| "domainsAllowed": [] | |
| }, | |
| "environmentConfigs": [{ | |
| "name": "aTest", | |
| "countryCode": "ad", | |
| "languageCode": "ab-AD", | |
| "condition": { | |
| "type": "url", | |
| "key": "", | |
| "value": "privTest\x3dtrue", | |
| "shouldBePositive": true, | |
| "operator": "contains" | |
| }, | |
| "optVals": { | |
| "Social Media": 0, | |
| "Performance and Functionality": 0, | |
| "Analytics": 0 | |
| }, | |
| "translation": { | |
| "notificationBannerContent": 'Data protection regulations are changing for the better and we need your consent to collect data through the use of cookies. You are free to change your mind later and can opt-in at any time. {{Click here}} to see your cookie preferences.\n\nIf you are interested in learning more about how we handle your data, please take a look at Altair\u2019s \x3ca href\x3d"https://www.altair.com/popup_privacy.htm"\x3edata usage policy here\x3c/a\x3e.', | |
| "consentTitle": "CUSTOMIZE COOKIE SETTINGS", | |
| "consentDescription": "\x26nbsp;", | |
| "save": "Save", | |
| "cancel": "Cancel", | |
| "close": "I Understand", | |
| "cookies": { | |
| "Analytics": { | |
| "title": "Analytics", | |
| "description": "These technologies collect information that is used in aggregate form to help us understand how our websites are being used are being used or to help us continuously improve our websites." | |
| }, | |
| "Performance and Functionality": { | |
| "title": "Performance and Functionality", | |
| "description": "These technologies are used to enhance the performance and functionality of our websites but are non-essential to their use. However, without these cookies, certain functionality may become unavailable." | |
| }, | |
| "Social Media": { | |
| "title": "Social Media", | |
| "description": "These technologies are used to enable you to share pages and content that you find interesting on our websites through third party social networking and other websites." | |
| } | |
| } | |
| } | |
| }, { | |
| "name": "Not EU", | |
| "countryCode": "ca", | |
| "languageCode": "en-CA", | |
| "condition": { | |
| "type": "jsVar", | |
| "key": "isEU", | |
| "value": "false", | |
| "shouldBePositive": true, | |
| "operator": "contains", | |
| "_or": { | |
| "type": "url", | |
| "key": "", | |
| "value": "privTest\x3dtrue", | |
| "shouldBePositive": true, | |
| "operator": "contains" | |
| } | |
| }, | |
| "optVals": { | |
| "Social Media": 1, | |
| "Performance and Functionality": 1, | |
| "Analytics": 1 | |
| }, | |
| "translation": { | |
| "notificationBannerContent": 'Data protection regulations are changing for the better and we need your consent to collect data through the use of cookies. You are free to change your mind later and can opt-in at any time. {{Click here}} to see your cookie preferences.\n\nIf you are interested in learning more about how we handle your data, please take a look at Altair\u2019s \x3ca href\x3d"https://www.altair.com/popup_privacy.htm"\x3edata usage policy here\x3c/a\x3e.', | |
| "consentTitle": "CUSTOMIZE COOKIE SETTINGS", | |
| "consentDescription": "\x26nbsp;", | |
| "save": "Save", | |
| "cancel": "Cancel", | |
| "close": "I Understand", | |
| "cookies": { | |
| "Analytics": { | |
| "title": "Analytics", | |
| "description": "These technologies collect information that is used in aggregate form to help us understand how our websites are being used are being used or to help us continuously improve our websites." | |
| }, | |
| "Performance and Functionality": { | |
| "title": "Performance and Functionality", | |
| "description": "These technologies are used to enhance the performance and functionality of our websites but are non-essential to their use. However, without these cookies, certain functionality may become unavailable." | |
| }, | |
| "Social Media": { | |
| "title": "Social Media", | |
| "description": "These technologies are used to enable you to share pages and content that you find interesting on our websites through third party social networking and other websites." | |
| } | |
| } | |
| } | |
| }, { | |
| "name": "EU", | |
| "countryCode": "de", | |
| "languageCode": "de-DE", | |
| "condition": { | |
| "type": "jsVar", | |
| "key": "isEU", | |
| "value": "true", | |
| "shouldBePositive": true, | |
| "operator": "contains" | |
| }, | |
| "optVals": { | |
| "Social Media": 0, | |
| "Performance and Functionality": 1, | |
| "Analytics": 0 | |
| }, | |
| "translation": { | |
| "notificationBannerContent": 'Data protection regulations are changing for the better and we need your consent to collect data through the use of cookies. You are free to change your mind later and can opt-in at any time. {{Click here}} to see your cookie preferences.\n\nIf you are interested in learning more about how we handle your data, please take a look at Altair\u2019s \x3ca href\x3d"https://www.altair.com/popup_privacy.htm"\x3edata usage policy here\x3c/a\x3e.', | |
| "consentTitle": "CUSTOMIZE COOKIE SETTINGS", | |
| "consentDescription": "\x26nbsp;", | |
| "save": "Save", | |
| "cancel": "Cancel", | |
| "close": "I Understand", | |
| "cookies": { | |
| "Analytics": { | |
| "title": "Analytics", | |
| "description": "These technologies collect information that is used in aggregate form to help us understand how our websites are being used are being used or to help us continuously improve our websites." | |
| }, | |
| "Performance and Functionality": { | |
| "title": "Performance and Functionality", | |
| "description": "These technologies are used to enhance the performance and functionality of our websites but are non-essential to their use. However, without these cookies, certain functionality may become unavailable." | |
| }, | |
| "Social Media": { | |
| "title": "Social Media", | |
| "description": "These technologies are used to enable you to share pages and content that you find interesting on our websites through third party social networking and other websites." | |
| } | |
| } | |
| } | |
| }] | |
| }; | |
| if (Bootstrapper.ensightenOptions.publishPath) ensClientConfig.info.publishPath = Bootstrapper.ensightenOptions.publishPath; | |
| if (Bootstrapper.ensightenOptions.nexus) ensClientConfig.info.nexus = Bootstrapper.ensightenOptions.nexus | |
| }, 2697112, [2484092], 544086, [544085]); | |
| Bootstrapper.bindImmediate(function() { | |
| var Bootstrapper = window["Bootstrapper"]; | |
| var ensightenOptions = Bootstrapper.ensightenOptions; | |
| var euArr = ["Austria", "Italy", "Belgium", "Latvia", "Bulgaria", "Lithuania", "Croatia", "Luxembourg", "Cyprus", "Malta", "Czech Republic", "Netherlands", "Denmark", "Poland", "Estonia", "Portugal", "Finland", "Romania", "France", "Slovakia", "Germany", "Slovenia", "Greece", "Spain", "Hungary", "Sweden", "Ireland", "United Kingdom", "Switzerland"]; | |
| window.isEU = "false"; | |
| if (document.cookie.match(/user_country.*/i) && | |
| euArr.indexOf(document.cookie.match(/user_country.*/i)[0].replace(/user_country\=/i, "")) > -1) window.isEU = "true" | |
| }, 2484092, 544085); | |
| Bootstrapper.bindDependencyImmediate(function() { | |
| var Bootstrapper = window["Bootstrapper"]; | |
| var ensightenOptions = Bootstrapper.ensightenOptions; | |
| window.MutationObserver = window.MutationObserver || function(w) { | |
| function v(a) { | |
| this.i = []; | |
| this.m = a | |
| } | |
| function I(a) { | |
| (function c() { | |
| var d = a.takeRecords(); | |
| d.length && a.m(d, a); | |
| a.h = setTimeout(c, v._period) | |
| })() | |
| } | |
| function p(a) { | |
| var b = { | |
| type: null, | |
| target: null, | |
| addedNodes: [], | |
| removedNodes: [], | |
| previousSibling: null, | |
| nextSibling: null, | |
| attributeName: null, | |
| attributeNamespace: null, | |
| oldValue: null | |
| }, | |
| c; | |
| for (c in a) b[c] !== w && a[c] !== w && (b[c] = a[c]); | |
| return b | |
| } | |
| function J(a, b) { | |
| var c = C(a, b); | |
| return function(d) { | |
| var f = d.length, | |
| n; | |
| b.a && 3 === a.nodeType && a.nodeValue !== c.a && d.push(new p({ | |
| type: "characterData", | |
| target: a, | |
| oldValue: c.a | |
| })); | |
| b.b && c.b && A(d, a, c.b, b.f); | |
| if (b.c || b.g) n = K(d, a, c, b); | |
| if (n || d.length !== f) c = C(a, b) | |
| } | |
| } | |
| function L(a, b) { | |
| return b.value | |
| } | |
| function M(a, b) { | |
| return "style" !== b.name ? b.value : a.style.cssText | |
| } | |
| function A(a, b, c, d) { | |
| for (var f = {}, n = b.attributes, k, g, x = n.length; x--;) k = n[x], g = k.name, d && d[g] === w || (D(b, k) !== c[g] && | |
| a.push(p({ | |
| type: "attributes", | |
| target: b, | |
| attributeName: g, | |
| oldValue: c[g], | |
| attributeNamespace: k.namespaceURI | |
| })), f[g] = !0); | |
| for (g in c) f[g] || a.push(p({ | |
| target: b, | |
| type: "attributes", | |
| attributeName: g, | |
| oldValue: c[g] | |
| })) | |
| } | |
| function K(a, b, c, d) { | |
| function f(b, c, f, k, y) { | |
| var g = b.length - 1; | |
| y = -~((g - y) / 2); | |
| for (var h, l, e; e = b.pop();) h = f[e.j], l = k[e.l], d.c && y && Math.abs(e.j - e.l) >= g && (a.push(p({ | |
| type: "childList", | |
| target: c, | |
| addedNodes: [h], | |
| removedNodes: [h], | |
| nextSibling: h.nextSibling, | |
| previousSibling: h.previousSibling | |
| })), y--), d.b && l.b && A(a, h, l.b, | |
| d.f), d.a && 3 === h.nodeType && h.nodeValue !== l.a && a.push(p({ | |
| type: "characterData", | |
| target: h, | |
| oldValue: l.a | |
| })), d.g && n(h, l) | |
| } | |
| function n(b, c) { | |
| for (var g = b.childNodes, q = c.c, x = g.length, v = q ? q.length : 0, h, l, e, m, t, z = 0, u = 0, r = 0; u < x || r < v;) m = g[u], t = (e = q[r]) && e.node, m === t ? (d.b && e.b && A(a, m, e.b, d.f), d.a && e.a !== w && m.nodeValue !== e.a && a.push(p({ | |
| type: "characterData", | |
| target: m, | |
| oldValue: e.a | |
| })), l && f(l, b, g, q, z), d.g && (m.childNodes.length || e.c && e.c.length) && n(m, e), u++, r++) : (k = !0, h || (h = {}, l = []), m && (h[e = E(m)] || (h[e] = !0, -1 === (e = F(q, m, r, | |
| "node")) ? d.c && (a.push(p({ | |
| type: "childList", | |
| target: b, | |
| addedNodes: [m], | |
| nextSibling: m.nextSibling, | |
| previousSibling: m.previousSibling | |
| })), z++) : l.push({ | |
| j: u, | |
| l: e | |
| })), u++), t && t !== g[u] && (h[e = E(t)] || (h[e] = !0, -1 === (e = F(g, t, u)) ? d.c && (a.push(p({ | |
| type: "childList", | |
| target: c.node, | |
| removedNodes: [t], | |
| nextSibling: q[r + 1], | |
| previousSibling: q[r - 1] | |
| })), z--) : l.push({ | |
| j: e, | |
| l: r | |
| })), r++)); | |
| l && f(l, b, g, q, z) | |
| } | |
| var k; | |
| n(b, c); | |
| return k | |
| } | |
| function C(a, b) { | |
| var c = !0; | |
| return function f(a) { | |
| var k = { | |
| node: a | |
| }; | |
| !b.a || 3 !== a.nodeType && 8 !== a.nodeType ? (b.b && c && 1 === a.nodeType && | |
| (k.b = G(a.attributes, function(c, f) { | |
| if (!b.f || b.f[f.name]) c[f.name] = D(a, f); | |
| return c | |
| })), c && (b.c || b.a || b.b && b.g) && (k.c = N(a.childNodes, f)), c = b.g) : k.a = a.nodeValue; | |
| return k | |
| }(a) | |
| } | |
| function E(a) { | |
| try { | |
| return a.id || (a.mo_id = a.mo_id || H++) | |
| } catch (b) { | |
| try { | |
| return a.nodeValue | |
| } catch (c) { | |
| return H++ | |
| } | |
| } | |
| } | |
| function N(a, b) { | |
| for (var c = [], d = 0; d < a.length; d++) c[d] = b(a[d], d, a); | |
| return c | |
| } | |
| function G(a, b) { | |
| for (var c = {}, d = 0; d < a.length; d++) c = b(c, a[d], d, a); | |
| return c | |
| } | |
| function F(a, b, c, d) { | |
| for (; c < a.length; c++) | |
| if ((d ? a[c][d] : a[c]) === b) return c; | |
| return -1 | |
| } | |
| v._period = 30; | |
| v.prototype = { | |
| observe: function(a, b) { | |
| for (var c = { | |
| b: !!(b.attributes || b.attributeFilter || b.attributeOldValue), | |
| c: !!b.childList, | |
| g: !!b.subtree, | |
| a: !(!b.characterData && !b.characterDataOldValue) | |
| }, d = this.i, f = 0; f < d.length; f++) d[f].s === a && d.splice(f, 1); | |
| b.attributeFilter && (c.f = G(b.attributeFilter, function(a, b) { | |
| a[b] = !0; | |
| return a | |
| })); | |
| d.push({ | |
| s: a, | |
| o: J(a, c) | |
| }); | |
| this.h || I(this) | |
| }, | |
| takeRecords: function() { | |
| for (var a = [], b = this.i, c = 0; c < b.length; c++) b[c].o(a); | |
| return a | |
| }, | |
| disconnect: function() { | |
| this.i = []; | |
| clearTimeout(this.h); | |
| this.h = null | |
| } | |
| }; | |
| var B = document.createElement("i"); | |
| B.style.top = 0; | |
| var D = (B = "null" != B.attributes.style.value) ? L : M, | |
| H = 1; | |
| return v | |
| }(void 0); | |
| var LZString = function() { | |
| var f = String.fromCharCode; | |
| var keyStrBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d"; | |
| var keyStrUriSafe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$"; | |
| var baseReverseDic = {}; | |
| function getBaseValue(alphabet, character) { | |
| if (!baseReverseDic[alphabet]) { | |
| baseReverseDic[alphabet] = {}; | |
| for (var i = 0; i < alphabet.length; i++) baseReverseDic[alphabet][alphabet.charAt(i)] = | |
| i | |
| } | |
| return baseReverseDic[alphabet][character] | |
| } | |
| var LZString = { | |
| compressToBase64: function(input) { | |
| if (input == null) return ""; | |
| var res = LZString._compress(input, 6, function(a) { | |
| return keyStrBase64.charAt(a) | |
| }); | |
| switch (res.length % 4) { | |
| default: | |
| case 0: | |
| return res; | |
| case 1: | |
| return res + "\x3d\x3d\x3d"; | |
| case 2: | |
| return res + "\x3d\x3d"; | |
| case 3: | |
| return res + "\x3d" | |
| } | |
| }, | |
| decompressFromBase64: function(input) { | |
| if (input == null) return ""; | |
| if (input == "") return null; | |
| return LZString._decompress(input.length, 32, function(index) { | |
| return getBaseValue(keyStrBase64, | |
| input.charAt(index)) | |
| }) | |
| }, | |
| compressToUTF16: function(input) { | |
| if (input == null) return ""; | |
| return LZString._compress(input, 15, function(a) { | |
| return f(a + 32) | |
| }) + " " | |
| }, | |
| decompressFromUTF16: function(compressed) { | |
| if (compressed == null) return ""; | |
| if (compressed == "") return null; | |
| return LZString._decompress(compressed.length, 16384, function(index) { | |
| return compressed.charCodeAt(index) - 32 | |
| }) | |
| }, | |
| compressToUint8Array: function(uncompressed) { | |
| var compressed = LZString.compress(uncompressed); | |
| var buf = new Uint8Array(compressed.length * 2); | |
| for (var i = | |
| 0, TotalLen = compressed.length; i < TotalLen; i++) { | |
| var current_value = compressed.charCodeAt(i); | |
| buf[i * 2] = current_value >>> 8; | |
| buf[i * 2 + 1] = current_value % 256 | |
| } | |
| return buf | |
| }, | |
| decompressFromUint8Array: function(compressed) { | |
| if (compressed === null || compressed === undefined) return LZString.decompress(compressed); | |
| else { | |
| var buf = new Array(compressed.length / 2); | |
| for (var i = 0, TotalLen = buf.length; i < TotalLen; i++) buf[i] = compressed[i * 2] * 256 + compressed[i * 2 + 1]; | |
| var result = []; | |
| buf.forEach(function(c) { | |
| result.push(f(c)) | |
| }); | |
| return LZString.decompress(result.join("")) | |
| } | |
| }, | |
| compressToEncodedURIComponent: function(input) { | |
| if (input == null) return ""; | |
| return LZString._compress(input, 6, function(a) { | |
| return keyStrUriSafe.charAt(a) | |
| }) | |
| }, | |
| decompressFromEncodedURIComponent: function(input) { | |
| if (input == null) return ""; | |
| if (input == "") return null; | |
| input = input.replace(/ /g, "+"); | |
| return LZString._decompress(input.length, 32, function(index) { | |
| return getBaseValue(keyStrUriSafe, input.charAt(index)) | |
| }) | |
| }, | |
| compress: function(uncompressed) { | |
| return LZString._compress(uncompressed, 16, function(a) { | |
| return f(a) | |
| }) | |
| }, | |
| _compress: function(uncompressed, | |
| bitsPerChar, getCharFromInt) { | |
| if (uncompressed == null) return ""; | |
| var i, value, context_dictionary = {}, | |
| context_dictionaryToCreate = {}, | |
| context_c = "", | |
| context_wc = "", | |
| context_w = "", | |
| context_enlargeIn = 2, | |
| context_dictSize = 3, | |
| context_numBits = 2, | |
| context_data = [], | |
| context_data_val = 0, | |
| context_data_position = 0, | |
| ii; | |
| for (ii = 0; ii < uncompressed.length; ii += 1) { | |
| context_c = uncompressed.charAt(ii); | |
| if (!Object.prototype.hasOwnProperty.call(context_dictionary, context_c)) { | |
| context_dictionary[context_c] = context_dictSize++; | |
| context_dictionaryToCreate[context_c] = | |
| true | |
| } | |
| context_wc = context_w + context_c; | |
| if (Object.prototype.hasOwnProperty.call(context_dictionary, context_wc)) context_w = context_wc; | |
| else { | |
| if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) { | |
| if (context_w.charCodeAt(0) < 256) { | |
| for (i = 0; i < context_numBits; i++) { | |
| context_data_val = context_data_val << 1; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data_position = 0; | |
| context_data.push(getCharFromInt(context_data_val)); | |
| context_data_val = 0 | |
| } else context_data_position++ | |
| } | |
| value = context_w.charCodeAt(0); | |
| for (i = 0; i < 8; i++) { | |
| context_data_val = context_data_val << 1 | value & 1; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data_position = 0; | |
| context_data.push(getCharFromInt(context_data_val)); | |
| context_data_val = 0 | |
| } else context_data_position++; | |
| value = value >> 1 | |
| } | |
| } else { | |
| value = 1; | |
| for (i = 0; i < context_numBits; i++) { | |
| context_data_val = context_data_val << 1 | value; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data_position = 0; | |
| context_data.push(getCharFromInt(context_data_val)); | |
| context_data_val = 0 | |
| } else context_data_position++; | |
| value = | |
| 0 | |
| } | |
| value = context_w.charCodeAt(0); | |
| for (i = 0; i < 16; i++) { | |
| context_data_val = context_data_val << 1 | value & 1; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data_position = 0; | |
| context_data.push(getCharFromInt(context_data_val)); | |
| context_data_val = 0 | |
| } else context_data_position++; | |
| value = value >> 1 | |
| } | |
| } | |
| context_enlargeIn--; | |
| if (context_enlargeIn == 0) { | |
| context_enlargeIn = Math.pow(2, context_numBits); | |
| context_numBits++ | |
| } | |
| delete context_dictionaryToCreate[context_w] | |
| } else { | |
| value = context_dictionary[context_w]; | |
| for (i = 0; i < context_numBits; i++) { | |
| context_data_val = | |
| context_data_val << 1 | value & 1; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data_position = 0; | |
| context_data.push(getCharFromInt(context_data_val)); | |
| context_data_val = 0 | |
| } else context_data_position++; | |
| value = value >> 1 | |
| } | |
| } | |
| context_enlargeIn--; | |
| if (context_enlargeIn == 0) { | |
| context_enlargeIn = Math.pow(2, context_numBits); | |
| context_numBits++ | |
| } | |
| context_dictionary[context_wc] = context_dictSize++; | |
| context_w = String(context_c) | |
| } | |
| } | |
| if (context_w !== "") { | |
| if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) { | |
| if (context_w.charCodeAt(0) < | |
| 256) { | |
| for (i = 0; i < context_numBits; i++) { | |
| context_data_val = context_data_val << 1; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data_position = 0; | |
| context_data.push(getCharFromInt(context_data_val)); | |
| context_data_val = 0 | |
| } else context_data_position++ | |
| } | |
| value = context_w.charCodeAt(0); | |
| for (i = 0; i < 8; i++) { | |
| context_data_val = context_data_val << 1 | value & 1; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data_position = 0; | |
| context_data.push(getCharFromInt(context_data_val)); | |
| context_data_val = 0 | |
| } else context_data_position++; | |
| value = | |
| value >> 1 | |
| } | |
| } else { | |
| value = 1; | |
| for (i = 0; i < context_numBits; i++) { | |
| context_data_val = context_data_val << 1 | value; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data_position = 0; | |
| context_data.push(getCharFromInt(context_data_val)); | |
| context_data_val = 0 | |
| } else context_data_position++; | |
| value = 0 | |
| } | |
| value = context_w.charCodeAt(0); | |
| for (i = 0; i < 16; i++) { | |
| context_data_val = context_data_val << 1 | value & 1; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data_position = 0; | |
| context_data.push(getCharFromInt(context_data_val)); | |
| context_data_val = 0 | |
| } else context_data_position++; | |
| value = value >> 1 | |
| } | |
| } | |
| context_enlargeIn--; | |
| if (context_enlargeIn == 0) { | |
| context_enlargeIn = Math.pow(2, context_numBits); | |
| context_numBits++ | |
| } | |
| delete context_dictionaryToCreate[context_w] | |
| } else { | |
| value = context_dictionary[context_w]; | |
| for (i = 0; i < context_numBits; i++) { | |
| context_data_val = context_data_val << 1 | value & 1; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data_position = 0; | |
| context_data.push(getCharFromInt(context_data_val)); | |
| context_data_val = 0 | |
| } else context_data_position++; | |
| value = value >> 1 | |
| } | |
| } | |
| context_enlargeIn--; | |
| if (context_enlargeIn == | |
| 0) { | |
| context_enlargeIn = Math.pow(2, context_numBits); | |
| context_numBits++ | |
| } | |
| } | |
| value = 2; | |
| for (i = 0; i < context_numBits; i++) { | |
| context_data_val = context_data_val << 1 | value & 1; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data_position = 0; | |
| context_data.push(getCharFromInt(context_data_val)); | |
| context_data_val = 0 | |
| } else context_data_position++; | |
| value = value >> 1 | |
| } | |
| while (true) { | |
| context_data_val = context_data_val << 1; | |
| if (context_data_position == bitsPerChar - 1) { | |
| context_data.push(getCharFromInt(context_data_val)); | |
| break | |
| } else context_data_position++ | |
| } | |
| return context_data.join("") | |
| }, | |
| decompress: function(compressed) { | |
| if (compressed == null) return ""; | |
| if (compressed == "") return null; | |
| return LZString._decompress(compressed.length, 32768, function(index) { | |
| return compressed.charCodeAt(index) | |
| }) | |
| }, | |
| _decompress: function(length, resetValue, getNextValue) { | |
| var dictionary = [], | |
| next, enlargeIn = 4, | |
| dictSize = 4, | |
| numBits = 3, | |
| entry = "", | |
| result = [], | |
| i, w, bits, resb, maxpower, power, c, data = { | |
| val: getNextValue(0), | |
| position: resetValue, | |
| index: 1 | |
| }; | |
| for (i = 0; i < 3; i += 1) dictionary[i] = i; | |
| bits = 0; | |
| maxpower = Math.pow(2, 2); | |
| power = 1; | |
| while (power != maxpower) { | |
| resb = | |
| data.val & data.position; | |
| data.position >>= 1; | |
| if (data.position == 0) { | |
| data.position = resetValue; | |
| data.val = getNextValue(data.index++) | |
| } | |
| bits |= (resb > 0 ? 1 : 0) * power; | |
| power <<= 1 | |
| } | |
| switch (next = bits) { | |
| case 0: | |
| bits = 0; | |
| maxpower = Math.pow(2, 8); | |
| power = 1; | |
| while (power != maxpower) { | |
| resb = data.val & data.position; | |
| data.position >>= 1; | |
| if (data.position == 0) { | |
| data.position = resetValue; | |
| data.val = getNextValue(data.index++) | |
| } | |
| bits |= (resb > 0 ? 1 : 0) * power; | |
| power <<= 1 | |
| } | |
| c = f(bits); | |
| break; | |
| case 1: | |
| bits = 0; | |
| maxpower = Math.pow(2, 16); | |
| power = 1; | |
| while (power != maxpower) { | |
| resb = data.val & | |
| data.position; | |
| data.position >>= 1; | |
| if (data.position == 0) { | |
| data.position = resetValue; | |
| data.val = getNextValue(data.index++) | |
| } | |
| bits |= (resb > 0 ? 1 : 0) * power; | |
| power <<= 1 | |
| } | |
| c = f(bits); | |
| break; | |
| case 2: | |
| return "" | |
| } | |
| dictionary[3] = c; | |
| w = c; | |
| result.push(c); | |
| while (true) { | |
| if (data.index > length) return ""; | |
| bits = 0; | |
| maxpower = Math.pow(2, numBits); | |
| power = 1; | |
| while (power != maxpower) { | |
| resb = data.val & data.position; | |
| data.position >>= 1; | |
| if (data.position == 0) { | |
| data.position = resetValue; | |
| data.val = getNextValue(data.index++) | |
| } | |
| bits |= (resb > 0 ? 1 : 0) * power; | |
| power <<= 1 | |
| } | |
| switch (c = bits) { | |
| case 0: | |
| bits = | |
| 0; | |
| maxpower = Math.pow(2, 8); | |
| power = 1; | |
| while (power != maxpower) { | |
| resb = data.val & data.position; | |
| data.position >>= 1; | |
| if (data.position == 0) { | |
| data.position = resetValue; | |
| data.val = getNextValue(data.index++) | |
| } | |
| bits |= (resb > 0 ? 1 : 0) * power; | |
| power <<= 1 | |
| } | |
| dictionary[dictSize++] = f(bits); | |
| c = dictSize - 1; | |
| enlargeIn--; | |
| break; | |
| case 1: | |
| bits = 0; | |
| maxpower = Math.pow(2, 16); | |
| power = 1; | |
| while (power != maxpower) { | |
| resb = data.val & data.position; | |
| data.position >>= 1; | |
| if (data.position == 0) { | |
| data.position = resetValue; | |
| data.val = getNextValue(data.index++) | |
| } | |
| bits |= (resb > 0 ? 1 : 0) * power; | |
| power <<= 1 | |
| } | |
| dictionary[dictSize++] = f(bits); | |
| c = dictSize - 1; | |
| enlargeIn--; | |
| break; | |
| case 2: | |
| return result.join("") | |
| } | |
| if (enlargeIn == 0) { | |
| enlargeIn = Math.pow(2, numBits); | |
| numBits++ | |
| } | |
| if (dictionary[c]) entry = dictionary[c]; | |
| else if (c === dictSize) entry = w + w.charAt(0); | |
| else return null; | |
| result.push(entry); | |
| dictionary[dictSize++] = w + entry.charAt(0); | |
| enlargeIn--; | |
| w = entry; | |
| if (enlargeIn == 0) { | |
| enlargeIn = Math.pow(2, numBits); | |
| numBits++ | |
| } | |
| } | |
| } | |
| }; | |
| return LZString | |
| }(); | |
| if (typeof define === "function" && define.amd) define("LZString", function() { | |
| return LZString | |
| }); | |
| else if (typeof module !== "undefined" && module != null) module.exports = LZString; | |
| else if (typeof angular !== "undefined" && angular != null) angular.module("LZString", []).factory("LZString", function() { | |
| return LZString | |
| }); | |
| (function(global) { | |
| var checkIfIteratorIsSupported = function() { | |
| try { | |
| return !!Symbol.iterator | |
| } catch (error) { | |
| return false | |
| } | |
| }; | |
| var iteratorSupported = checkIfIteratorIsSupported(); | |
| var createIterator = function(items) { | |
| var iterator = { | |
| next: function() { | |
| var value = items.shift(); | |
| return { | |
| done: value === void 0, | |
| value: value | |
| } | |
| } | |
| }; | |
| if (iteratorSupported) iterator[Symbol.iterator] = function() { | |
| return iterator | |
| }; | |
| return iterator | |
| }; | |
| var serializeParam = function(value) { | |
| return encodeURIComponent(value).replace(/%20/g, "+") | |
| }; | |
| var deserializeParam = function(value) { | |
| return decodeURIComponent(value).replace(/\+/g, " ") | |
| }; | |
| var polyfillURLSearchParams = function() { | |
| var URLSearchParams = function(searchString) { | |
| Object.defineProperty(this, "_entries", { | |
| value: {} | |
| }); | |
| if (typeof searchString === "string") { | |
| if (searchString !== "") { | |
| searchString = searchString.replace(/^\?/, ""); | |
| var attributes = searchString.split("\x26"); | |
| var attribute; | |
| for (var i = 0; i < attributes.length; i++) { | |
| attribute = attributes[i].split("\x3d"); | |
| this.append(deserializeParam(attribute[0]), attribute.length > 1 ? deserializeParam(attribute[1]) : "") | |
| } | |
| } | |
| } else if (searchString instanceof URLSearchParams) { | |
| var _this = this; | |
| searchString.forEach(function(value, name) { | |
| _this.append(value, name) | |
| }) | |
| } | |
| }; | |
| var proto = URLSearchParams.prototype; | |
| proto.append = function(name, value) { | |
| if (name in this._entries) this._entries[name].push(value.toString()); | |
| else this._entries[name] = [value.toString()] | |
| }; | |
| proto.delete = function(name) { | |
| delete this._entries[name] | |
| }; | |
| proto.get = function(name) { | |
| return name in this._entries ? this._entries[name][0] : null | |
| }; | |
| proto.getAll = function(name) { | |
| return name in this._entries ? this._entries[name].slice(0) : [] | |
| }; | |
| proto.has = function(name) { | |
| return name in this._entries | |
| }; | |
| proto.set = function(name, value) { | |
| this._entries[name] = [value.toString()] | |
| }; | |
| proto.forEach = function(callback, thisArg) { | |
| var entries; | |
| for (var name in this._entries) | |
| if (this._entries.hasOwnProperty(name)) { | |
| entries = | |
| this._entries[name]; | |
| for (var i = 0; i < entries.length; i++) callback.call(thisArg, entries[i], name, this) | |
| } | |
| }; | |
| proto.keys = function() { | |
| var items = []; | |
| this.forEach(function(value, name) { | |
| items.push(name) | |
| }); | |
| return createIterator(items) | |
| }; | |
| proto.values = function() { | |
| var items = []; | |
| this.forEach(function(value) { | |
| items.push(value) | |
| }); | |
| return createIterator(items) | |
| }; | |
| proto.entries = function() { | |
| var items = []; | |
| this.forEach(function(value, name) { | |
| items.push([name, value]) | |
| }); | |
| return createIterator(items) | |
| }; | |
| if (iteratorSupported) proto[Symbol.iterator] = | |
| proto.entries; | |
| proto.toString = function() { | |
| var searchArray = []; | |
| this.forEach(function(value, name) { | |
| searchArray.push(serializeParam(name) + "\x3d" + serializeParam(value)) | |
| }); | |
| return searchArray.join("\x26") | |
| }; | |
| global.URLSearchParams = URLSearchParams | |
| }; | |
| if (!("URLSearchParams" in global) || (new URLSearchParams("?a\x3d1")).toString() !== "a\x3d1") polyfillURLSearchParams() | |
| })(typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : this); | |
| (function(global) { | |
| var checkIfURLIsSupported = | |
| function() { | |
| try { | |
| var u = new URL("b", "http://a"); | |
| u.pathname = "c%20d"; | |
| return u.href === "http://a/c%20d" && u.searchParams | |
| } catch (e) { | |
| return false | |
| } | |
| }; | |
| var polyfillURL = function() { | |
| var _URL = global.URL; | |
| var URL = function(url, base) { | |
| if (typeof url !== "string") url = String(url); | |
| var doc = document, | |
| baseElement; | |
| if (base && (global.location === void 0 || base !== global.location.href)) { | |
| doc = document.implementation.createHTMLDocument(""); | |
| baseElement = doc.createElement("base"); | |
| baseElement.href = base; | |
| doc.head.appendChild(baseElement); | |
| try { | |
| if (baseElement.href.indexOf(base) !== | |
| 0) throw new Error(baseElement.href); | |
| } catch (err) { | |
| throw new Error("URL unable to set base " + base + " due to " + err); | |
| } | |
| } | |
| var anchorElement = doc.createElement("a"); | |
| anchorElement.href = url; | |
| if (baseElement) { | |
| doc.body.appendChild(anchorElement); | |
| anchorElement.href = anchorElement.href | |
| } | |
| if (anchorElement.protocol === ":" || !/:/.test(anchorElement.href)) throw new TypeError("Invalid URL"); | |
| Object.defineProperty(this, "_anchorElement", { | |
| value: anchorElement | |
| }) | |
| }; | |
| var proto = URL.prototype; | |
| var linkURLWithAnchorAttribute = function(attributeName) { | |
| Object.defineProperty(proto, | |
| attributeName, { | |
| get: function() { | |
| return this._anchorElement[attributeName] | |
| }, | |
| set: function(value) { | |
| this._anchorElement[attributeName] = value | |
| }, | |
| enumerable: true | |
| }) | |
| }; | |
| ["hash", "host", "hostname", "port", "protocol", "search"].forEach(function(attributeName) { | |
| linkURLWithAnchorAttribute(attributeName) | |
| }); | |
| Object.defineProperties(proto, { | |
| "toString": { | |
| get: function() { | |
| var _this = this; | |
| return function() { | |
| return _this.href | |
| } | |
| } | |
| }, | |
| "href": { | |
| get: function() { | |
| return this._anchorElement.href.replace(/\?$/, "") | |
| }, | |
| set: function(value) { | |
| this._anchorElement.href = | |
| value | |
| }, | |
| enumerable: true | |
| }, | |
| "pathname": { | |
| get: function() { | |
| return this._anchorElement.pathname.replace(/(^\/?)/, "/") | |
| }, | |
| set: function(value) { | |
| this._anchorElement.pathname = value | |
| }, | |
| enumerable: true | |
| }, | |
| "origin": { | |
| get: function() { | |
| var expectedPort = { | |
| "http:": 80, | |
| "https:": 443, | |
| "ftp:": 21 | |
| }[this._anchorElement.protocol]; | |
| var addPortToOrigin = this._anchorElement.port != expectedPort && this._anchorElement.port !== ""; | |
| return this._anchorElement.protocol + "//" + this._anchorElement.hostname + (addPortToOrigin ? ":" + this._anchorElement.port : "") | |
| }, | |
| enumerable: true | |
| }, | |
| "password": { | |
| get: function() { | |
| return "" | |
| }, | |
| set: function(value) {}, | |
| enumerable: true | |
| }, | |
| "username": { | |
| get: function() { | |
| return "" | |
| }, | |
| set: function(value) {}, | |
| enumerable: true | |
| }, | |
| "searchParams": { | |
| get: function() { | |
| var searchParams = new URLSearchParams(this.search); | |
| var _this = this; | |
| ["append", "delete", "set"].forEach(function(methodName) { | |
| var method = searchParams[methodName]; | |
| searchParams[methodName] = function() { | |
| method.apply(searchParams, arguments); | |
| _this.search = searchParams.toString() | |
| } | |
| }); | |
| return searchParams | |
| }, | |
| enumerable: true | |
| } | |
| }); | |
| URL.createObjectURL = function(blob) { | |
| return _URL.createObjectURL.apply(_URL, arguments) | |
| }; | |
| URL.revokeObjectURL = function(url) { | |
| return _URL.revokeObjectURL.apply(_URL, arguments) | |
| }; | |
| global.URL = URL | |
| }; | |
| if (!checkIfURLIsSupported()) polyfillURL(); | |
| if (global.location !== void 0 && !("origin" in global.location)) { | |
| var getOrigin = function() { | |
| return global.location.protocol + "//" + global.location.hostname + (global.location.port ? ":" + global.location.port : "") | |
| }; | |
| try { | |
| Object.defineProperty(global.location, "origin", { | |
| get: getOrigin, | |
| enumerable: true | |
| }) | |
| } catch (e) { | |
| setInterval(function() { | |
| global.location.origin = | |
| getOrigin() | |
| }, 100) | |
| } | |
| } | |
| })(typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : this); | |
| (function(window, document) { | |
| var html = document.documentElement; | |
| var define = function(object, property, getter) { | |
| if (typeof object[property] === "undefined") Object.defineProperty(object, property, { | |
| get: getter | |
| }) | |
| }; | |
| define(window, "innerWidth", function() { | |
| return html.clientWidth | |
| }); | |
| define(window, "innerHeight", function() { | |
| return html.clientHeight | |
| }); | |
| define(window, "scrollX", function() { | |
| return window.pageXOffset || | |
| html.scrollLeft | |
| }); | |
| define(window, "scrollY", function() { | |
| return window.pageYOffset || html.scrollTop | |
| }); | |
| define(document, "width", function() { | |
| var htmlMax, documentMax; | |
| if (document.body) documentMax = Math.max(document.body.scrollWidth, document.body.offsetWidth, document.body.clientWidth); | |
| if (html) htmlMax = Math.max(html.scrollWidth, html.offsetWidth, html.clientWidth); | |
| var width = Math.max(documentMax, htmlMax); | |
| return width != width ? undefined : width | |
| }); | |
| define(document, "height", function() { | |
| var htmlMax, documentMax; | |
| if (document.body) documentMax = | |
| Math.max(document.body.scrollHeight, document.body.offsetHeight, document.body.clientHeight); | |
| if (html) htmlMax = Math.max(html.scrollHeight, html.offsetHeight, html.clientHeight); | |
| var height = Math.max(documentMax, htmlMax); | |
| return height != height ? undefined : height | |
| }); | |
| return define | |
| })(window, document); | |
| if (typeof Range.prototype.createContextualFragment == "undefined") Range.prototype.createContextualFragment = function() { | |
| var doc = document.implementation.createHTMLDocument(""), | |
| range = doc.createRange(), | |
| body = doc.body; | |
| return function(html) { | |
| body.innerHTML = | |
| html; | |
| range.selectNodeContents(body); | |
| return range.extractContents() | |
| } | |
| }(); | |
| if (!Array.prototype.includes) Object.defineProperty(Array.prototype, "includes", { | |
| value: function(searchElement, fromIndex) { | |
| if (this == null) throw new TypeError('"this" is null or not defined'); | |
| var o = Object(this); | |
| var len = o.length >>> 0; | |
| if (len === 0) return false; | |
| var n = fromIndex | 0; | |
| var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); | |
| function sameValueZero(x, y) { | |
| return x === y || typeof x === "number" && typeof y === "number" && isNaN(x) && isNaN(y) | |
| } | |
| while (k < len) { | |
| if (sameValueZero(o[k], | |
| searchElement)) return true; | |
| k++ | |
| } | |
| return false | |
| } | |
| }); | |
| if (!Object.prototype.enswatch) Object.defineProperty(Object.prototype, "enswatch", { | |
| enumerable: false, | |
| configurable: true, | |
| writable: false, | |
| value: function(prop, handler) { | |
| var old = this[prop]; | |
| var cur = old; | |
| var getter = function() { | |
| return cur | |
| }; | |
| var setter = function(val) { | |
| old = cur; | |
| cur = handler.call(this, prop, old, val); | |
| if (this.setAttribute) this.setAttribute(prop, cur); | |
| return cur | |
| }; | |
| if (delete this[prop]) Object.defineProperty(this, prop, { | |
| get: getter, | |
| set: setter, | |
| enumerable: true, | |
| configurable: true | |
| }) | |
| } | |
| }); | |
| if (!Array.prototype.filter) Array.prototype.filter = function(func, thisArg) { | |
| if (!((typeof func === "Function" || typeof func === "function") && this)) throw new TypeError; | |
| var len = this.length >>> 0, | |
| res = new Array(len), | |
| t = this, | |
| c = 0, | |
| i = -1; | |
| if (thisArg === undefined) | |
| while (++i !== len) { | |
| if (i in this) | |
| if (func(t[i], i, t)) res[c++] = t[i] | |
| } else | |
| while (++i !== len) | |
| if (i in this) | |
| if (func.call(thisArg, t[i], i, t)) res[c++] = t[i]; | |
| res.length = c; | |
| return res | |
| }; | |
| var privacyStart; | |
| var gatewayConfig = function() { | |
| var events = ["load", "abort", "error"]; | |
| var elementMethods = ["appendChild", "insertBefore", "replaceChild", "removeChild"]; | |
| if (document.insertAdjacentElement || window.Element && Element.prototype.insertAdjacentElement || window.HTMLElement && HTMLElement.prototype.insertAdjacentElement) elementMethods.push("insertAdjacentElement"); | |
| var excList = new RegExp("nodeName|scopeName|tagName|" + "fileSize|outerHTML|start|contentEditable|href|nameProp|outerText|innerText|innerHTML"); | |
| var elementTypes = ["Anchor", "Area", "Body", "Button", "Canvas", "Div", "Form", "Frame", "Head", "Html", "IFrame", | |
| "Input", "Label", "LI", "Link", "Map", "OList", "Option", "Paragraph", "Span", "Table", "TableCell", "TableCol", "TableRow", "TableSection", "UList", "Unknown" | |
| ]; | |
| var eventHandlers = ["abort", "error", "KeyDown", "KeyPress", "KeyUp", "load"]; | |
| var forwardMethods = ["cloneNode", "attachEvent"]; | |
| var getters = ["ElementsByClassName", "ClientRects", "BoundingClientRect", "Attribute", "ElementsByTagName", "ElementsByTagNameNS", "AttributeNS", "UserData", "AttributeNode", "AttributeNodeNS", "Height", "Width", "Style", "Opacity", "Dimensions", "OffsetParent", | |
| "ElementsBySelector", "InlineOpacity", "Styles" | |
| ]; | |
| var unbound = {}; | |
| return { | |
| events: events, | |
| elementMethods: elementMethods, | |
| excList: excList, | |
| elementTypes: elementTypes, | |
| eventHandlers: eventHandlers, | |
| forwardMethods: forwardMethods, | |
| getters: getters, | |
| unbound: unbound | |
| } | |
| }(); | |
| var utilities = function() { | |
| return { | |
| addStyleElement: function(cssStyleDef) { | |
| var head = document.head || document.getElementsByTagName("head")[0]; | |
| var styleTag = document.createElement("style"); | |
| styleTag.type = "text/css"; | |
| if (styleTag.styleSheet) styleTag.styleSheet.cssText = | |
| cssStyleDef; | |
| else styleTag.appendChild(document.createTextNode(cssStyleDef)); | |
| head.appendChild(styleTag) | |
| }, | |
| arrayToRegex: function(arr) { | |
| if (Array.isArray(arr)) { | |
| if (arr && arr.length > 0 && arr.join) return new RegExp(arr.join("|")); | |
| return new RegExp("a^") | |
| } | |
| }, | |
| attachEvents: function(object, fn, timeStamp) { | |
| if (object.addEventListener) utilities.each(gatewayConfig.events, function(event) { | |
| object.addEventListener(event, fn(timeStamp, event), false) | |
| }); | |
| else if (object.attachEvent) utilities.each(gatewayConfig.events, function(event) { | |
| object.attachEvent("on" + | |
| event, fn(timeStamp, event)) | |
| }) | |
| }, | |
| bind: function(fn, context, args) { | |
| args = Array.prototype.slice.call(arguments); | |
| fn = args.shift(); | |
| context = args.shift(); | |
| return function() { | |
| return fn.apply(context, args.concat(Array.prototype.slice.call(arguments))) | |
| } | |
| }, | |
| browserSupportsMutationObserver: function() { | |
| var returnVal; | |
| var prefixes = ["WebKit", "Moz", "O", "Ms", ""]; | |
| for (var i = 0; i < prefixes.length; i++) | |
| if (prefixes[i] + "MutationObserver" in window) returnVal = true; | |
| return returnVal | |
| }, | |
| couldNotBind: function(key) { | |
| gatewayConfig.unbound[key] = true | |
| }, | |
| createEventHandler: function(timeStamp, status) { | |
| return function() { | |
| gateway.resourceComplete(this, timeStamp, status) | |
| } | |
| }, | |
| deleteCookie: function(clientName, cookieKey) { | |
| clientName = clientName.toUpperCase(); | |
| var cookieString = clientName + "_ENSIGHTEN_PRIVACY_" + utilities.parseCookieSuffix(cookieKey); | |
| var cookies = document.cookie.split(";"); | |
| for (var i = 0; i < cookies.length; i++) { | |
| var cookie = cookies[i]; | |
| var eqPos = cookie.indexOf("\x3d"); | |
| var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie; | |
| if (name.trim() === cookieString.trim()) document.cookie = | |
| name + "\x3d; path\x3d/; expires\x3dThu, 01 Jan 1970 00:00:00 GMT" | |
| } | |
| }, | |
| domReady: function(callback) { | |
| var ready = false; | |
| var detach = function() { | |
| if (document.addEventListener) { | |
| document.removeEventListener("DOMContentLoaded", completed); | |
| window.removeEventListener("load", completed) | |
| } else { | |
| document.detachEvent("onreadystatechange", completed); | |
| window.detachEvent("onload", completed) | |
| } | |
| }; | |
| var completed = function() { | |
| if (!ready && (document.addEventListener || event.type === "load" || document.readyState === "complete")) { | |
| ready = true; | |
| detach(); | |
| callback() | |
| } | |
| }; | |
| if (document.readyState === "complete") callback(); | |
| else if (document.addEventListener) { | |
| document.addEventListener("DOMContentLoaded", completed); | |
| window.addEventListener("load", completed) | |
| } else { | |
| document.attachEvent("onreadystatechange", completed); | |
| window.attachEvent("onload", completed); | |
| var top = false; | |
| try { | |
| top = window.frameElement === null && document.documentElement | |
| } catch (e) {} | |
| if (top && top.doScroll)(function scrollCheck() { | |
| if (ready) return; | |
| try { | |
| top.doScroll("left") | |
| } catch (e) { | |
| return setTimeout(scrollCheck, 50) | |
| } | |
| ready = | |
| true; | |
| detach(); | |
| callback() | |
| })() | |
| } | |
| }, | |
| each: function(list, fn, context) { | |
| if (list === undefined || !("length" in list)) list = { | |
| length: 0 | |
| }; | |
| for (var i = 0; i < list.length; i++) fn.call(context, list[i], i, list) | |
| }, | |
| getBrowserLocale: function() { | |
| var locale = window.navigator.userLanguage || window.navigator.language; | |
| if (locale) { | |
| locale = locale.split("-"); | |
| if (locale[0] && locale[1]) locale = locale[0] + "-" + locale[1].toUpperCase(); | |
| else locale = locale[0] | |
| } else locale = "en"; | |
| return locale | |
| }, | |
| getFunctionString: function(fn) { | |
| if (!fn || typeof fn !== "function" && typeof fn !== | |
| "object") return false; | |
| if (fn.toString !== undefined) return fn.toString(); | |
| return fn + "" | |
| }, | |
| getUrlParamVal: function(key) { | |
| var hash, queryStringObject = {}; | |
| var hashes = window.location.href.slice(window.location.href.indexOf("?") + 1).split("\x26"); | |
| for (var i = 0; i < hashes.length; i++) { | |
| hash = hashes[i].split("\x3d"); | |
| queryStringObject[hash[0]] = hash[1] | |
| } | |
| var returnVal = ""; | |
| if (queryStringObject[key]) returnVal = queryStringObject[key]; | |
| return returnVal | |
| }, | |
| handleReference: function(arg) { | |
| var reference = arg ? arg.__reference : false; | |
| var tagName; | |
| if (reference) tagName = reference.tagName.toUpperCase(); | |
| if (reference && (tagName === "SCRIPT" || tagName === "IFRAME" || tagName === "IMAGE" || tagName === "IMG")) { | |
| for (var property in reference) | |
| if (Object.prototype.hasOwnProperty.call(reference, property) && typeof arg[property] === "string") | |
| if (!gatewayConfig.excList.test(property) && (arg[property] || reference[property] && !arg[property])) | |
| if (reference[property] !== arg[property] && arg[property] !== reference.__histLog[property]) try { | |
| reference[property] = arg[property] | |
| } catch (e) { | |
| try { | |
| if (reference.tagName && | |
| reference.tagName.toUpperCase() === "SCRIPT" && property === "text") reference.text = arg["text"]; | |
| else if (reference.tagName && reference.tagName.toUpperCase() === "SCRIPT" && property === "innerHTML") reference.innerHTML = arg["innerHTML"]; | |
| else reference.setAttribute(property, arg[property]) | |
| } catch (ex) {} | |
| } | |
| tagName = null; | |
| return reference | |
| } | |
| return arg | |
| }, | |
| decodeUriComponent: function(str) { | |
| var decodedUri = str; | |
| try { | |
| if (typeof str === "string") decodedUri = decodeURIComponent(str) | |
| } catch (e) { | |
| console.warn("URI: " + str + ". Could not decoded properly. Original string was returned") | |
| } | |
| return decodedUri | |
| }, | |
| isIE8OrLower: function() { | |
| return document.all && !document.getSelection | |
| }, | |
| isIE: false || !!document.documentMode, | |
| isNative: function(fn) { | |
| var re = new RegExp("function\\s+.+?\\(\\s*\\)" + "\\s*{\\s*\\[native code\\]\\s*}"), | |
| re2 = new RegExp("function\\s+.+?\\" + "(\\s*\\)\\s*{\\s*\\/\\*\\s*" + "source code not available\\s*\\*\\/\\s*}"), | |
| fnStr = utilities.getFunctionString(fn); | |
| var retValue = re.test(fnStr) || re2.test(fnStr); | |
| re = re2 = fnStr = null; | |
| return retValue | |
| }, | |
| map: function(list, fn, context) { | |
| if (list === undefined || !("length" in list)) list = { | |
| length: 0 | |
| }; | |
| for (var i = 0; i < list.length; i++) list[i] = fn.call(context, list[i], i, list) | |
| }, | |
| noop: function() {}, | |
| overrideHelper: function(object, fnName) { | |
| var objectNameString = object + ""; | |
| if (!object || !object[fnName] || object + "" === "[Interface prototype object]") return false; | |
| var method = object[fnName]; | |
| var proxiedMethod = function() { | |
| var args = Array.prototype.slice.call(arguments); | |
| var node = args[0]; | |
| if (typeof node === "string") node = args[1]; | |
| var tagName = this.tagName; | |
| if (tagName === undefined || tagName === null) tagName = ""; | |
| else tagName = | |
| tagName.toUpperCase(); | |
| var argTagName = node.tagName; | |
| if (argTagName === undefined || argTagName === null) argTagName = ""; | |
| else argTagName = argTagName.toUpperCase(); | |
| if (tagName !== "SCRIPT" && tagName !== "IMG" && tagName !== "IMAGE" && tagName !== "IFRAME" && argTagName !== "SCRIPT" && argTagName !== "IMG" && argTagName !== "IMAGE" && argTagName !== "IFRAME") return Function.prototype.apply.call(method, this, args); | |
| else { | |
| node = utilities.processElement(fnName, node); | |
| if (node) return Function.prototype.apply.call(method, this, args) | |
| } | |
| }; | |
| var nodeName = ""; | |
| if (objectNameString !== | |
| "[xpconnect wrapped native prototype]" && objectNameString !== "[object XPC_WN_ModsAllowed_NoCall_Proto_JSClass]") | |
| if (window.DocumentFragment && window.DocumentFragment.prototype && object === window.DocumentFragment.prototype) nodeName = ""; | |
| else if (window.Element && window.Element.prototype && object === window.Element.prototype) nodeName = ""; | |
| else nodeName = object.nodeName || ""; | |
| nodeName = nodeName.toUpperCase(); | |
| if (nodeName.toUpperCase() === "EMBED") try { | |
| object[fnName] = proxiedMethod | |
| } catch (e) {} else object[fnName] = proxiedMethod | |
| }, | |
| processElement: function(source, elementNode) { | |
| var processed = elementNode.tagName; | |
| if (typeof processed === "undefined" || processed === null || elementNode === null || elementNode.__gateway) return elementNode; | |
| var timeStamp = +new Date, | |
| request = new Request; | |
| request.id = timeStamp; | |
| request.source = source; | |
| elementNode.__gateway = timeStamp; | |
| var tagName = request.type = elementNode.tagName.toLowerCase(); | |
| if (tagName === "iframe" || tagName === "script" || tagName === "img") { | |
| request.destination = typeof elementNode.src === "string" && elementNode.src ? | |
| elementNode.src : ""; | |
| if (!gateway.onBefore(request, elementNode)) { | |
| elementNode.src = utilities.getBlockedSrcString(tagName, request); | |
| gateway.onBlock(request, elementNode) | |
| } else utilities.attachEvents(elementNode, utilities.createEventHandler, timeStamp) | |
| } | |
| utilities.each(elementNode.children, utilities.bind(utilities.processElement, this, source)); | |
| processed = timeStamp = request = tagName = null; | |
| return elementNode | |
| }, | |
| getBlockedSrcString: function(tagName, request) { | |
| if (gateway.dataGovernanceManager.shouldMaskData(request)) return gateway.dataGovernanceManager.getMaskedDataString(request.destination); | |
| else if (gateway.dataGovernanceManager.shouldRedactData(request)) return gateway.dataGovernanceManager.getRedactedDataString(request.destination); | |
| else if (tagName === "img") return ""; | |
| else return "//javascript:;" | |
| }, | |
| processHTML: function(source, html) { | |
| var containsSrc = /src\s*=/i.test(html); | |
| if (!containsSrc) { | |
| containsSrc = null; | |
| return html | |
| } | |
| var srcs = html.match(/src\s*=\s*(.+?)(\s|$|>)/ig); | |
| if (srcs) { | |
| utilities.map(srcs, function(src) { | |
| var replacedString = src.replace(/\s*src\s*=\s*('|")?(.*?)('|")?(\s|$|>)/i, "$2"); | |
| return replacedString | |
| }); | |
| utilities.each(srcs, function(src) { | |
| var timeStamp = +new Date, | |
| request = new Request; | |
| request.id = timeStamp; | |
| request.source = source; | |
| request.destination = src.indexOf("javascript:") ? src : (new URL(src, window.location)).href; | |
| var node = {}; | |
| if (!gateway.onBefore(request, node)) { | |
| if (gateway.dataGovernanceManager.shouldMaskData(request)) html = html.replace(src, gateway.dataGovernanceManager.getMaskedDataString(request.destination)); | |
| else html = html.replace(src, "//javascript:;"); | |
| gateway.onBlock(request, node) | |
| } | |
| }) | |
| } | |
| containsSrc = srcs = | |
| null; | |
| return html | |
| }, | |
| getCookieTLD: function() { | |
| return ["ac", "com", "co", "org", "edu", "info", "gov", "net", "mod", "nhs", "plc", "sch", "ltd"] | |
| }, | |
| getCookieSLD: function() { | |
| return ["af", "ax", "al", "dz", "as", "ad", "ao", "ai", "aq", "ag", "ar", "am", "aw", "au", "at", "az", "bh", "bs", "bd", "bb", "by", "be", "bz", "bj", "bm", "bt", "bo", "bq", "ba", "bw", "bv", "br", "io", "bn", "bg", "bf", "bi", "kh", "cm", "ca", "cv", "ky", "cf", "td", "cl", "cn", "cx", "cc", "co", "km", "cg", "cd", "ck", "cr", "ci", "hr", "cu", "cw", "cy", "cz", "dk", "dj", "dm", "do", "ec", "eg", "sv", "gq", "er", | |
| "ee", "et", "fk", "fo", "fj", "fi", "fr", "gf", "pf", "tf", "ga", "gm", "ge", "de", "gh", "gi", "gr", "gl", "gd", "gp", "gu", "gt", "gg", "gn", "gw", "gy", "ht", "hm", "va", "hn", "hk", "hu", "is", "in", "id", "ir", "iq", "ie", "im", "il", "it", "jm", "jp", "je", "jo", "kz", "ke", "ki", "kp", "kr", "kw", "kg", "la", "lv", "lb", "ls", "lr", "ly", "li", "lt", "lu", "mo", "mk", "mg", "mw", "my", "mv", "ml", "mt", "mh", "mq", "mr", "mu", "yt", "mx", "fm", "md", "mc", "mn", "me", "ms", "ma", "mz", "mm", "na", "nr", "np", "nl", "nc", "nz", "ni", "ne", "ng", "nu", "nf", "mp", "no", "om", "pk", "pw", "ps", | |
| "pa", "pg", "py", "pe", "ph", "pn", "pl", "pt", "pr", "qa", "ro", "ru", "rw", "bl", "sh", "kn", "lc", "mf", "pm", "vc", "ws", "sm", "st", "sa", "sn", "rs", "sc", "sl", "sg", "sx", "sk", "si", "sb", "so", "za", "gs", "ss", "es", "lk", "sd", "sr", "sj", "sz", "se", "ch", "sy", "tw", "tj", "tz", "th", "tl", "tg", "tk", "to", "tt", "tn", "tr", "tm", "tc", "tv", "ug", "ua", "uk", "ae", "gb", "us", "um", "uy", "uz", "vu", "ve", "vn", "vg", "vi", "wf", "eh", "ye", "zm", "zw" | |
| ] | |
| }, | |
| createRegex: function() { | |
| var tld = this.getCookieTLD(), | |
| tldLength = tld.length, | |
| sld = this.getCookieSLD(), | |
| sldLength = | |
| sld.length, | |
| combinedDomains = []; | |
| for (var i = 0; i < tldLength; i++) | |
| for (var j = 0; j < sldLength; j++) combinedDomains.push("." + tld[i] + "\\." + sld[j]); | |
| return combinedDomains.join("|") | |
| }, | |
| cookieNameToCookieType: function(clientName, cookieName) { | |
| return cookieName.replace(clientName.toUpperCase() + "_ENSIGHTEN_PRIVACY_", "") | |
| }, | |
| ieVersion: function() { | |
| var ua = window.navigator.userAgent; | |
| var msie = ua.indexOf("MSIE "); | |
| if (msie > 0) return parseInt(ua.substring(msie + 5, ua.indexOf(".", msie)), 10); | |
| var trident = ua.indexOf("Trident/"); | |
| if (trident > | |
| 0) { | |
| var rv = ua.indexOf("rv:"); | |
| return parseInt(ua.substring(rv + 3, ua.indexOf(".", rv)), 10) | |
| } | |
| var edge = ua.indexOf("Edge/"); | |
| if (edge > 0) return parseInt(ua.substring(edge + 5, ua.indexOf(".", edge)), 10); | |
| return null | |
| } | |
| } | |
| }(); | |
| var writeLnObserver = function() { | |
| var writeln = document.writeln; | |
| document.writeln = function(html) { | |
| html = utilities.processHTML("writeln", html); | |
| return Function.prototype.call.call(writeln, document, html) | |
| }; | |
| return !utilities.isNative(document.writeln) | |
| }; | |
| var writeObserver = function() { | |
| var write = document.write; | |
| document.write = | |
| function(html, cb) { | |
| html = utilities.processHTML("write", html); | |
| if (cb) return cb(html); | |
| return Function.prototype.call.call(write, document, html) | |
| }; | |
| return !utilities.isNative(document.write) | |
| }; | |
| var elementObserver = function() { | |
| function observeElementHelper() { | |
| utilities.each(gatewayConfig.elementTypes, function(type) { | |
| if (window["HTML" + type + "Element"] && window["HTML" + type + "Element"].prototype) utilities.each(gatewayConfig.elementMethods, function(method) { | |
| utilities.overrideHelper(window["HTML" + type + "Element"].prototype, | |
| method) | |
| }); | |
| else utilities.couldNotBind("HTML" + type + "Element") | |
| }) | |
| } | |
| if (window.DocumentFragment && window.DocumentFragment.prototype && window.DocumentFragment.prototype.appendChild) utilities.each(gatewayConfig.elementMethods, utilities.bind(utilities.overrideHelper, null, window.DocumentFragment.prototype)); | |
| else utilities.couldNotBind("DocumentFramgment"); | |
| if (window.Element && window.Element.prototype && window.Element.prototype.appendChild) utilities.each(gatewayConfig.elementMethods, utilities.bind(utilities.overrideHelper, | |
| null, window.Element.prototype)); | |
| else utilities.couldNotBind("Element"); | |
| if (utilities.isNative(document.createElement("div").appendChild)) { | |
| var div = document.createElement("div"); | |
| var proto = div; | |
| var escape = 0; | |
| while (!Object.prototype.hasOwnProperty.call(proto, "appendChild")) { | |
| proto = Object.getPrototypeOf(proto); | |
| if (escape++ > 5) { | |
| utilities.couldNotBind("div.appendChild"); | |
| break | |
| } | |
| } | |
| utilities.each(gatewayConfig.elementMethods, utilities.bind(utilities.overrideHelper, null, proto)); | |
| div = proto = escape = null | |
| } | |
| if (utilities.isNative(document.createElement("div").appendChild)) observeElementHelper(); | |
| return | |
| }; | |
| var MutationObserverFactory = function() { | |
| ensClientConfig.ensCreateElement = document.createElement; | |
| var ensMutationObserver = new MutationObserver(function(mutations) { | |
| for (var index = 0; index < mutations.length; index++) { | |
| var mutation = mutations[index]; | |
| if (mutation.type == "attributes") utilities.processElement("mutationObserverA", mutation.target); | |
| if (mutation.type == "childList") { | |
| var mutationLength = mutation.addedNodes.length; | |
| for (var i = 0; i < mutationLength; i++) { | |
| var item; | |
| if (Object.prototype.toString.call(mutation.addedNodes) === | |
| "[object Array]") item = mutation.addedNodes[i]; | |
| else item = mutation.addedNodes.item(i); | |
| utilities.processElement("mutationObserverCL", item) | |
| } | |
| } | |
| } | |
| }); | |
| var watchTheDOM = function() { | |
| var docBody = document; | |
| var innerHTMLObservCfg = { | |
| attributes: true, | |
| childList: true, | |
| subtree: true, | |
| characterData: false, | |
| attributeFilter: ["src"] | |
| }; | |
| ensMutationObserver.observe(docBody, innerHTMLObservCfg); | |
| var oldSetAttribute = HTMLIFrameElement.prototype.setAttribute; | |
| HTMLIFrameElement.prototype.setAttribute = function(name, value) { | |
| var parsedSrc; | |
| if (name == | |
| "src" || name == "ng-src") { | |
| var timeStamp = +new Date; | |
| var request = new Request; | |
| request.id = timeStamp; | |
| request.source = "HTMLIFRAME_SETATTRIBUTE"; | |
| request.destination = value.indexOf("javascript:") ? value : (new URL(value, window.location)).href; | |
| var elementNode = this; | |
| request.type = elementNode.tagName.toLowerCase(); | |
| var parsedSrc = value; | |
| if (!gateway.onBefore(request, elementNode)) { | |
| parsedSrc = utilities.getBlockedSrcString("iframe", request); | |
| this[name] = parsedSrc; | |
| if (this.parentNode && parsedSrc === "//javascript:;") this.parentNode.removeChild(this); | |
| gateway.onBlock(request, elementNode); | |
| return oldSetAttribute.call(this, name, parsedSrc) | |
| } else utilities.attachEvents(elementNode, utilities.createEventHandler, timeStamp) | |
| } | |
| return oldSetAttribute.call(this, name, parsedSrc || value) | |
| }; | |
| if (utilities.isIE) { | |
| var originalSet = Object.getOwnPropertyDescriptor(HTMLElement.prototype, "innerHTML").set; | |
| Object.defineProperty(HTMLElement.prototype, "innerHTML", { | |
| set: function(val) { | |
| var new_value = utilities.processHTML("innerHTML", val); | |
| return originalSet.call(this, new_value) | |
| } | |
| }) | |
| } | |
| }; | |
| document.createElement = function(tagName) { | |
| var element = Function.prototype.apply.call(ensClientConfig.ensCreateElement, document, arguments); | |
| if (tagName.match(/img|image|iframe|script/i)) { | |
| var config = { | |
| attributes: true, | |
| childList: false, | |
| characterData: false, | |
| attributeFilter: ["src"] | |
| }; | |
| ensMutationObserver.observe(element, config) | |
| } | |
| return element | |
| }; | |
| window.Image = function(w, h) { | |
| var img = document.createElement("img"); | |
| if (utilities.IE) img.enswatch("src", function(prop, old, curr) { | |
| if (prop == "src") { | |
| var timeStamp = +new Date; | |
| var request = | |
| new Request; | |
| request.id = timeStamp; | |
| request.source = "IMAGE_DOMAttrModified"; | |
| var src = curr; | |
| request.destination = src.indexOf("javascript:") ? src : (new URL(src, window.location)).href; | |
| var elementNode = this; | |
| request.type = elementNode.tagName.toLowerCase(); | |
| if (!gateway.onBefore(request, elementNode)) { | |
| src = utilities.getBlockedSrcString("img", request); | |
| gateway.onBlock(request, elementNode) | |
| } else utilities.attachEvents(elementNode, utilities.createEventHandler, timeStamp); | |
| return src | |
| } | |
| }); | |
| if (typeof w != "undefined") img.setAttribute("width", | |
| w); | |
| if (typeof h != "undefined") img.setAttribute("height", h); | |
| return img | |
| }; | |
| var init = function() { | |
| watchTheDOM() | |
| }() | |
| }; | |
| var Reporter = function() { | |
| var that; | |
| function getReportHeader() { | |
| return { | |
| version: "1.0.0", | |
| gateway: that.gatewayVersion, | |
| clientId: that.clientId, | |
| publishPath: that.publishPath, | |
| instanceId: that.instanceId, | |
| packet: that.beaconCounter, | |
| mode: that.gatewayMode, | |
| cookies: that.privacyCookies | |
| } | |
| } | |
| function generateRawReportString(resources) { | |
| var report = getReportHeader(); | |
| report.requests = resources; | |
| return JSON.stringify(report) | |
| } | |
| function generateReportString(resources) { | |
| var reportString = generateRawReportString(resources); | |
| var stat = {}; | |
| stat.rawLength = reportString.length; | |
| reportString = LZString.compressToEncodedURIComponent(reportString); | |
| stat.compressedLength = reportString.length; | |
| that.stats.push(stat); | |
| return reportString | |
| } | |
| function doReport() { | |
| var overCapacityResources = [], | |
| beacons = []; | |
| if (this.enabled === false || this.unreportedResources.length === 0) return false; | |
| while (this.unreportedResources.length > 0) { | |
| var reportString = generateReportString(this.unreportedResources); | |
| if (reportString.length + 50 < this.options.maxUrlSize) { | |
| beacons.push(beacon.call(this, reportString)); | |
| this.reportedResources = this.reportedResources.concat(this.unreportedResources); | |
| this.unreportedResources = overCapacityResources; | |
| overCapacityResources = []; | |
| if (this.stats.length > 0) this.stats[this.stats.length - 1].written = true | |
| } else overCapacityResources.push(this.unreportedResources.pop()) | |
| } | |
| return beacons | |
| } | |
| function beacon(data) { | |
| var Img = this.imageReference; | |
| var beaconRootUrl = "//" + this.nexusDomain + "/privacy/v1/b/1.gif"; | |
| var beacon = new Img; | |
| var encodedBeaconURL = beaconRootUrl + "?" + "n\x3d" + this.beaconCounter++ + "\x26c\x3d" + this.clientId + "\x26i\x3d" + this.instanceId; | |
| if (this.publishPath) encodedBeaconURL += "\x26p\x3d" + encodeURIComponent(this.publishPath); | |
| encodedBeaconURL += "\x26d\x3d" + data; | |
| beacon.src = encodedBeaconURL; | |
| return encodedBeaconURL | |
| } | |
| function startTimer() { | |
| var self = this; | |
| if (!this.enabled) return false; | |
| doReport.call(this); | |
| return setTimeout(function() { | |
| startTimer.call(self) | |
| }, this.options.reportInterval) | |
| } | |
| function Reporter(imageReference, | |
| clientId, publishPath, usesWhitelist, gatewayVersion, reportingEnabled, options, nexusDomain, filterRegex) { | |
| this.instanceId = ((1 + Math.random()) * 268435456 | 0).toString(36); | |
| this.imageReference = imageReference; | |
| this.nexusDomain = nexusDomain; | |
| this.unreportedResources = []; | |
| this.reportedResources = []; | |
| this.beaconCounter = 0; | |
| this.enabled = reportingEnabled === false ? false : true; | |
| this.clientId = clientId; | |
| this.publishPath = publishPath; | |
| this.gatewayMode = usesWhitelist ? "whitelist" : "blacklist"; | |
| this.privacyCookies = []; | |
| this.gatewayVersion = gatewayVersion; | |
| this.stats = []; | |
| this.filterRegex = filterRegex || /a^/; | |
| if (options) this.setOptions(options); | |
| startTimer.call(this); | |
| that = this | |
| } | |
| Reporter.prototype = { | |
| options: { | |
| maxUrlSize: 32E3, | |
| reportInterval: 2500 | |
| }, | |
| addResource: function(resource) { | |
| if (this.enabled && !this.filter(resource.destination)) this.unreportedResources.push(resource) | |
| }, | |
| filter: function(url) { | |
| return this.filterRegex.test(url) | |
| }, | |
| setCookies: function(cookies) { | |
| this.privacyCookies = cookies | |
| }, | |
| setOptions: function(options) { | |
| for (var p in options) | |
| if (options.hasOwnProperty(p)) this.options[p] = | |
| options[p] | |
| }, | |
| _generateRawReportString: generateRawReportString, | |
| _generateReportString: generateReportString, | |
| _doReport: doReport, | |
| _beacon: beacon, | |
| _startTimer: startTimer | |
| }; | |
| return Reporter | |
| }(); | |
| function CookieManager(clientName, customGetter, customSetter) { | |
| this.deleteAllCookies = function() { | |
| var cookies = document.cookie.split(";"); | |
| for (var i = 0; i < cookies.length; i++) { | |
| var cookie = cookies[i]; | |
| var eqPos = cookie.indexOf("\x3d"); | |
| var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie; | |
| document.cookie = name + "\x3d; path\x3d/; expires\x3dThu, 01 Jan 1970 00:00:00 GMT; domain\x3d" + | |
| this.getCookieDomain() | |
| } | |
| }; | |
| this.deleteCookie = function(cookieType) { | |
| clientName = clientName.toUpperCase(); | |
| var cookieString = clientName + "_ENSIGHTEN_PRIVACY_" + this._parseCookieSuffix(cookieType); | |
| var cookies = document.cookie.split(";"); | |
| for (var i = 0; i < cookies.length; i++) { | |
| var cookie = cookies[i]; | |
| var eqPos = cookie.indexOf("\x3d"); | |
| var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie; | |
| if (name.trim() === cookieString.trim()) document.cookie = name + "\x3d; path\x3d/; expires\x3dThu, 01 Jan 1970 00:00:00 GMT; domain\x3d" + this.getCookieDomain() | |
| } | |
| }; | |
| this.getCookie = function(key) { | |
| if (customGetter !== undefined) return customGetter(key); | |
| return this.defaultGetCookie(key) | |
| }; | |
| this.defaultGetCookie = function(key) { | |
| var cookieName = this._parseCookieSuffix(key); | |
| var match = document.cookie.match(new RegExp(cookieName + "\x3d([^;]+)")); | |
| if (match) return match[1]; | |
| else { | |
| var legacyMatch = document.cookie.match(new RegExp(cookieName + "\x3d([^;]+)")); | |
| if (legacyMatch) return legacyMatch[1] | |
| } | |
| }; | |
| this.getCookiesFromTypes = function(cookieTypes) { | |
| var cookies = {}; | |
| for (var i = 0; i < cookieTypes.length; i++) { | |
| var cookieName = | |
| cookieTypes[i], | |
| cookieValue = this.getCookie(cookieName); | |
| if (cookieValue !== "undefinded" && cookieValue !== null) cookies[clientName.toUpperCase() + "_ENSIGHTEN_PRIVACY_" + this._parseCookieSuffix(cookieName)] = cookieValue | |
| } | |
| return cookies | |
| }; | |
| this.setCookie = function(cookieType, value) { | |
| if (customSetter !== undefined) return customSetter(cookieType, value); | |
| return this.defaultSetCookie(cookieType, value) | |
| }; | |
| this.setCookies = function(cookies) { | |
| for (var key in cookies) this.defaultSetCookie(key, cookies[key]) | |
| }; | |
| this.defaultSetCookie = function(cookieType, | |
| value) { | |
| var prefix = clientName.toUpperCase() + "_ENSIGHTEN_PRIVACY_"; | |
| var suffix = this._parseCookieSuffix(cookieType); | |
| document.cookie = prefix + suffix + "\x3d" + value + "; path\x3d/; domain\x3d" + this.cookieDomain + "; expires\x3d" + (new Date(+new Date + 1E3 * 60 * 60 * 24 * 365)).toUTCString() | |
| }; | |
| this.setCookieDomain = function(newCookieDomain) { | |
| this.cookieDomain = newCookieDomain | |
| }; | |
| this.getCookieDomain = function() { | |
| return this.cookieDomain | |
| }; | |
| this._parseCookieSuffix = function(cookieType) { | |
| return cookieType.replace(/ /g, "_") | |
| }; | |
| this.calculateCookieDomain = | |
| function(domain) { | |
| var regExStr = utilities.createRegex(); | |
| var host = domain || document.location.hostname; | |
| var re = new RegExp(regExStr); | |
| var isIP = /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/gm; | |
| var domainIsIpAddress = isIP.test(host); | |
| if (host !== "localhost" && !domainIsIpAddress) { | |
| var hostHasTwoPartSuffix = re.test(host); | |
| host = host.split("."); | |
| var finalHostString; | |
| if (hostHasTwoPartSuffix) finalHostString = host.slice(host.length - 3, host.length); | |
| else finalHostString = | |
| host.slice(host.length - 2, host.length); | |
| finalHostString = finalHostString.join("."); | |
| return finalHostString | |
| } else return host | |
| }; | |
| this.cookieDomain = this.calculateCookieDomain(window.location.hostname) | |
| } | |
| function XhrManager() { | |
| var open = window.XMLHttpRequest.prototype.open, | |
| send = window.XMLHttpRequest.prototype.send, | |
| voidURL = "//javascript:;"; | |
| function openReplacement(method, url, async, user, password) { | |
| var parsedUrl = processURL(url, this); | |
| if (parsedUrl && parsedUrl !== voidURL) return open.apply(this, arguments); | |
| this.setRequestHeader = | |
| function() {}; | |
| this.send = function() {} | |
| } | |
| function sendReplacement(value) { | |
| this.url = processURL(this.url, this); | |
| return send.apply(this, arguments) | |
| } | |
| function processURL(url, xhr) { | |
| if (url === undefined) return undefined; | |
| var timeStamp = +new Date; | |
| var request = new Request; | |
| request.id = timeStamp; | |
| request.source = "XHR_MANAGER"; | |
| var src = url; | |
| request.destination = src === voidURL ? voidURL : (new URL(src, window.location)).href; | |
| var elementNode = xhr; | |
| request.type = "xhr"; | |
| this.historyId = timeStamp; | |
| if (!gateway.onBefore(request, elementNode)) { | |
| src = | |
| utilities.getBlockedSrcString("xhr", request); | |
| gateway.onBlock(request, elementNode) | |
| } else gateway.resourceComplete(this, timeStamp, "load"); | |
| return src | |
| } | |
| window.XMLHttpRequest.prototype.send = sendReplacement; | |
| window.XMLHttpRequest.prototype.open = openReplacement | |
| } | |
| var EnvironmentManager = function(document, environmentConfigs, defaultEnvName, clientName, cookieManager) { | |
| var activeEnvironment = null, | |
| environmentChangeCallbacks = [], | |
| environmentsCount = environmentConfigs.length, | |
| clearEnvironment = function(clientName) { | |
| cookieManager.deleteCookie("LOCALE"); | |
| setEnvironment() | |
| }, | |
| environmentExists = function(locale) { | |
| return getEnvironmentByLocale(locale) !== null | |
| }, | |
| evalCondition = function(condition) { | |
| var conditionValue; | |
| var conditionIsSatisfied = false; | |
| switch (condition.type) { | |
| case "host": | |
| conditionValue = document.location.hostname; | |
| break; | |
| case "url": | |
| conditionValue = document.URL; | |
| break; | |
| case "cookie": | |
| conditionValue = getCookie(condition.key); | |
| break; | |
| case "jsVar": | |
| conditionValue = getJSVarValue(condition.key); | |
| break; | |
| default: | |
| console.warn("Error evaluating environment target") | |
| } | |
| switch (condition.operator) { | |
| case "equals": | |
| conditionIsSatisfied = | |
| evaluateEquals(conditionValue, condition); | |
| break; | |
| case "contains": | |
| conditionIsSatisfied = evaluateContains(conditionValue, condition); | |
| break; | |
| case "exists": | |
| conditionIsSatisfied = evaluateExists(conditionValue, condition); | |
| break; | |
| case "regexp": | |
| conditionIsSatisfied = evaluateRegExp(conditionValue, condition); | |
| break; | |
| default: | |
| console.warn("Error evaluating comparator for environment") | |
| } | |
| if (condition.shouldBePositive === false) | |
| if (conditionIsSatisfied === true) conditionIsSatisfied = false; | |
| else conditionIsSatisfied = true; | |
| if (conditionIsSatisfied === | |
| true && condition._and) conditionIsSatisfied = evalCondition(condition._and); | |
| if (conditionIsSatisfied === false && condition._or) conditionIsSatisfied = evalCondition(condition._or); | |
| return conditionIsSatisfied | |
| }, | |
| evaluateContains = function(value, condition) { | |
| if (value) return value.indexOf(condition.value) !== -1; | |
| else return false | |
| }, | |
| evaluateEquals = function(value, condition) { | |
| return value == condition.value | |
| }, | |
| evaluateExists = function(value) { | |
| var objectExists = false; | |
| if (value) objectExists = true; | |
| return objectExists | |
| }, | |
| evaluateRegExp = | |
| function(value, condition) { | |
| return value === undefined || value === "" ? false : (new RegExp(condition.value)).test(value) | |
| }, | |
| fireEnvironmentChangeCallbacks = function() { | |
| var callbacksCount = environmentChangeCallbacks.length; | |
| for (var i = 0; i < callbacksCount; i++) | |
| if (typeof environmentChangeCallbacks[i] === "function") environmentChangeCallbacks[i](activeEnvironment) | |
| }, | |
| getActiveEnvironment = function() { | |
| return activeEnvironment | |
| }, | |
| getActiveLocale = function() { | |
| return activeEnvironment.languageCode | |
| }, | |
| getAvailableLocales = function() { | |
| var availableLocales = []; | |
| for (var i = 0; i < environmentsCount; i++) availableLocales.push(environmentConfigs[i].languageCode); | |
| return availableLocales | |
| }, | |
| getCookie = function(key) { | |
| var match = document.cookie.match(new RegExp(key + "\x3d([^;]+)")); | |
| if (match) return match[1] | |
| }, | |
| getDefaultEnvironment = function() { | |
| var environment = null; | |
| for (var i = 0; i < environmentConfigs.length; i++) | |
| if (defaultEnvName && environmentConfigs[i].name == defaultEnvName) { | |
| environment = environmentConfigs[i]; | |
| break | |
| } | |
| return environment | |
| }, | |
| getEnvironmentByConditions = function() { | |
| var locale = | |
| utilities.getBrowserLocale(); | |
| for (var i = 0; i < environmentsCount; i++) | |
| if (hasConditions(environmentConfigs[i])) { | |
| if (evalCondition(environmentConfigs[i].condition)) return environmentConfigs[i] | |
| } else if (localeMatches(environmentConfigs[i], locale)) return environmentConfigs[i]; | |
| return null | |
| }, | |
| hasConditions = function(environment) { | |
| return environment.condition && environment.condition.type && environment.condition.operator | |
| }, | |
| getEnvironmentByLocale = function(locale) { | |
| var environment = null; | |
| for (var i = 0; i < environmentsCount; i++) | |
| if (localeMatches(environmentConfigs[i], | |
| locale)) environment = environmentConfigs[i]; | |
| return environment | |
| }, | |
| localeMatches = function(environment, locale) { | |
| if (environment) | |
| if (environment.languageCode === locale) return true; | |
| else { | |
| var trimmedLocale = locale.split("-"); | |
| var language = trimmedLocale[0]; | |
| if (environment.languageCode === language) return true | |
| } | |
| return false | |
| }, | |
| getEnvironmentByLocaleCookie = function() { | |
| var environment = null; | |
| var cookieVal = this.cookieManager.getCookie("LOCALE"); | |
| if (cookieVal) environment = getEnvironmentByLocale(cookieVal); | |
| return environment | |
| }, | |
| initializeActiveEnvironment = | |
| function() { | |
| var environment = null; | |
| environment = getEnvironmentByLocaleCookie(); | |
| if (!environment) environment = getEnvironmentByConditions(); | |
| if (!environment) environment = getDefaultEnvironment(); | |
| if (environment && environment.translation) { | |
| environment.translation.save = environment.translation.save || "SAVE"; | |
| environment.translation.cancel = environment.translation.cancel || "CANCEL"; | |
| environment.translation.close = environment.translation.close || "CLOSE" | |
| } | |
| activeEnvironment = environment | |
| }, | |
| registerEnvironmentChangeCallback = function(callback) { | |
| environmentChangeCallbacks.push(callback) | |
| }, | |
| setEnvironment = function(locale) { | |
| if (environmentExists(locale)) { | |
| var oldCookies = cookieManager.getCookiesFromTypes(["LOCALE"]); | |
| cookieManager.setCookie("LOCALE", locale); | |
| var newCookies = cookieManager.getCookiesFromTypes(["LOCALE"]); | |
| consentReporter.sendReport(oldCookies, newCookies); | |
| activeEnvironment = getEnvironmentByLocale(locale); | |
| fireEnvironmentChangeCallbacks(activeEnvironment) | |
| } else if (!locale) { | |
| initializeActiveEnvironment(); | |
| activeEnvironment = getActiveEnvironment(); | |
| fireEnvironmentChangeCallbacks(activeEnvironment) | |
| } | |
| }, | |
| getJSVarValue = function(key) { | |
| var value = typeof window[key] !== "undefined" ? window[key] : undefined; | |
| if (key && typeof key === "string" && !value) { | |
| var currentValue, i = 0, | |
| objKeys = key.split("."), | |
| len = objKeys.length; | |
| for (; i < len; i++) { | |
| currentValue = currentValue ? currentValue[objKeys[i]] : window[objKeys[i]]; | |
| value = typeof currentValue !== "undefined" ? currentValue : undefined | |
| } | |
| } | |
| return value | |
| }, | |
| init = function() { | |
| initializeActiveEnvironment() | |
| }(); | |
| return { | |
| environmentExists: environmentExists, | |
| clearEnvironment: clearEnvironment, | |
| getActiveEnvironment: getActiveEnvironment, | |
| getActiveLocale: getActiveLocale, | |
| getAvailableLocales: getAvailableLocales, | |
| registerEnvironmentChangeCallback: registerEnvironmentChangeCallback, | |
| evalCondition: evalCondition, | |
| setEnvironment: setEnvironment | |
| } | |
| }; | |
| var DataGovernanceManager = function(enabled, dataMonitoringParams, environment) { | |
| (function init() { | |
| updateEnvironment(environment) | |
| })(); | |
| var blockURLParamsRegex; | |
| var dataMonitoringAllowedDomainsRegex; | |
| var mode; | |
| function updateEnvironment(env) { | |
| var activeMonitoringParams; | |
| if (env && env.hasOwnProperty("dataMonitoring")) activeMonitoringParams = | |
| env.dataMonitoring || {}; | |
| else activeMonitoringParams = dataMonitoringParams || {}; | |
| activeMonitoringParams.blockURLParamsRegex = activeMonitoringParams.blockURLParamsRegex || []; | |
| activeMonitoringParams.mode = activeMonitoringParams.mode || "block"; | |
| activeMonitoringParams.domainsAllowed = activeMonitoringParams.domainsAllowed || []; | |
| blockURLParamsRegex = utilities.arrayToRegex(activeMonitoringParams.blockURLParamsRegex); | |
| dataMonitoringAllowedDomainsRegex = utilities.arrayToRegex(activeMonitoringParams.domainsAllowed); | |
| mode = activeMonitoringParams.mode | |
| } | |
| function allowRequest(request, hostName) { | |
| var dataMonitoringCheckPasses = true; | |
| var url = request.destination; | |
| if (enabled) { | |
| dataMonitoringCheckPasses = false; | |
| var decodedURLString = utilities.decodeUriComponent(url); | |
| dataMonitoringCheckPasses = !blockURLParamsRegex.test(decodedURLString); | |
| if (dataMonitoringCheckPasses === false) dataMonitoringCheckPasses = dataMonitoringAllowedDomainsRegex.test(hostName); | |
| if (!dataMonitoringCheckPasses) request.addReason("DATA_MONITORING") | |
| } | |
| return dataMonitoringCheckPasses | |
| } | |
| function editQueryString(queryString, | |
| replacementStringChars) { | |
| var replacementString = replacementStringChars || "~~~~~~~~~~~~~~~~~~~~"; | |
| if (replacementStringChars === "") replacementString = ""; | |
| var newStringVal = utilities.decodeUriComponent(queryString); | |
| if (newStringVal !== "" && blockURLParamsRegex.test && blockURLParamsRegex.test(newStringVal)) { | |
| newStringVal = newStringVal.replace(blockURLParamsRegex, replacementString); | |
| newStringVal = editQueryString(newStringVal, replacementString) | |
| } | |
| return newStringVal | |
| } | |
| function getMaskedDataString(dataMonitoringString) { | |
| var newStringVal = | |
| editQueryString(dataMonitoringString, "~~~~~~~~~~"); | |
| return newStringVal | |
| } | |
| function getRedactedDataString(dataMonitoringString) { | |
| var newStringVal = editQueryString(dataMonitoringString, ""); | |
| return newStringVal | |
| } | |
| function shouldMaskData(request) { | |
| var shouldMask = false; | |
| if (mode === "mask" && request.numReasons() === 1 && request.hasReason("DATA_MONITORING")) shouldMask = true; | |
| return shouldMask | |
| } | |
| function shouldRedactData(request) { | |
| var shouldMask = false; | |
| if (mode === "redact" && request.numReasons() === 1 && request.hasReason("DATA_MONITORING")) shouldMask = | |
| true; | |
| return shouldMask | |
| } | |
| return { | |
| allowRequest: allowRequest, | |
| getMaskedDataString: getMaskedDataString, | |
| getRedactedDataString: getRedactedDataString, | |
| shouldMaskData: shouldMaskData, | |
| shouldRedactData: shouldRedactData, | |
| updateEnvironment: updateEnvironment | |
| } | |
| }; | |
| var BusinessRulesManager = function(gatewayData) { | |
| var init = function() { | |
| setStaticVals() | |
| }, | |
| shouldGetEnterpriseModal = false, | |
| shouldGetPrivacyModal = false, | |
| setShouldGetEnterpriseModal = function() { | |
| shouldGetEnterpriseModal = gatewayData.libraryPackage === "enterprise" | |
| }, | |
| setShouldGetPrivacyModal = | |
| function() { | |
| shouldGetPrivacyModal = gatewayData.libraryPackage && gatewayData.libraryPackage === "privacy" | |
| }, | |
| setStaticVals = function() { | |
| setShouldGetEnterpriseModal(); | |
| setShouldGetPrivacyModal() | |
| }; | |
| init(); | |
| return { | |
| shouldGetEnterpriseModal: shouldGetEnterpriseModal, | |
| shouldGetPrivacyModal: shouldGetPrivacyModal | |
| } | |
| }; | |
| var PathFilterManager = function(activeList, shouldAddCategoryToList, environment, gatewayData) { | |
| var shouldAddCategoryToList = shouldAddCategoryToList, | |
| tagsWithFiltersRegEx, tagsWithAllowPaths = [], | |
| tagsWithBlockPaths = [], | |
| BLOCKED_KEY = gatewayData.info.name + "_ENSIGHTEN_BLOCKED_URLS", | |
| ALLOWED_KEY = gatewayData.info.name + "_ENSIGHTEN_ALLOWED_URLS"; | |
| var allowRequest = function(domain, path, targetListCheckPasses) { | |
| var allowRequest = targetListCheckPasses; | |
| if (tagsWithFiltersRegEx.test(domain)) { | |
| if (path === "") return allowRequest; | |
| for (var tagsWithAllowPathsCount = 0; tagsWithAllowPathsCount < tagsWithAllowPaths.length; tagsWithAllowPathsCount++) { | |
| var allowPathRegEx = new RegExp(tagsWithAllowPaths[tagsWithAllowPathsCount]["tag"]); | |
| if (allowPathRegEx.test(domain)) { | |
| var allowReg = []; | |
| allowReg = allowReg.concat(tagsWithAllowPaths[tagsWithAllowPathsCount]["paths"]); | |
| allowReg = utilities.arrayToRegex(allowReg); | |
| if (allowReg.test(path)) { | |
| allowRequest = true; | |
| return allowRequest | |
| } else allowRequest = false | |
| } | |
| } | |
| for (var tagsWithBlockPathsCount = 0; tagsWithBlockPathsCount < tagsWithBlockPaths.length; tagsWithBlockPathsCount++) { | |
| var domainRegEx = new RegExp(tagsWithBlockPaths[tagsWithBlockPathsCount]["tag"]); | |
| if (domainRegEx.test(domain)) { | |
| var blockReg = []; | |
| blockReg = blockReg.concat(tagsWithBlockPaths[tagsWithBlockPathsCount]["paths"]); | |
| blockReg = utilities.arrayToRegex(blockReg); | |
| if (blockReg.test(path)) { | |
| allowRequest = false; | |
| return allowRequest | |
| } else allowRequest = true | |
| } | |
| } | |
| } | |
| return allowRequest | |
| }, | |
| buildPathFilterList = function() { | |
| var tagsWithFilters = []; | |
| var filteredCategoryList = []; | |
| for (var category in activeList) { | |
| filteredCategoryList.push(activeList[category]); | |
| if (shouldAddCategoryToList(category)) parseCategoriesForPath(activeList[category], tagsWithFilters, tagsWithBlockPaths, tagsWithAllowPaths); | |
| var allowedURLS = localStorage.getItem(ALLOWED_KEY) ? JSON.parse(localStorage.getItem(ALLOWED_KEY)) : | |
| ""; | |
| if (allowedURLS) parseCategoriesForPath(allowedURLS, tagsWithFilters, tagsWithBlockPaths, tagsWithAllowPaths); | |
| var blockedURLs = localStorage.getItem(BLOCKED_KEY) ? JSON.parse(localStorage.getItem(BLOCKED_KEY)) : ""; | |
| if (blockedURLs) parseCategoriesForPath(blockedURLs, tagsWithFilters, tagsWithBlockPaths, tagsWithAllowPaths) | |
| } | |
| tagsWithFiltersRegEx = utilities.arrayToRegex(tagsWithFilters) | |
| }, | |
| update = function() { | |
| buildPathFilterList() | |
| }, | |
| init = function() { | |
| buildPathFilterList() | |
| }; | |
| init(); | |
| return { | |
| allowRequest: allowRequest, | |
| update: update | |
| } | |
| }; | |
| function parseCategoriesForPath(tagList, tagsWithFilters, tagsWithBlockPaths, tagsWithAllowPaths) { | |
| for (var index = 0; index < tagList.length; index++) { | |
| var tagItem = tagList[index]; | |
| if (tagItem["filter"]) { | |
| tagsWithFilters.push(tagItem["tag"]); | |
| if (tagItem["filter"] === "blockPaths") tagsWithBlockPaths.push({ | |
| tag: tagItem["tag"], | |
| paths: tagItem["paths"] | |
| }); | |
| else if (tagItem["filter"] == "allowPaths") tagsWithAllowPaths.push({ | |
| tag: tagItem["tag"], | |
| paths: tagItem["paths"] | |
| }) | |
| } | |
| } | |
| } | |
| var ListManager = function(environment, gatewayData, defaultCategory, | |
| cookieManager) { | |
| var activeList, environment = environment, | |
| listRegex, alwaysAllowedListRegex, pathFilterManager = null, | |
| usesPathFilter = false, | |
| usesWhiteList = true, | |
| BLOCKED_KEY = gatewayData.info.name + "_ENSIGHTEN_BLOCKED_URLS", | |
| initalized = false, | |
| ALLOWED_KEY = gatewayData.info.name + "_ENSIGHTEN_ALLOWED_URLS"; | |
| var init = function() { | |
| buildListRegex(environment); | |
| initalized = true | |
| }, | |
| buildListRegex = function(environment) { | |
| setUsesWhitelist(environment); | |
| setActiveList(environment); | |
| if (usesWhiteList === true) buildListRegexForAlwaysAllowedDomains(); | |
| var list = getList(), | |
| reg = []; | |
| var listUsesObject = false; | |
| for (var cat in list) | |
| if (list[cat][0] && typeof list[cat][0] === "object") listUsesObject = true; | |
| var addToList = function(listVals) { | |
| if (listUsesObject) reg = reg.concat(getObjectsVals(list[listVals], "tag")); | |
| else reg = reg.concat(list[listVals]) | |
| }; | |
| for (var category in list) | |
| if (shouldAddToListRegex(category)) addToList(category); | |
| var allowedURLS = localStorage.getItem(ALLOWED_KEY) ? JSON.parse(localStorage.getItem(ALLOWED_KEY)) : ""; | |
| var blockedURLs = localStorage.getItem(BLOCKED_KEY) ? | |
| JSON.parse(localStorage.getItem(BLOCKED_KEY)) : ""; | |
| if (usesWhiteList) { | |
| if (allowedURLS) reg = reg.concat(getObjectsVals(allowedURLS, "tag")); | |
| if (blockedURLs) reg = reg.filter(function(element) { | |
| return !getObjectsVals(blockedURLs, "tag").includes(element) | |
| }) | |
| } else { | |
| if (blockedURLs) reg = reg.concat(getObjectsVals(blockedURLs, "tag")); | |
| if (allowedURLS) reg = reg.filter(function(element) { | |
| return !getObjectsVals(allowedURLS, "tag").includes(element) | |
| }) | |
| } | |
| listRegex = utilities.arrayToRegex(reg) | |
| }, | |
| shouldAddToListRegex = function(category) { | |
| var shouldAddToListRegex = | |
| false; | |
| if (category == defaultCategory) { | |
| shouldAddToListRegex = true; | |
| return shouldAddToListRegex | |
| } | |
| if (usesWhiteList) | |
| if (this.cookieManager.getCookie(category) == "1") shouldAddToListRegex = true; | |
| else { | |
| if (this.cookieManager.getCookie(category) !== "0" && environmentOptsValEquals(category, 1)) shouldAddToListRegex = true | |
| } else if (this.cookieManager.getCookie(category) == "0") shouldAddToListRegex = true; | |
| else if (this.cookieManager.getCookie(category) !== "1" && environmentOptsValEquals(category, 0)) shouldAddToListRegex = true; | |
| return shouldAddToListRegex | |
| }, | |
| environmentOptsValEquals = function(opt, val) { | |
| return environment && environment.optVals[opt] == val | |
| }, | |
| getObjectsVals = function(arrayOfObjects, key) { | |
| var arrayOfObjectVals = []; | |
| for (var i = 0; i < arrayOfObjects.length; i++) { | |
| var val = arrayOfObjects[i][key]; | |
| arrayOfObjectVals.push(val); | |
| if (arrayOfObjects["filter"]) usesPathFilter = true | |
| } | |
| if (usesPathFilter) pathFilterManager = new PathFilterManager(getList(), shouldAddToListRegex, environment, gatewayData); | |
| return arrayOfObjectVals | |
| }, | |
| getList = function() { | |
| return activeList | |
| }, | |
| getListRegex = | |
| function() { | |
| return listRegex | |
| }, | |
| getCategoryTranslations = function(category) { | |
| if (environment.translation && environment.translation.purposes) | |
| for (var i = 0; i < category.length; i++) { | |
| var translatedPurposes = []; | |
| if (category[i].purpose) | |
| for (var j = 0; j < category[i].purpose.length; j++) translatedPurposes.push(environment.translation.purposes[category[i].purpose[j]]); | |
| category[i].purpose = translatedPurposes | |
| } | |
| return category | |
| }, | |
| getTranslatedList = function() { | |
| var fullList = getList(), | |
| translatedList = fullList; | |
| for (var category in fullList) | |
| if (category !== | |
| "default") translatedList[category] = getCategoryTranslations(fullList[category]); | |
| return translatedList | |
| }, | |
| getUsesWhitelist = function() { | |
| return usesWhiteList | |
| }, | |
| setUsesWhitelist = function(environment) { | |
| if (environment && environment.hasOwnProperty("usesWhitelist")) usesWhiteList = environment.usesWhitelist; | |
| else if (gatewayData.featureToggles.hasOwnProperty("usesWhitelist")) usesWhiteList = gatewayData.featureToggles.usesWhitelist; | |
| else usesWhiteList = true | |
| }, | |
| setActiveList = function(environment) { | |
| if (usesWhiteList) | |
| if (environment && | |
| environment.hasOwnProperty("whitelist")) activeList = environment.whitelist; | |
| else activeList = gatewayData.whitelist || {}; | |
| else if (environment && environment.hasOwnProperty("blacklist")) activeList = environment.blacklist; | |
| else activeList = gatewayData.blacklist || {}; | |
| if (!activeList.hasOwnProperty(defaultCategory) && usesWhiteList === true) activeList[defaultCategory] = []; | |
| var listUsesObject = false; | |
| for (var cat in activeList) | |
| if (activeList[cat][0] && typeof activeList[cat][0] === "object") listUsesObject = true; | |
| if (usesWhiteList && !initalized) { | |
| var nexusDomain = | |
| gatewayData.info.nexus || "nexus.ensighten.com"; | |
| if (listUsesObject) { | |
| activeList[defaultCategory].push({ | |
| tag: location.hostname | |
| }); | |
| activeList[defaultCategory].push({ | |
| tag: nexusDomain | |
| }) | |
| } else { | |
| activeList[defaultCategory].push(location.hostname); | |
| activeList[defaultCategory].push(nexusDomain) | |
| } | |
| } | |
| }, | |
| allowRequest = function(hostName, pathName, targetListCheckPasses) { | |
| var listRegEx = getListRegex(); | |
| var targetListCheckPasses = false; | |
| if (getUsesWhitelist() === false) { | |
| if (listRegEx.test && !listRegEx.test(hostName)) targetListCheckPasses = | |
| true | |
| } else if (listRegEx.test && listRegEx.test(hostName)) targetListCheckPasses = true; | |
| if (pathFilterManager) targetListCheckPasses = pathFilterManager.allowRequest(hostName, pathName, targetListCheckPasses, listRegEx); | |
| return targetListCheckPasses | |
| }, | |
| updateListValues = function() { | |
| buildListRegex(environment); | |
| pathFilterManager.update() | |
| }, | |
| updateEnvironment = function(newEnv) { | |
| environment = newEnv; | |
| buildListRegex(newEnv); | |
| pathFilterManager.update() | |
| }, | |
| buildListRegexForAlwaysAllowedDomains = function() { | |
| var alwaysAllowedDomains = getList() ? | |
| getList()[defaultCategory] || [] : []; | |
| var objectValues = getObjectsVals(alwaysAllowedDomains, "tag"); | |
| alwaysAllowedListRegex = utilities.arrayToRegex(objectValues) | |
| }, | |
| getAlwaysAllowedListRegex = function() { | |
| return alwaysAllowedListRegex || new RegExp("a^") | |
| }; | |
| init(); | |
| return { | |
| getList: getList, | |
| getListRegex: getListRegex, | |
| getTranslatedList: getTranslatedList, | |
| getUsesWhitelist: getUsesWhitelist, | |
| allowRequest: allowRequest, | |
| updateEnvironment: updateEnvironment, | |
| updateListValues: updateListValues, | |
| getAlwaysAllowedListRegex: getAlwaysAllowedListRegex, | |
| ALLOWED_KEY: ALLOWED_KEY, | |
| BLOCKED_KEY: BLOCKED_KEY | |
| } | |
| }; | |
| var Banner = function(gatewayData, environment, cookieModal, cookieManager) { | |
| var e = document.createElement("div"); | |
| var bannerCopy = environment.translation.notificationBannerContent; | |
| var bannerViewed = function() { | |
| var oldCookies = cookieManager.getCookiesFromTypes(["BANNER_VIEWED"]); | |
| cookieManager.setCookie("BANNER_VIEWED", "1"); | |
| var newCookies = cookieManager.getCookiesFromTypes(["BANNER_VIEWED"]); | |
| consentReporter.sendReport(oldCookies, newCookies) | |
| }; | |
| var checkCopyForLinks = | |
| function() { | |
| bannerCopy = bannerCopy.replace(/{{/i, "\x3cspan id\x3d'ensModalLink' class\x3d'ensModalLink'\x3e"); | |
| bannerCopy = bannerCopy.replace(/}}/i, "\x3c/span\x3e") | |
| }; | |
| var closeEnsBanner = function() { | |
| bannerViewed(); | |
| var banner = document.getElementById("ensNotifyBanner"); | |
| banner.style.display = "none" | |
| }; | |
| var ensBannerShowModal = function() { | |
| closeEnsBanner(); | |
| if (cookieModal.openModal) cookieModal.openModal() | |
| }; | |
| var openBannerCheck = function() { | |
| var ensBannerHasBeenViewed = cookieManager.getCookie("BANNER_VIEWED"); | |
| if (!ensBannerHasBeenViewed) openEnsBanner() | |
| }; | |
| var openEnsBanner = function() { | |
| var banner = document.getElementById("ensNotifyBanner"); | |
| banner.style.display = "block"; | |
| var parentWidth = window.innerWidth / 2; | |
| var elementWidth = parseInt(window.getComputedStyle(banner).width) / 2; | |
| banner.style.left = parentWidth - elementWidth + "px" | |
| }; | |
| var styleString = "" + ".ensNotifyBanner{" + "background-color: #191B23;" + "color: #EDEDED;" + "opacity: 0.8;" + "width:60%;" + "border-radius: 10px;" + "padding:20px;" + "font-family: Roboto, 'Helvetica Neue', Helvetica, Arial;" + "position: fixed;" + "bottom:50px;" + | |
| "display: none;" + "z-index: 9999;" + "}" + ".ensButtons{" + "clear: both;" + "margin-top: 15px;" + "float: right;" + "}" + ".ensButtons .button{" + "display: inline-block;" + "position: relative;" + "width: 120px;" + "height: 32px;" + "line-height: 32px;" + "border-radius: 2px;" + "font-size: 0.9em;" + "background-color: #fff;" + "color: #646464;" + "margin-left: 20px;" + "text-align: center;" + "}" + ".ensButtons .button{" + "cursor: pointer;" + "}" + ".ensButtons .button.grey {" + "background-color: #eee;" + "}" + ".ensButtons .button.blue {" + "background-color: #4285f4;" + | |
| "color: #fff;" + "}" + ".ensButtons .button.raised {" + "transition: box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);" + "transition-delay: 0.2s;" + "box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);" + "}" + ".ensButtons .button.raised:active {" + "box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2);" + "transition-delay: 0s;" + "}" + ".ensClear{" + " clear:both;" + "}" + ".ensModalLink{" + " cursor: pointer;" + " text-decoration: underline;" + "}" + ".ensModalLink:hover{" + " color: #4285f4;" + "}"; | |
| var setBannerCopy = function(copy) { | |
| bannerCopy = copy; | |
| checkCopyForLinks() | |
| }; | |
| var setBannerMarkup = function(translation) { | |
| bannerMarkup = "\x3cdiv id\x3d'ensNotifyBanner' class\x3d'ensNotifyBanner'\x3e" + "\x3cdiv\x3e" + bannerCopy + "\x3c/div\x3e" + "\x3cdiv class\x3d'ensButtons'\x3e" + "\x3cdiv id\x3d'ensCloseBanner' class\x3d'button raised blue'\x3e" + translation.close + "\x3c/div\x3e" + "\x3c/div\x3e" + "\x3cdiv class\x3d'ensClear'\x3e\x3c/div\x3e" + "\x3c/div\x3e" | |
| }; | |
| var getBannerMarkup = function() { | |
| return bannerMarkup | |
| }; | |
| var isEnabledPrivacyNotice = function(env) { | |
| return env && env.hasOwnProperty("enablePrivacyNotice") ? | |
| env.enablePrivacyNotice : gatewayData.featureToggles.enablePrivacyNotice | |
| }; | |
| var update = function(env) { | |
| if (isEnabledPrivacyNotice(env)) { | |
| var banner = document.getElementById("ensNotifyBanner"); | |
| var modal = document.getElementById("ensModalWrapper"); | |
| if (banner === null) { | |
| checkCopyForLinks(); | |
| setBannerMarkup(env.translation); | |
| e.innerHTML = bannerMarkup; | |
| var injectBanner = function() { | |
| setTimeout(function() { | |
| document.body.insertBefore(e, document.body.lastChild); | |
| utilities.addStyleElement(styleString); | |
| addEventListeners(); | |
| openBannerCheck() | |
| }, | |
| 100) | |
| }; | |
| utilities.domReady(injectBanner) | |
| } else { | |
| bannerDisplayStyle = banner.style.display; | |
| modalDisplayStyle = modal.style.display; | |
| setBannerCopy(env.translation.notificationBannerContent); | |
| setBannerMarkup(env.translation); | |
| e.innerHTML = bannerMarkup; | |
| if (bannerDisplayStyle === "block") openEnsBanner(); | |
| if (modalDisplayStyle === "block") ensBannerShowModal(); | |
| addEventListeners() | |
| } | |
| } | |
| }; | |
| var addEventListeners = function() { | |
| var openModalLink = document.getElementsByClassName("ensModalLink"); | |
| var closeBannerButton = document.getElementById("ensCloseBanner"); | |
| for (var i = 0; i < openModalLink.length; i++) openModalLink[i].addEventListener("click", ensBannerShowModal); | |
| closeBannerButton.addEventListener("click", closeEnsBanner) | |
| }; | |
| var init = function() { | |
| update(environment) | |
| }(); | |
| var testObject = { | |
| bannerViewed: bannerViewed, | |
| ensBannerShowModal: ensBannerShowModal | |
| }; | |
| return { | |
| closeEnsBanner: closeEnsBanner, | |
| openEnsBanner: openEnsBanner, | |
| update: update | |
| } | |
| }; | |
| var ConsentModal = function(gatewayData, environment, tagPurposes, cookieManager, updateLists, consentReporter) { | |
| var styleString = "" + ".ensCenter{" + | |
| "text-align: center;" + "}" + "#ensModalWrapper{" + "border: 1px solid #333;" + "position: fixed;" + "max-width: 60%;" + "border: 1px solid #000;" + "display: block;" + "box-shadow: 5px 5px 5px grey;" + "background-color:#fff;" + "padding: 20px 0;" + "z-index: 9999;" + "}" + ".ensModal {" + "font-family: Roboto, 'Helvetica Neue', Helvetica, Arial;" + "min-width: 400px;" + "max-width: 400px;" + "}" + ".ensModal input[type\x3d'checkbox'] {" + "display: none;" + "}" + ".ensModal input[type\x3d'checkbox']:checked ~ .toggle {" + "background: #fff;" + | |
| "left: 36px;" + "transition: .5s;" + "}" + ".ensModal input[type\x3d'checkbox']:checked ~ .switch {" + "background: #43A047;" + "transition: .5s;" + "}" + ".ensModal .switch {" + "display: block;" + "width: 50px;" + "height: 15px;" + "background: #939393;" + "border-radius: 10px;" + "position: absolute;" + "top: 0;" + "transition: .5s;" + "}" + ".ensModal .toggle {" + "height: 17px;" + "width: 17px;" + "border-radius: 50%;" + "background: white;" + "position: absolute;" + "top: -2px;" + "left: -2px;" + "box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);" + | |
| "transition: .5s;" + "}" + ".ensModal .card {" + "display: inline-block;" + "margin: 9px;" + "margin: 5px;" + "width: 50px;" + "height: 20px;" + "text-align: center;" + "position: relative;" + "float:right;" + "}" + ".ensModal{" + "font-size: 18px;" + "color: #333;" + "padding: 20px 20px 0px 20px;" + "}" + ".ensToggleRow{" + "margin-bottom: 10px;" + "}" + ".ensToggleLabel{" + "margin-right: 5px;" + "}" + ".ensButtons{" + "clear: both;" + "margin-top: 15px;" + "float: right;" + "}" + ".ensButtons .button{" + "display: inline-block;" + "position: relative;" + | |
| "width: 120px;" + "height: 32px;" + "line-height: 32px;" + "border-radius: 2px;" + "font-size: 0.9em;" + "background-color: #fff;" + "color: #646464;" + "margin-left: 20px;" + "}" + ".ensButtons .button.grey {" + "background-color: #eee;" + "}" + ".ensButtons .button.blue {" + "background-color: #4285f4;" + "color: #fff;" + "}" + ".ensButtons .button.raised {" + "transition: box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);" + "transition-delay: 0.2s;" + "box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);" + "}" + ".ensButtons .button.raised:active {" + | |
| "box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2);" + "transition-delay: 0s;" + "}" + ".ensModal .ensTitle {" + "margin:5px;" + "width:95%;" + "color: #74736F;" + "position: absolute;" + "top:-5px;" + "left:-5px;" + "padding-left:5%;" + "padding-top:13px;" + "padding-bottom: 3px;" + "text-align: center;" + "}" + ".ensModal .consentDescription {" + "color:#333;" + "font-size: 14px;" + "}" + ".ensModal hr {" + "color: #C5C5C5" + "}" + ".ensModal .description {" + "max-width:600px;" + "font-size: 12px;" + "marin-top:15px;" + "clear: both;" + "}" + ".mdl-shadow--2dp {" + | |
| "box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), 0 3px 1px -2px rgba(0,0,0,.2), 0 1px 5px 0 rgba(0,0,0,.12);" + "}" + ".mdl-data-table {" + "position: relative;" + "border: 1px solid rgba(0,0,0,.12);" + "border-collapse: collapse;" + "white-space: nowrap;" + "font-size: 13px;" + "background-color: #fff;" + "}" + ".mdl-data-table thead {" + "padding-bottom: 3px;" + "}" + "tr{" + "display: table-row;" + "vertical-align: inherit;" + "border-color: inherit;" + "}" + ".mdl-data-table td:first-of-type, .mdl-data-table th:first-of-type {" + "padding-left: 24px;" + | |
| "}" + ".mdl-data-table__cell--non-numeric.mdl-data-table__cell--non-numeric {" + "text-align: left;" + "}" + "tbody {" + "display: table-row-group;" + "vertical-align: middle;" + "border-color: inherit;" + "}" + ".mdl-data-table tbody tr {" + "position: relative;" + "height: 48px;" + "transition-duration: .28s;" + "transition-timing-function: cubic-bezier(.4,0,.2,1);" + "transition-property: background-color;" + "}" + ".mdl-data-table td:first-of-type, .mdl-data-table th:first-of-type {" + "padding-left: 24px;" + "}" + ".mdl-data-table td, .mdl-data-table td .mdl-data-table__select {" + | |
| "vertical-align: middle;" + "}" + ".mdl-data-table td {" + "position: relative;" + "height: 48px;" + "border-top: 1px solid rgba(0,0,0,.12);" + "border-bottom: 1px solid rgba(0,0,0,.12);" + "padding: 12px 18px;" + "box-sizing: border-box;" + "}" + ".mdl-data-table th {" + "position: relative;" + "vertical-align: bottom;" + "text-overflow: ellipsis;" + "font-weight: 700;" + "line-height: 24px;" + "letter-spacing: 0;" + "height: 48px;" + "font-size: 12px;" + "color: rgba(0,0,0,.54);" + "padding-bottom: 8px;" + "box-sizing: border-box;" + "}" + | |
| ".mdl-data-table th {" + "padding: 0 18px 12px 18px;" + "text-align: right;" + "}" + ".mdl-navigation__link {" + "color: #424242;" + "margin: 0;" + "font-size: 14px;" + "font-weight: 400;" + "line-height: 24px;" + "letter-spacing: 0;" + "opacity: .87;" + "}"; | |
| ensShowMore = function() { | |
| var showMoreLink = document.getElementById("ensShowMoreLink"); | |
| var tagsTable = document.getElementById("ensTagsTable"); | |
| if (showMoreLink.innerText === "Show More") { | |
| showMoreLink.innerText = "Show Less"; | |
| tagsTable.style.display = "block" | |
| } else { | |
| showMoreLink.innerText = | |
| "Show More"; | |
| tagsTable.style.display = "none" | |
| } | |
| }; | |
| var isEnabledConsentModal = function(env) { | |
| return env && env.hasOwnProperty("enableConsentModal") ? env.enableConsentModal : gatewayData.featureToggles.enableConsentModal | |
| }; | |
| var that = this; | |
| this.environment = environment; | |
| this.cookieVals = []; | |
| this.allowAll = function() { | |
| var clientName = gatewayData.info.name, | |
| oldCookies = cookieManager.getCookiesFromTypes(gatewayData.cookieTypes); | |
| for (var i = 0; i < gatewayData.cookieTypes.length; i++) cookieManager.setCookie(gatewayData.cookieTypes[i], | |
| 1); | |
| var newCookies = cookieManager.getCookiesFromTypes(gatewayData.cookieTypes); | |
| consentReporter.sendReport(oldCookies, newCookies) | |
| }; | |
| this.closeModal = function() { | |
| that.divElement.style.display = "none" | |
| }; | |
| this.denyAll = function() { | |
| var clientName = gatewayData.info.name, | |
| oldCookies = cookieManager.getCookiesFromTypes(gatewayData.cookieTypes); | |
| for (var i = 0; i < gatewayData.cookieTypes.length; i++) cookieManager.setCookie(gatewayData.cookieTypes[i], 0); | |
| var newCookies = cookieManager.getCookiesFromTypes(clientName, gatewayData.cookieTypes); | |
| consentReporter.sendReport(oldCookies, newCookies) | |
| }; | |
| this.divElement = document.createElement("div"); | |
| this.getInnerModalString = function() { | |
| return "" | |
| }; | |
| this.init = function() { | |
| that.update(environment) | |
| }; | |
| this.injectModal = function() { | |
| utilities.addStyleElement(styleString); | |
| document.body.insertBefore(that.divElement, document.body.lastChild); | |
| that.setHTMLBindings(); | |
| that.openModalCheck() | |
| }; | |
| this.modalViewed = function() { | |
| var clientName = gatewayData.info.name, | |
| oldCookies = cookieManager.getCookiesFromTypes(["MODAL_VIEWED"]); | |
| var topLevelDomain = | |
| document.location.hostname; | |
| cookieManager.setCookie("MODAL_VIEWED", "1"); | |
| var newCookies = cookieManager.getCookiesFromTypes(["MODAL_VIEWED"]); | |
| consentReporter.sendReport(oldCookies, newCookies) | |
| }; | |
| this.openModal = function() { | |
| that.divElement.style.display = "block"; | |
| var parentWidth = window.innerWidth / 2; | |
| var parentHeight = window.innerHeight / 2; | |
| var modalObject = parseInt(window.getComputedStyle(that.divElement)); | |
| var elementWidth = parseInt(window.getComputedStyle(that.divElement).width) / 2; | |
| var elementHeight = parseInt(window.getComputedStyle(that.divElement).height) / | |
| 2; | |
| that.divElement.style.left = parentWidth - elementWidth + "px"; | |
| that.divElement.style.top = parentHeight - elementHeight + "px" | |
| }; | |
| this.openModalCheck = function() { | |
| var ensModalHasBeenViewed = cookieManager.getCookie("MODAL_VIEWED"); | |
| if (!ensModalHasBeenViewed) that.openModal() | |
| }; | |
| this.getModalHtmlString = function() { | |
| var modalHtmlString = "\x3cdiv class\x3d'ensModal'\x3e" + "\x3cdiv class\x3d'ensTitle'\x3e" + that.environment.translation["consentTitle"] + "\x3c/div\x3e" + "\x3cdiv class\x3d'consentDescription'\x3e" + that.environment.translation["consentDescription"] + | |
| "\x3c/div\x3e" + "\x3cdiv\x3e\x3c/div\x3e" + "\x3cbr\x3e" + "\x3cdiv style\x3d'float:right;'\x3e\x3ca class\x3d'mdl-navigation__link closed' onclick\x3d'ensShowMore()' id\x3d'ensShowMoreLink' href\x3d'#' style\x3d'text-decoration: underline;'\x3eShow More\x3c/a\x3e\x3c/div\x3e" + "\x3cdiv\x3e\x3cbr\x3e\x3cbr\x3e\x3c/div\x3e" + "\x3cdiv style\x3d'max-height:300px; overflow-y: scroll; max-width: 100%'\x3e" + "\x3ctable id\x3d'ensTagsTable' class\x3d'mdl-data-table mdl-js-data-table mdl-data-table--selectable mdl-shadow--2dp' style\x3d'display:none;'\x3e" + | |
| "\x3ctr\x3e\x3cth class\x3d'mdl-data-table__cell--non-numeric'\x3eTag\x3c/th\x3e\x3cth class\x3d'mdl-data-table__cell--non-numeric'\x3ePurposes\x3c/th\x3e\x3c/tr\x3e"; | |
| for (var cat in tagPurposes) | |
| if (cat !== "default") | |
| for (var i = 0; i < tagPurposes[cat].length; i++) modalHtmlString += "\x3ctr\x3e\x3ctd class\x3d'mdl-data-table__cell--non-numeric'\x3e" + tagPurposes[cat][i].displayName + "\x3c/td\x3e\x3ctd class\x3d'mdl-data-table__cell--non-numeric'\x3e" + tagPurposes[cat][i].purpose.join(", ") + "\x3c/td\x3e\x3c/tr\x3e"; | |
| modalHtmlString += "\x3c/table\x3e" + "\x3c/div\x3e" + "\x3cpaper-ripple fit\x3e\x3c/paper-ripple\x3e" + "\x3c/div\x3e" + "\x3cdiv style\x3d'padding:0 20px;'\x3e" + that.getInnerModalString() + "\x3c/div\x3e" + "\x3cdiv style\x3d'clear:both; font-size:8px; text-align: center; padding-top:20px;'\x3e\x3ca href\x3d'https://www.ensighten.com/products/enterprise-tag-management/privacy/' target\x3d'_blank' style\x3d'text-decoration: none; color: #424242;'\x3eGDPR Compliance - Powered By Ensighten\x3c/a\x3e\x3c/div\x3e"; | |
| return modalHtmlString | |
| }; | |
| this.setHTMLBindings = function() {}; | |
| this.update = function(environment) { | |
| if (isEnabledConsentModal(environment)) { | |
| that.environment = environment; | |
| that.divElement.innerHTML = that.getModalHtmlString(); | |
| if (document.getElementById(that.divElement.id) === null) utilities.domReady(that.injectModal) | |
| } | |
| }; | |
| this.divElement.id = "ensModalWrapper"; | |
| return this | |
| }; | |
| var ConsentWidget = function(environment, gatewayData) { | |
| var that = this; | |
| this.widgetString = ""; | |
| this.styleString = "" + ".consentWidget {" + "border-radius: 2px;" + | |
| "font-size:10px;" + "position: fixed;" + "bottom: 0px;" + "right: 5%;" + "cursor: default;" + "background-color: #323232;" + "z-index: 3;" + "display: block;" + " font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif;" + "}" + ".consentWidget__text {" + "padding: 14px 12px;" + "vertical-align: middle;" + "color: #fff;" + "float: left;" + "}"; | |
| this.divElement = document.createElement("div"); | |
| this.divElement.id = "ensConsentWidget"; | |
| this.divElement.className = "consentWidget"; | |
| var isEnabledConsentModal = function(env) { | |
| return env && env.hasOwnProperty("enableConsentModal") ? | |
| env.enableConsentModal : gatewayData.featureToggles.enableConsentModal | |
| }; | |
| this.update = function(environment) { | |
| if (isEnabledConsentModal(environment)) { | |
| that.setWidgetString(environment); | |
| that.divElement.innerHTML = that.getWidgetString(); | |
| if (document.getElementById("ensConsentWidget") === null) utilities.domReady(that.injectWidget) | |
| } | |
| }; | |
| this.setWidgetString = function(environment) { | |
| that.widgetString = "\x3cdiv class\x3d'consentWidget__text' id\x3d'consentWidget__text'\x3e" + environment.translation["consentWidgetCopy"] + "\x3c/div\x3e" | |
| }; | |
| this.getWidgetString = function() { | |
| return that.widgetString | |
| }; | |
| this.injectWidget = function() { | |
| setTimeout(function() { | |
| utilities.addStyleElement(that.styleString); | |
| document.body.insertBefore(that.divElement, document.body.lastChild); | |
| that.setHTMLBindings() | |
| }, 100) | |
| }; | |
| this.setHTMLBindings = function() { | |
| document.getElementById("ensConsentWidget").addEventListener("click", updateConsent); | |
| function updateConsent() { | |
| if (Bootstrapper.gateway.openModal) Bootstrapper.gateway.openModal() | |
| } | |
| }; | |
| this.update(environment); | |
| return this | |
| }; | |
| var NoTogglesConsentModal = | |
| function(gatewayData, environment, tagPurposes, cookieManager, updateLists, consentReporter) { | |
| var modal = new ConsentModal(gatewayData, environment, tagPurposes, cookieManager, [], consentReporter); | |
| modal.getInnerModalString = function() { | |
| return "\x3cdiv class\x3d'ensButtons'\x3e" + "\x3cdiv id\x3d'ensDeny' class\x3d'button raised grey'\x3e" + "\x3cdiv class\x3d'ensCenter'\x3e" + environment.translation.deny + "\x3c/div\x3e" + "\x3cpaper-ripple fit\x3e\x3c/paper-ripple\x3e" + "\x3c/div\x3e" + "\x3cdiv id\x3d'ensAllow' class\x3d'button raised blue'\x3e" + | |
| "\x3cdiv class\x3d'ensCenter' fit\x3e" + environment.translation.allow + "\x3c/div\x3e" + "\x3cpaper-ripple fit\x3e\x3c/paper-ripple\x3e" + "\x3c/div\x3e" + "\x3c/div\x3e" + "\x3c/div\x3e" | |
| }; | |
| modal.setHTMLBindings = function() { | |
| var allowButton = document.getElementById("ensAllow"); | |
| var denyButton = document.getElementById("ensDeny"); | |
| allowButton.addEventListener("click", function() { | |
| modal.allowAll(); | |
| modal.closeModal(); | |
| modal.modalViewed(); | |
| updateLists() | |
| }); | |
| denyButton.addEventListener("click", function() { | |
| modal.denyAll(); | |
| modal.closeModal(); | |
| modal.modalViewed(); | |
| updateLists() | |
| }) | |
| }; | |
| modal.init(); | |
| return modal | |
| }; | |
| var CookieModal = function(cookieManager, updateLists, consentReporter, environment, gatewayData) { | |
| var e = document.createElement("div"); | |
| e.id = "ensModalWrapper"; | |
| var cookieVals = []; | |
| var modalHtmlString = ""; | |
| var getCurrentCookieVal = function(key) { | |
| var checkBox = document.getElementById(key + "Slide"); | |
| var retVal = 0; | |
| if (checkBox.checked) retVal = 1; | |
| return retVal | |
| }; | |
| var saveNewCookieValues = function() { | |
| var oldCookies = cookieManager.getCookiesFromTypes(gatewayData.cookieTypes); | |
| for (var i = 0; i < gatewayData.cookieTypes.length; i++) cookieManager.setCookie(gatewayData.cookieTypes[i], getCurrentCookieVal(gatewayData.cookieTypes[i])); | |
| var newCookies = cookieManager.getCookiesFromTypes(gatewayData.cookieTypes); | |
| consentReporter.sendReport(oldCookies, newCookies); | |
| closeModal() | |
| }; | |
| var cookieTypesCount = gatewayData.cookieTypes.length; | |
| var openModal = function() { | |
| e.style.display = "block"; | |
| var parentWidth = window.innerWidth / 2; | |
| var parentHeight = window.innerHeight / 2; | |
| var modalObject = parseInt(window.getComputedStyle(e)); | |
| var elementWidth = parseInt(window.getComputedStyle(e).width) / 2; | |
| var elementHeight = parseInt(window.getComputedStyle(e).height) / 2; | |
| e.style.left = parentWidth - elementWidth + "px"; | |
| e.style.top = parentHeight - elementHeight + "px" | |
| }; | |
| var closeModal = function() { | |
| e.style.display = "none" | |
| }; | |
| var shouldOptBeChecked = function(defaultVal, cookieKey) { | |
| var shouldBeChecked = ""; | |
| var localCookieVal = cookieManager.getCookie(cookieKey); | |
| if (defaultVal == 1 || localCookieVal == "1") shouldBeChecked = " checked "; | |
| if (!localCookieVal && defaultVal != 1 || localCookieVal == | |
| "0" && defaultVal == 1) shouldBeChecked = ""; | |
| return shouldBeChecked | |
| }; | |
| var styleString = "" + ".ensCenter{" + "text-align: center;" + "}" + "#ensModalWrapper{" + "border: 1px solid #333;" + "position: fixed;" + "max-width: 80%;" + "border: 1px solid #000;" + "display: none;" + "box-shadow: 5px 5px 5px grey;" + "background-color:#fff;" + "padding: 20px 0;" + "z-index: 9999;" + "}" + ".ensModal {" + "font-family: Roboto, 'Helvetica Neue', Helvetica, Arial;" + "}" + ".ensModal input[type\x3d'checkbox'] {" + "display: none;" + "}" + ".ensModal input[type\x3d'checkbox']:checked ~ .toggle {" + | |
| "background: #fff;" + "left: 36px;" + "transition: .5s;" + "}" + ".ensModal input[type\x3d'checkbox']:checked ~ .switch {" + "background: #43A047;" + "transition: .5s;" + "}" + ".ensModal .switch {" + "display: block;" + "width: 50px;" + "height: 15px;" + "background: #939393;" + "border-radius: 10px;" + "position: absolute;" + "top: 0;" + "transition: .5s;" + "}" + ".ensModal .toggle {" + "height: 17px;" + "width: 17px;" + "border-radius: 50%;" + "background: white;" + "position: absolute;" + "top: -2px;" + "left: -2px;" + "box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);" + | |
| "transition: .5s;" + "}" + ".ensModal .card {" + "display: inline-block;" + "margin: 9px;" + "margin: 5px;" + "width: 50px;" + "height: 20px;" + "text-align: center;" + "position: relative;" + "float:right;" + "}" + ".ensModal{" + "font-size: 18px;" + "color: #333;" + "padding: 20px;" + "}" + ".ensToggleRow{" + "margin-bottom: 10px;" + "}" + ".ensToggleLabel{" + "margin-right: 5px;" + "}" + ".ensButtons{" + "clear: both;" + "margin-top: 15px;" + "float: right;" + "}" + ".ensButtons .button{" + "display: inline-block;" + "position: relative;" + "width: 120px;" + | |
| "height: 32px;" + "line-height: 32px;" + "border-radius: 2px;" + "font-size: 0.9em;" + "background-color: #fff;" + "color: #646464;" + "margin-left: 20px;" + "}" + ".ensButtons .button.grey {" + "background-color: #eee;" + "}" + ".ensButtons .button.blue {" + "background-color: #4285f4;" + "color: #fff;" + "}" + ".ensButtons .button.raised {" + "transition: box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);" + "transition-delay: 0.2s;" + "box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);" + "}" + ".ensButtons .button.raised:active {" + "box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2);" + | |
| "transition-delay: 0s;" + "}" + ".ensModal .ensTitle {" + "margin:5px;" + "width:95%;" + "color: #74736F;" + "position: absolute;" + "top:-5px;" + "left:-5px;" + "padding-left:5%;" + "padding-top:13px;" + "padding-bottom: 3px;" + "text-align: center;" + "}" + ".ensModal .consentDescription {" + "color:#333;" + "font-size: 14px;" + "}" + ".ensModal hr {" + "color: #C5C5C5" + "}" + ".ensModal .description {" + "max-width:600px;" + "font-size: 12px;" + "marin-top:15px;" + "clear: both;" + "}"; | |
| var getModalHtmlString = function() { | |
| return modalHtmlString | |
| }; | |
| var setModalHtmlString = function(optVals, translation, showTrustedDomains) { | |
| modalHtmlString = "" + "\x3cdiv class\x3d'ensModal'\x3e" + "\x3cdiv class\x3d'ensTitle'\x3e" + translation["consentTitle"] + "\x3c/div\x3e" + "\x3cdiv class\x3d'consentDescription'\x3e" + translation["consentDescription"] + "\x3c/div\x3e" + "\x3chr\x3e"; | |
| for (var propertyName in optVals) cookieVals.push(optVals[propertyName]); | |
| for (var prop in translation.cookies) | |
| if (showTrustedDomains === true && prop === "default") modalHtmlString = modalHtmlString + "\x3cdiv class\x3d'ensToggleRow' style\x3d'opacity: .5;'\x3e" + | |
| "\x3clabel class\x3d'ensToggleLabel'\x3e" + translation.cookies[prop]["title"] + "\x3cdiv class\x3d'card'\x3e" + "\x3cinput class\x3d'ensCheckbox' type\x3d'checkbox' name\x3d'check' disabled\x3d'disabled' checked\x3d'checked'/\x3e" + "\x3cspan class\x3d'switch'\x3e\x3c/span\x3e\x3cspan class\x3d'toggle'\x3e\x3c/span\x3e" + "\x3c/div\x3e" + "\x3c/label\x3e" + "\x3cdiv class\x3d'description'\x3e" + translation.cookies[prop]["description"] + "\x3c/div\x3e" + "\x3c/div\x3e" + "\x3chr\x3e"; | |
| else modalHtmlString = modalHtmlString + | |
| "\x3cdiv class\x3d'ensToggleRow'\x3e" + "\x3clabel for\x3d'" + prop + "Slide' class\x3d'ensToggleLabel'\x3e" + translation.cookies[prop]["title"] + "\x3cdiv class\x3d'card'\x3e" + "\x3cinput class\x3d'ensCheckbox' " + "type\x3d'checkbox' id\x3d'" + prop + "Slide' " + "name\x3d'" + prop + "Slide' " + shouldOptBeChecked(optVals[prop], prop) + "/\x3e" + "\x3cspan class\x3d'switch'\x3e\x3c/span\x3e\x3cspan class\x3d'toggle'\x3e\x3c/span\x3e" + "\x3c/div\x3e" + "\x3c/label\x3e" + "\x3cdiv class\x3d'description'\x3e" + translation.cookies[prop]["description"] + | |
| "\x3c/div\x3e" + "\x3c/div\x3e" + "\x3chr\x3e"; | |
| modalHtmlString = modalHtmlString + "\x3cdiv class\x3d'ensButtons'\x3e" + "\x3cdiv onclick\x3d'gateway.cookieModal.closeModal();' class\x3d'button raised grey'\x3e" + "\x3cdiv class\x3d'ensCenter'\x3e" + translation.cancel + "\x3c/div\x3e" + "\x3cpaper-ripple fit\x3e\x3c/paper-ripple\x3e" + "\x3c/div\x3e" + "\x3cdiv id\x3d'ensSave' class\x3d'button raised blue'\x3e" + "\x3cdiv class\x3d'ensCenter' fit\x3e" + translation.save + "\x3c/div\x3e" + "\x3cpaper-ripple fit\x3e\x3c/paper-ripple\x3e" + | |
| "\x3c/div\x3e" + "\x3c/div\x3e" + "\x3c/div\x3e" | |
| }; | |
| var isEnabledConsentModal = function(env) { | |
| return env && env.hasOwnProperty("enableConsentModal") ? env.enableConsentModal : gatewayData.featureToggles.enableConsentModal | |
| }; | |
| var isShowedTrustedDomains = function(env) { | |
| return env && env.hasOwnProperty("showTrustedDomains") ? env.showTrustedDomains : gatewayData.featureToggles.showTrustedDomains | |
| }; | |
| var addEventListeners = function() { | |
| var saveButton = document.getElementById("ensSave"); | |
| saveButton.addEventListener("click", function() { | |
| saveNewCookieValues(); | |
| updateLists() | |
| }) | |
| }; | |
| var update = function(env) { | |
| if (isEnabledConsentModal(env)) { | |
| setModalHtmlString(env.optVals, env.translation, isShowedTrustedDomains(env)); | |
| e.innerHTML = getModalHtmlString(); | |
| if (document.getElementById("ensModalWrapper") === null) { | |
| var injectModal = function() { | |
| setTimeout(function() { | |
| utilities.addStyleElement(styleString); | |
| document.body.insertBefore(e, document.body.lastChild); | |
| addEventListeners() | |
| }, 100) | |
| }; | |
| utilities.domReady(injectModal) | |
| } else addEventListeners() | |
| } | |
| }; | |
| (function init() { | |
| update(environment) | |
| })(); | |
| return { | |
| closeModal: closeModal, | |
| openModal: openModal, | |
| update: update | |
| } | |
| }; | |
| function ConsentReporter(imageReference, environmentName, modalType, defaultOptions, clientId, clientName, publishPath, mode, cookiesTypes, gatewayVersion, enableReporting, options, nexusDomain, customReporter) { | |
| var beaconCounter = 0, | |
| version = "1.0.0", | |
| nexusURL = "//" + nexusDomain + "/privacy/v1/c/1.gif", | |
| instanceId = ((1 + Math.random()) * 268435456 | 0).toString(36); | |
| this.sendReport = function(oldCookies, newCookies) { | |
| if (!enableReporting) return; | |
| var beaconRootUrl = nexusURL; | |
| var beacon = imageReference; | |
| var encodedBeaconURL = beaconRootUrl + "?" + "n\x3d" + beaconCounter++ + "\x26c\x3d" + clientId + "\x26i\x3d" + instanceId; | |
| if (this.publishPath) encodedBeaconURL += "\x26p\x3d" + encodeURIComponent(this.publishPath); | |
| var settings = { | |
| "modal": modalType, | |
| "environment": environmentName, | |
| "defaults": defaultOptions | |
| }; | |
| var rawBody = this.buildBody(oldCookies, newCookies, settings); | |
| var encodedBody = this.generateReportString(rawBody); | |
| encodedBeaconURL += "\x26d\x3d" + encodedBody; | |
| beacon.src = encodedBeaconURL; | |
| if (typeof customReporter == | |
| "function") this._executeCustomReporter(oldCookies, newCookies); | |
| return encodedBeaconURL | |
| }; | |
| this.generateReportString = function(resources) { | |
| var reportString = JSON.stringify(resources); | |
| return LZString.compressToEncodedURIComponent(reportString) | |
| }; | |
| this.buildBody = function(oldCookies, newCookies, settings) { | |
| var body = { | |
| version: version, | |
| gateway: gatewayVersion, | |
| clientId: clientId, | |
| clientName: clientName, | |
| publishPath: publishPath, | |
| mode: mode, | |
| cookies: cookieManager.getCookiesFromTypes(cookiesTypes.concat(["MODAL_VIEWED", "LOCALE", | |
| "BANNER_VIEWED" | |
| ])), | |
| dt: Date.now(), | |
| settings: settings | |
| }; | |
| body.events = this.buildEvents(oldCookies, newCookies); | |
| return body | |
| }; | |
| this.buildEvents = function(previousCookies, newCookies) { | |
| var events = []; | |
| for (var cookieName in newCookies) | |
| if (previousCookies.hasOwnProperty(cookieName)) { | |
| if (newCookies[cookieName] !== previousCookies[cookieName]) { | |
| var event = this._buildEvent(cookieName, newCookies[cookieName]); | |
| events.push(event) | |
| } | |
| } else { | |
| var event = this._buildEvent(cookieName, newCookies[cookieName]); | |
| events.push(event) | |
| } | |
| return events | |
| }; | |
| this._buildEvent = function(cookieName, value) { | |
| var event = { | |
| "event": "cookieChanged", | |
| "dt": Date.now() | |
| }; | |
| event[utilities.cookieNameToCookieType(clientName, cookieName)] = value; | |
| return event | |
| }; | |
| this._executeCustomReporter = function(oldCookies, newCookies) { | |
| var events = this.buildEvents(oldCookies, newCookies); | |
| for (var index = 0; index < events.length; index++) { | |
| var event = events[index]; | |
| var cookieName = Object.keys(event)[2]; | |
| customReporter(cookieName, event[cookieName]) | |
| } | |
| } | |
| } | |
| var ConsentUIManager = function(gatewayData, environment, businessRulesManager, | |
| listManager, cookieManager, consentReporter) { | |
| var consentModal = null; | |
| var init = function() { | |
| if (businessRulesManager.shouldGetPrivacyModal) { | |
| var translatedPurposeList = listManager.getTranslatedList(); | |
| consentModal = new NoTogglesConsentModal(gatewayData, environment, translatedPurposeList, cookieManager, listManager.updateListValues, consentReporter) | |
| } else if (businessRulesManager.shouldGetEnterpriseModal) consentModal = new CookieModal(cookieManager, listManager.updateListValues, consentReporter, environment, gatewayData); | |
| else consentModal = new CookieModal(cookieManager, listManager.updateListValues, consentReporter, environment, gatewayData) | |
| }, | |
| getConsentModal = function() { | |
| return consentModal | |
| }; | |
| init(); | |
| return { | |
| getConsentModal: getConsentModal | |
| } | |
| }; | |
| var Gateway = function(gatewayData) { | |
| var banner, dataGovernanceManager, businessRulesManager, consentWidget, consentUIManager, environment, environmentManager, cookieDomain, cookieTypes = [], | |
| defaultCategory = "default", | |
| gatewayHasEnvironment, listManager, log = gatewayData.privacyLog = [], | |
| modal = {}, | |
| options, pathFilterManager = | |
| null, | |
| reporter; | |
| gatewayData.featureToggles.enableDataMonitoring = gatewayData.featureToggles.enableDataMonitoring || false; | |
| gatewayData.featureToggles.disableXHRManager = gatewayData.featureToggles.disableXHRManager || false; | |
| modal.openModal = function() { | |
| if (gatewayHasEnvironment === false) throw new Error("Ensighten API Error: No gateway environment found, the modal cannot work without it."); | |
| else throw new Error("Ensighten API Error: You must first register your modal before you can call it. Use Bootstrapper.gateway.setOpenModal to register a function that opens your modal."); | |
| }; | |
| var history = { | |
| before: {}, | |
| complete: {} | |
| }; | |
| var closeBanner = function() { | |
| try { | |
| banner.closeEnsBanner() | |
| } catch (err) { | |
| throw new Error("Ensighten API error: Your banner is not initialized in your client config " + err); | |
| } | |
| }; | |
| options = { | |
| clientName: gatewayData.info.name, | |
| enableFiltering: gatewayData.featureToggles.enableFiltering | |
| }; | |
| function resetEnvironment() { | |
| utilities.deleteCookie(gatewayData.info.name, "LOCALE"); | |
| environmentManager.setEnvironment(); | |
| setEnvironment(environmentManager.getActiveEnvironment()) | |
| } | |
| function allowRequest(req, | |
| testLocation) { | |
| var locationProtocol = testLocation || window.location.protocol; | |
| var url = req.destination, | |
| shouldAllowRequest = true, | |
| hostName = parseURLHost(url), | |
| pathName = parseURLPath(url), | |
| protocol = parseURLProtocol(url); | |
| var SSLCheckPasses = true; | |
| if (gatewayData.featureToggles.requireSSL === true && url !== "") { | |
| SSLCheckPasses = false; | |
| if (locationProtocol === "https:" && protocol === "https:" || locationProtocol === "http:") SSLCheckPasses = true; | |
| if (!SSLCheckPasses) req.addReason("SSL") | |
| } | |
| var targetListCheckPasses = true; | |
| if (gatewayData.featureToggles.enableFiltering && | |
| gatewayHasEnvironment === true) { | |
| targetListCheckPasses = false; | |
| targetListCheckPasses = listManager.allowRequest(hostName, pathName, targetListCheckPasses); | |
| if (!targetListCheckPasses) req.addReason("List") | |
| } | |
| var dataMonitoringCheckPasses = dataGovernanceManager.allowRequest(req, hostName); | |
| if (targetListCheckPasses === false || SSLCheckPasses === false || dataMonitoringCheckPasses === false) shouldAllowRequest = false; | |
| return shouldAllowRequest | |
| } | |
| function updateEnvironment(env) { | |
| setEnvironment(env); | |
| modal.update(env); | |
| banner.update(env); | |
| if (gatewayData.featureToggles.consentWidget) consentWidget.update(env); | |
| listManager.updateEnvironment(env); | |
| dataGovernanceManager.updateEnvironment(env) | |
| } | |
| function getLog() { | |
| if (window.JSON) { | |
| for (var id in history.complete) log.push({ | |
| resource: history.complete[id].request | |
| }); | |
| if (console && console.dir) console.dir(log); | |
| alert(JSON.stringify(log)) | |
| } | |
| } | |
| function historyGarbageCollector() { | |
| for (var id in history.before) { | |
| if (!history.before.hasOwnProperty(id)) continue; | |
| var timeStamp = +new Date; | |
| if (history.before[id].request !== | |
| undefined && timeStamp - history.before[id].request.start > 5E3) { | |
| resourceComplete(history.before.nodeRef, id, "timeout"); | |
| delete history.before[id] | |
| } | |
| } | |
| } | |
| function onBlock(request, node) { | |
| var status = "blocked"; | |
| if (dataGovernanceManager.shouldMaskData(request)) status = "masked"; | |
| if (dataGovernanceManager.shouldRedactData(request)) status = "redact"; | |
| request.end = +new Date; | |
| request.status = status; | |
| history.complete[request.id] = new HistoryEntry(request, node); | |
| resourceComplete(node, request.id, status); | |
| delete history.before[request.id] | |
| } | |
| function modalDomCleanup() { | |
| if (gatewayData.featureToggles.enableConsentModal) { | |
| var domElement = document.getElementById("ensModalWrapper"); | |
| domElement.parentElement.removeChild(domElement) | |
| } | |
| } | |
| function bannerDomCleanup() { | |
| var domElement = document.getElementById("ensNotifyBanner"); | |
| domElement.parentElement.removeChild(domElement) | |
| } | |
| function setOpenModal(clientDefinedOverrideFunction) { | |
| modal.openModal = clientDefinedOverrideFunction; | |
| modalDomCleanup() | |
| } | |
| function setOpenBanner(clientDefinedOverrideFunction) { | |
| banner.openBanner = | |
| clientDefinedOverrideFunction; | |
| bannerDomCleanup() | |
| } | |
| function openBanner() { | |
| try { | |
| banner.openEnsBanner() | |
| } catch (err) { | |
| if (gatewayHasEnvironment === false) throw new Error("Ensighten API Error: No gateway environment found, the banner cannot work without it." + err); | |
| else throw new Error("Ensighten API error: Your banner is not initialzed in your client config " + err); | |
| } | |
| } | |
| function openModal() { | |
| try { | |
| modal.openModal() | |
| } catch (err) { | |
| if (gatewayHasEnvironment === false) throw new Error("Ensighten API Error: No gateway environment found, the modal cannot work without it." + | |
| err); | |
| else throw new Error("Ensighten API error: Your modal is not initialzed in your client config " + err); | |
| } | |
| } | |
| function onBefore(req, node) { | |
| if (!node.__reference) history.before[req.id] = new HistoryEntry(req, node); | |
| return allowRequest(req) | |
| } | |
| function createAnchorElement(url) { | |
| if (url.indexOf("javascript:") !== -1) url = window.location; | |
| var a = Function.prototype.apply.call(gatewayData.ensCreateElement, document, ["a"]); | |
| a.href = url; | |
| return a | |
| } | |
| function parseURLPath(url) { | |
| var a = createAnchorElement(url); | |
| if (utilities.isIE && utilities.ieVersion() && | |
| utilities.ieVersion() < 13) return "/" + a.pathname; | |
| return a.pathname | |
| } | |
| function parseURLHost(url) { | |
| var a = createAnchorElement(url); | |
| var hostname = a.hostname; | |
| if (hostname === "" || hostname === undefined || hostname === null) hostname = location.hostname; | |
| return hostname | |
| } | |
| function parseURLProtocol(url) { | |
| var a = createAnchorElement(url); | |
| var protocol = a.protocol; | |
| if (protocol === "" || protocol === undefined || protocol === null) protocol = location.protocol; | |
| return protocol | |
| } | |
| function resourceComplete(node, id, status) { | |
| id = id || node.__gateway; | |
| var before = | |
| history.before[id]; | |
| if (!before) return false; | |
| var request = before.request; | |
| request.end = +new Date; | |
| request.status = status; | |
| history.complete[id] = new HistoryEntry(request, node); | |
| ensLogger.consoleLog("resourceComplete: ", status, ": ", request); | |
| reporter.addResource(request); | |
| delete history.before[id] | |
| } | |
| function setEnvironment(env) { | |
| environment = env | |
| } | |
| function getVersion() { | |
| return ensGatewayVersion.version | |
| } | |
| var consentCookies = { | |
| getCookie: function(cookieType) { | |
| return cookieManager.getCookie(cookieType) | |
| }, | |
| setCookie: function(cookieType, | |
| value) { | |
| var clientName = gatewayData.info.name; | |
| var oldCookies = cookieManager.getCookiesFromTypes([cookieType]); | |
| cookieManager.setCookie(cookieType, value); | |
| var newCookies = cookieManager.getCookiesFromTypes([cookieType]); | |
| if (consentReporter !== null) consentReporter.sendReport(oldCookies, newCookies); | |
| if (gatewayData.featureToggles.enableConsentModal) modal.update(environment) | |
| }, | |
| setCookies: function(cookies) { | |
| var cookieTypes = []; | |
| for (var key in cookies) cookieTypes.push(key); | |
| var oldCookies = cookieManager.getCookiesFromTypes(cookieTypes); | |
| cookieManager.setCookies(cookies); | |
| var newCookies = cookieManager.getCookiesFromTypes(cookieTypes); | |
| if (consentReporter !== null) consentReporter.sendReport(oldCookies, newCookies); | |
| if (gatewayData.featureToggles.enableConsentModal) modal.update(environment) | |
| }, | |
| getCookieTypes: function() { | |
| return cookieTypes | |
| }, | |
| calculateCookieDomain: function(domain) { | |
| return cookieManager.calculateCookieDomain(domain) | |
| }, | |
| setCookieDomain: function(newCookieDomain) { | |
| cookieManager.setCookieDomain(newCookieDomain) | |
| }, | |
| getCookieDomain: function() { | |
| return cookieManager.getCookieDomain() | |
| } | |
| }; | |
| var enableGateway = true; | |
| var isInitialized = false; | |
| var init = function() { | |
| cookieManager = new CookieManager(gatewayData.info.name, gatewayData.getCookie, gatewayData.setCookie); | |
| businessRulesManager = new BusinessRulesManager(gatewayData); | |
| environmentManager = new EnvironmentManager(document, gatewayData.environmentConfigs, gatewayData.defaultEnv, gatewayData.info.name, cookieManager); | |
| if (gatewayData.featureToggles.enableEnvironmentMatching === true && environmentManager.getActiveEnvironment() === null) { | |
| enableGateway = false; | |
| return | |
| } | |
| setEnvironment(environmentManager.getActiveEnvironment()); | |
| environmentManager.registerEnvironmentChangeCallback(updateEnvironment); | |
| listManager = new ListManager(environment, gatewayData, defaultCategory, cookieManager); | |
| environmentManager.registerEnvironmentChangeCallback(listManager.updateListValues); | |
| dataGovernanceManager = new DataGovernanceManager(gatewayData.featureToggles.enableDataMonitoring, gatewayData.dataMonitoring, environment); | |
| if (environment) { | |
| gatewayHasEnvironment = true; | |
| consentReporter = new ConsentReporter(new window.Image, | |
| environment.name || "", gatewayData.libraryPackage, environment.optVals, gatewayData.info.clientId, gatewayData.info.name, gatewayData.info.publishPath, listManager.getUsesWhitelist() ? "whitelist" : "blacklist", gatewayData.cookieTypes, getVersion(), gatewayData.featureToggles.enableReporting, options, gatewayData.info.nexus || "nexus.ensighten.com", gatewayData.onConsent); | |
| cookieTypes = gatewayData.cookieTypes || function() { | |
| var result = []; | |
| for (var key in whitelist) | |
| if (key !== defaultCategory) result.push(key); | |
| return result | |
| }(); | |
| consentUIManager = new ConsentUIManager(gatewayData, environment, businessRulesManager, listManager, cookieManager, consentReporter); | |
| modal = consentUIManager.getConsentModal(); | |
| banner = new Banner(gatewayData, environment, modal, cookieManager); | |
| if (gatewayData.featureToggles.consentWidget) consentWidget = new ConsentWidget(environment, gatewayData) | |
| } else gatewayHasEnvironment = false; | |
| var options = null; | |
| var reportingFilterRegex = null; | |
| if (gatewayData.featureToggles.enableAllowedDomainsReporting === false) reportingFilterRegex = listManager.getAlwaysAllowedListRegex(); | |
| reporter = new Reporter(window.Image, gatewayData.info.clientId, gatewayData.info.publishPath, listManager.getUsesWhitelist(), getVersion(), gatewayData.featureToggles.enableReporting, {}, gatewayData.info.nexus || "nexus.ensighten.com", reportingFilterRegex); | |
| reporter.setCookies(getPrivacyCookies()); | |
| log.push({ | |
| location: window.location.href || null | |
| }); | |
| log.push({ | |
| cookie: document.cookie || null | |
| }); | |
| if (!options) options = { | |
| enableFiltering: false, | |
| enableObserving: true | |
| }; | |
| new MutationObserverFactory; | |
| if (gatewayData.featureToggles.disableXHRManager === | |
| false) new XhrManager; | |
| elementObserver(); | |
| writeObserver(); | |
| writeLnObserver(); | |
| setInterval(historyGarbageCollector, 250); | |
| gatewayConfig.unbound.script = document.all && !document.addEventListener; | |
| isInitialized = true | |
| }(); | |
| if (!enableGateway) { | |
| isInitialized = false; | |
| return { | |
| isInitialized: isInitialized | |
| } | |
| } | |
| function getPrivacyCookies() { | |
| var cookies = {}; | |
| function cookieHelper(key) { | |
| var cookieVal = consentCookies.getCookie(key); | |
| if (cookieVal !== undefined) cookies[key] = cookieVal | |
| } | |
| var types = consentCookies.getCookieTypes(); | |
| for (var i = 0; i < types.length; i++) cookieHelper(types[i]); | |
| cookieHelper("MODAL_VIEWED"); | |
| cookieHelper("BANNER_VIEWED"); | |
| cookieHelper("LOCALE"); | |
| return cookies | |
| } | |
| var allowTag = function(tag) { | |
| if (validateTag(tag) && localStorage) { | |
| var ALLOWED_KEY = listManager.ALLOWED_KEY; | |
| var BLOCKED_KEY = listManager.BLOCKED_KEY; | |
| var allowedURLS = localStorage.getItem(ALLOWED_KEY) ? JSON.parse(localStorage.getItem(ALLOWED_KEY)) : []; | |
| if (!allowedURLS.includes(JSON.stringify(tag))) { | |
| allowedURLS.push(tag); | |
| localStorage.setItem(ALLOWED_KEY, JSON.stringify(allowedURLS)) | |
| } | |
| var blockedURLS = localStorage.getItem(BLOCKED_KEY) ? | |
| JSON.parse(localStorage.getItem(BLOCKED_KEY)) : []; | |
| blockedURLS = blockedURLS.filter(function(element) { | |
| return JSON.stringify(element) !== JSON.stringify(tag) | |
| }); | |
| localStorage.setItem(BLOCKED_KEY, JSON.stringify(blockedURLS)); | |
| listManager.updateListValues(); | |
| return tag | |
| } | |
| return Error("invalid tag") | |
| }; | |
| var blockTag = function(tag) { | |
| if (validateTag(tag) && localStorage) { | |
| var BLOCKED_KEY = listManager.BLOCKED_KEY; | |
| var ALLOWED_KEY = listManager.ALLOWED_KEY; | |
| var blockedURLS = localStorage.getItem(BLOCKED_KEY) ? JSON.parse(localStorage.getItem(BLOCKED_KEY)) : []; | |
| if (!blockedURLS.includes(JSON.stringify(tag))) { | |
| blockedURLS.push(tag); | |
| localStorage.setItem(BLOCKED_KEY, JSON.stringify(blockedURLS)) | |
| } | |
| var allowedURLS = localStorage.getItem(ALLOWED_KEY) ? JSON.parse(localStorage.getItem(ALLOWED_KEY)) : []; | |
| allowedURLS = allowedURLS.filter(function(element) { | |
| return JSON.stringify(element) !== JSON.stringify(tag) | |
| }); | |
| localStorage.setItem(ALLOWED_KEY, JSON.stringify(allowedURLS)); | |
| listManager.updateListValues(); | |
| return tag | |
| } | |
| return Error("invalid tag") | |
| }; | |
| var getList = function() { | |
| var tagList = | |
| listManager.getList(); | |
| if (localStorage) { | |
| var BLOCKED_KEY = listManager.BLOCKED_KEY; | |
| var ALLOWED_KEY = listManager.ALLOWED_KEY; | |
| tagList["CUSTOM_ALLOW"] = localStorage.getItem(ALLOWED_KEY) ? JSON.parse(localStorage.getItem(ALLOWED_KEY)) : []; | |
| tagList["CUSTOM_BLOCK"] = localStorage.getItem(BLOCKED_KEY) ? JSON.parse(localStorage.getItem(BLOCKED_KEY)) : [] | |
| } | |
| return tagList | |
| }; | |
| var clearTags = function() { | |
| localStorage.setItem(listManager.ALLOWED_KEY, ""); | |
| localStorage.setItem(listManager.BLOCKED_KEY, ""); | |
| listManager.updateListValues() | |
| }; | |
| function validateTag(tag) { | |
| return tag && tag.tag | |
| } | |
| testElements = { | |
| allowRequest: allowRequest, | |
| parseURLPath: parseURLPath, | |
| parseURLHost: parseURLHost | |
| }; | |
| return { | |
| isInitialized: isInitialized, | |
| cookieModal: modal, | |
| consentCookies: consentCookies, | |
| closeBanner: closeBanner, | |
| dataGovernanceManager: dataGovernanceManager, | |
| environment: environment, | |
| environmentManager: environmentManager, | |
| getLog: getLog, | |
| getList: getList, | |
| getVersion: getVersion, | |
| history: history, | |
| allowTag: allowTag, | |
| blockTag: blockTag, | |
| clearTags: clearTags, | |
| historyGarbageCollector: historyGarbageCollector, | |
| modal: modal, | |
| onBefore: onBefore, | |
| onBlock: onBlock, | |
| openBanner: openBanner, | |
| openModal: openModal, | |
| options: options, | |
| reporter: reporter, | |
| resourceComplete: resourceComplete, | |
| resetEnvironment: resetEnvironment, | |
| setOpenModal: setOpenModal, | |
| setOpenBanner: setOpenBanner, | |
| updatePreferences: listManager.updateListValues, | |
| testElements: testElements | |
| } | |
| }; | |
| var HistoryEntry = function() { | |
| function HistoryEntry(request, node) { | |
| this.request = request; | |
| this.nodeRef = node | |
| } | |
| return HistoryEntry | |
| }(); | |
| var Request = function() { | |
| function Request(destination) { | |
| this.destination = | |
| destination || ""; | |
| this.type = null; | |
| this.start = +new Date; | |
| this.end = -1; | |
| this.source = null; | |
| this.status = null; | |
| this.reasons = [] | |
| } | |
| Request.prototype.addReason = function(reason) { | |
| this.reasons.push(reason) | |
| }; | |
| Request.prototype.hasReason = function(reason) { | |
| if (this.reasons.length > 0) return (new RegExp(this.reasons.join("|"))).test(reason); | |
| return false | |
| }; | |
| Request.prototype.numReasons = function() { | |
| return this.reasons.length | |
| }; | |
| return Request | |
| }(); | |
| ensLogger = function() { | |
| var consoleLoggingEnabled = false, | |
| checkForConsoleLoggingParam = function() { | |
| var hash, | |
| queryStringObject = {}; | |
| var hashes = window.location.href.slice(window.location.href.indexOf("?") + 1).split("\x26"); | |
| for (var i = 0; i < hashes.length; i++) { | |
| hash = hashes[i].split("\x3d"); | |
| queryStringObject[hash[0]] = hash[1] | |
| } | |
| if (queryStringObject["ensLogger"] && queryStringObject["ensLogger"] === "true") enableConsoleLogging() | |
| }, | |
| disableConsoleLogging = function() { | |
| setConsoleLoggingState(false) | |
| }, | |
| enableConsoleLogging = function() { | |
| setConsoleLoggingState(true) | |
| }, | |
| getConsoleLoggingState = function() { | |
| return consoleLoggingEnabled | |
| }, | |
| init = | |
| function() { | |
| checkForConsoleLoggingParam() | |
| }, | |
| consoleLog = function() { | |
| if (consoleLoggingEnabled && window.console) console.log(arguments) | |
| }, | |
| setConsoleLoggingState = function(state) { | |
| consoleLoggingEnabled = state | |
| }; | |
| init(); | |
| return { | |
| disableConsoleLogging: disableConsoleLogging, | |
| enableConsoleLogging: enableConsoleLogging, | |
| getConsoleLoggingState: getConsoleLoggingState, | |
| consoleLog: consoleLog | |
| } | |
| }(); | |
| var ensGatewayVersion = ensGatewayVersion || {}; | |
| ensGatewayVersion["version"] = "2.1.176"; | |
| if (document.elementFromPoint && !utilities.isIE8OrLower()) { | |
| ensBrowserSupported = | |
| true; | |
| if (typeof Bootstrapper === "undefined") Bootstrapper = {}; | |
| if (Bootstrapper.hasOwnProperty("privacy") && typeof Bootstrapper.privacy.onBeforeInit === "function") Bootstrapper.privacy.onBeforeInit(ensClientConfig); | |
| gateway = new Gateway(ensClientConfig); | |
| if (gateway.isInitialized) Bootstrapper.gateway = { | |
| closeBanner: gateway.closeBanner, | |
| environment: gateway.environment, | |
| environmentExists: gateway.environmentManager.environmentExists, | |
| getActiveEnvironment: gateway.environmentManager.getActiveEnvironment, | |
| getActiveLocale: gateway.environmentManager.getActiveLocale, | |
| getAvailableLocales: gateway.environmentManager.getAvailableLocales, | |
| getCookie: gateway.consentCookies.getCookie, | |
| getCookieTypes: gateway.consentCookies.getCookieTypes, | |
| getVersion: gateway.getVersion, | |
| openBanner: gateway.openBanner, | |
| openModal: gateway.openModal, | |
| registerEnvironmentChangeCallback: gateway.environmentManager.registerEnvironmentChangeCallback, | |
| getList: gateway.getList, | |
| resetEnvironment: gateway.resetEnvironment, | |
| setCookie: gateway.consentCookies.setCookie, | |
| setCookies: gateway.consentCookies.setCookies, | |
| setCookieDomain: gateway.consentCookies.setCookieDomain, | |
| setEnvironment: gateway.environmentManager.setEnvironment, | |
| setOpenModal: gateway.setOpenModal, | |
| setOpenBanner: gateway.setOpenBanner, | |
| updatePreferences: gateway.updatePreferences, | |
| allowTag: gateway.allowTag, | |
| blockTag: gateway.blockTag, | |
| clearTags: gateway.clearTags | |
| }; | |
| else Bootstrapper.gateway = {} | |
| } else ensBrowserSupported = false; | |
| if (!ensBrowserSupported && ensClientConfig.browserNotSupportedURL && ensClientConfig.browserNotSupportedURL !== "") window.location = ensClientConfig.browserNotSupportedURL; | |
| var privacyEnd | |
| }, 2693771, [2697112], | |
| 544087, [544086]); | |
| Bootstrapper.getServerComponent(Bootstrapper.getExtraParams ? Bootstrapper.getExtraParams() : undefined); | |
| } | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment