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