1// Consent class 2let ConsentApp = new function ConsentController() { 3 //-- global variables --- 4 window.dataLayer = window.dataLayer || []; 5 6 //--- public functions --- 7 /** 8 * Callback function for GoogleTagManager Script to fire the dataLayer trigger 9 * @param bool state 10 * @param object service 11 */ 12 this.consentChanged = function (state, service) { 13 if (state === true) { 14 if (service.name.indexOf('google-tagmanager-service') !== -1) { 15 let tempObj = { 16 event: service.gtm.trigger 17 }; 18 tempObj[service.gtm.variable] = true; 19 window.dataLayer.push(tempObj); 20 21 /* 22 //ES6 - https://stackoverflow.com/questions/11508463/javascript-set-object-key-by-variable 23 window.dataLayer.push({ 24 event: service.name, 25 [service.name]: true 26 }); 27 */ 28 } 29 } 30 31 //Check if the own callback function is allready defined 32 if (typeof window[service.ownCallback] === "function") { 33 window[service.ownCallback](state, service); 34 } else if (service.ownCallback !== '') { 35 console.error('The Callback function ' + service.ownCallback + ' is not yet defined. Please create it first.'); 36 } 37 }; 38 39 //--- constructor --- 40 (function contruct() { 41 $(document).ready(function () { 42 //Listener for the button on the privacy page, to edit the consent 43 $(document).on('click', '.js-showConsentModal', function (event) { 44 event.preventDefault(); 45 klaro.show(); 46 }); 47 }); 48 })(); 49};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.