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