1 // Function to set a cookie 2 function setCookie(cookieName, cookieValue, expirationDays) { 3 const date = new Date(); 4 date.setTime(date.getTime() + (expirationDays * 24 * 60 * 60 * 1000)); 5 const expires = "expires=" + date.toUTCString(); 6 document.cookie = cookieName + "=" + cookieValue + ";" + expires + ";path=/"; 7 } 8 9 // Function to check if a cookie is set 10 function getCookie(cookieName) { 11 const name = cookieName + "="; 12 const cookieArray = document.cookie.split(';'); 13 for (let i = 0; i < cookieArray.length; i++) { 14 let cookie = cookieArray[i]; 15 while (cookie.charAt(0) === ' ') { 16 cookie = cookie.substring(1); 17 } 18 if (cookie.indexOf(name) === 0) { 19 return cookie.substring(name.length, cookie.length); 20 } 21 } 22 return ""; 23 } 24 25 // Function to show or hide the cookie banner 26 function showOrHideCookieBanner() { 27 const cookieBanner = document.querySelector(".cookieban"); 28 29 if (getCookie("cookieConsent") !== "accepted") { 30 cookieBanner.style.display = "block"; 31 } else { 32 cookieBanner.style.display = "none"; 33 } 34 } 35 36 // Check if the user has already accepted the cookie when the page loads 37 window.addEventListener("load", function() { 38 showOrHideCookieBanner(); 39 40 const acceptButton = document.querySelector(".cookieban__box__btn"); 41 42 // Add event listener to the accept button 43 acceptButton.addEventListener("click", function () { 44 // Set the cookie and hide the banner 45 setCookie("cookieConsent", "accepted", 30); // Cookie expires in 30 days 46 showOrHideCookieBanner(); 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.