1 2 // ================================================================ 3 // [Page Load] Check if cookies are set and enable tracking 4 // ================================================================ 5 6 // Run disabled scripts 7 function tfInjectScriptsCheck(selector, target, position) { 8 document.querySelectorAll(selector).forEach(function(s) { 9 var newScript = document.createElement('script'); 10 newScript.innerHTML = s.innerHTML; 11 Array.from(s.attributes).forEach(function(attr) { 12 if (attr.name !== 'type' && attr.name !== 'data-tf-cookiecode') { 13 newScript.setAttribute(attr.name, attr.value); 14 } 15 }); 16 if (position === 'top') { 17 target.prepend(newScript); 18 } else { 19 target.appendChild(newScript); 20 } 21 s.remove(); 22 }); 23 } 24 25 // Set cookies - Analytics 26 const tfCookieStatus_pageload = Cookies.get('tf_cookie_consent'); 27 if(tfCookieStatus_pageload === 'all' || tfCookieStatus_pageload === 'analytics'){ 28 tfInjectScriptsCheck('script[type="text/plain"][data-tf-cookiecode="header-analytics"]', document.head); 29 tfInjectScriptsCheck('script[type="text/plain"][data-tf-cookiecode="body-analytics"]', document.body,'top'); 30 tfInjectScriptsCheck('script[type="text/plain"][data-tf-cookiecode="footer-analytics"]', document.body); 31 } 32 33 // Set cookies - Marketing 34 if(tfCookieStatus_pageload === 'all' || tfCookieStatus_pageload === 'marketing'){ 35 tfInjectScriptsCheck('script[type="text/plain"][data-tf-cookiecode="header-marketing"]', document.head); 36 tfInjectScriptsCheck('script[type="text/plain"][data-tf-cookiecode="body-marketing"]', document.body,'top'); 37 tfInjectScriptsCheck('script[type="text/plain"][data-tf-cookiecode="footer-marketing"]', document.body); 38 }
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.