1 2(function () { 3 "use strict"; 4 5 var cookieAlert = document.querySelector(".cookiealert"); 6 var acceptCookies = document.querySelector(".acceptcookies"); 7 8 if (!cookieAlert) { 9 return; 10 } 11 12 cookieAlert.offsetHeight; // Force browser to trigger reflow (https://stackoverflow.com/a/39451131) 13 14 // Show the alert if we cant find the "acceptCookies" cookie 15 if (!getCookie("acceptCookies")) { 16 cookieAlert.classList.add("show"); 17 } 18 19 // When clicking on the agree button, create a 1 year 20 // cookie to remember user's choice and close the banner 21 acceptCookies.addEventListener("click", function () { 22 setCookie("acceptCookies", true, 365); 23 cookieAlert.classList.remove("show"); 24 25 // dispatch the accept event 26 window.dispatchEvent(new Event("cookieAlertAccept")) 27 }); 28 29 // Cookie functions from w3schools 30 function setCookie(cname, cvalue, exdays) { 31 var d = new Date(); 32 d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); 33 var expires = "expires=" + d.toUTCString(); 34 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 35 } 36 37 function getCookie(cname) { 38 var name = cname + "="; 39 var decodedCookie = decodeURIComponent(document.cookie); 40 var ca = decodedCookie.split(';'); 41 for (var i = 0; i < ca.length; i++) { 42 var c = ca[i]; 43 while (c.charAt(0) === ' ') { 44 c = c.substring(1); 45 } 46 if (c.indexOf(name) === 0) { 47 return c.substring(name.length, c.length); 48 } 49 } 50 return ""; 51 } 52})();
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.