1window.onload = function () { 2 const cookieNotification = document.getElementById('cookie-notification'); 3 const acceptCookiesButton = document.getElementById('accept-cookies'); 4 const rejectAllCookiesButton = document.getElementById('reject-all-cookies'); 5 6 // Check if the user has previously accepted cookies 7 const hasAcceptedCookies = getCookie('accept_cookies'); 8 9 // Check if the user has previously rejected cookies 10 const hasRejectedCookies = getCookie('reject_cookies'); 11 12 // Determine whether to show the notification 13 if (!hasAcceptedCookies && !hasRejectedCookies) { 14 // Cookie not set, show the notification 15 cookieNotification.style.display = 'block'; 16 } 17 18 acceptCookiesButton.addEventListener('click', function () { 19 // Set a cookie to remember the user's acceptance for 30 days 20 setCookie('accept_cookies', 'true', 30); 21 22 // Hide the notification 23 cookieNotification.style.display = 'none'; 24 }); 25 26 rejectAllCookiesButton.addEventListener('click', function () { 27 // Remove all existing cookies 28 removeAllCookies(); 29 30 // Set a cookie to remember the user's rejection for 30 days 31 setCookie('reject_cookies', 'true', 30); 32 33 // Hide the notification 34 cookieNotification.style.display = 'none'; 35 }); 36 37 // Helper function to set a cookie 38 function setCookie(name, value, days) { 39 const date = new Date(); 40 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 41 const expires = 'expires=' + date.toUTCString(); 42 document.cookie = name + '=' + value + '; ' + expires + '; path=/'; 43 } 44 45 // Helper function to get a cookie by name 46 function getCookie(name) { 47 const cookies = document.cookie.split(';'); 48 for (let i = 0; i < cookies.length; i++) { 49 const cookie = cookies[i].trim(); 50 if (cookie.startsWith(name + '=')) { 51 return cookie.substring(name.length + 1); 52 } 53 } 54 return ''; 55 } 56 57 // Helper function to remove all cookies 58 function removeAllCookies() { 59 const cookies = document.cookie.split(';'); 60 for (let i = 0; i < cookies.length; i++) { 61 const cookie = cookies[i].trim(); 62 const cookieName = cookie.split('=')[0]; 63 removeCookie(cookieName); 64 } 65 } 66 67 // Helper function to remove a cookie by name 68 function removeCookie(name) { 69 document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/'; 70 } 71};
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.