1document.addEventListener('DOMContentLoaded', function () { 2 const banner = document.getElementById('cookie-banner'); 3 const acceptBtn = document.getElementById('cookie-accept-btn'); 4 const rejectBtn = document.getElementById('cookie-reject-btn'); 5 const resetBtn = document.getElementById('reset-cookie-btn'); 6 7 const consent = localStorage.getItem('cookieConsent'); 8 if (consent === 'accepted' || consent === 'rejected') { 9 banner.style.display = 'none'; 10 if (resetBtn) resetBtn.style.display = 'block'; 11 } else { 12 banner.style.display = 'flex'; 13 if (resetBtn) resetBtn.style.display = 'none'; 14 } 15 16 function setConsent(value) { 17 localStorage.setItem('cookieConsent', value); 18 document.cookie = "cookieConsent=" + value + "; path=/; SameSite=Lax"; 19 banner.style.display = 'none'; 20 } 21 22 acceptBtn.addEventListener('click', function () { 23 setConsent('accepted'); 24 loadOptionalScripts(); 25 }); 26 27 rejectBtn.addEventListener('click', function () { 28 setConsent('rejected'); 29 document.cookie.split(';').forEach(cookie => { 30 const name = cookie.trim().split('=')[0]; 31 if (!['cookieConsent', 'PHPSESSID', '__cflb'].includes(name)) { 32 document.cookie = name + '=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/;'; 33 } 34 if (name.startsWith('sparrow')) { 35 document.cookie = name + '=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/;'; 36 } 37 }); 38 }); 39 40 function loadOptionalScripts() { 41 const script = document.createElement('script'); 42 script.async = true; 43 document.head.appendChild(script); 44 45 window.dataLayer = window.dataLayer || []; 46 function gtag() { dataLayer.push(arguments); } 47 gtag('js', new Date()); 48 } 49 50 if (consent === 'accepted') { 51 loadOptionalScripts(); 52 } 53 }); 54 55 function resetConsent() { 56 localStorage.removeItem('cookieConsent'); 57 document.cookie = "cookieConsent=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/;"; 58 location.reload(); 59 }
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.