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 // dispatch the accept event 30 window.dispatchEvent(new Event("cookieAlertAccept")) 31 }); 32 33 // Cookie functions from w3schools 34 function setCookie(cname, cvalue, exdays) { 35 var d = new Date(); 36 d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); 37 var expires = "expires=" + d.toUTCString(); 38 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 39 } 40 41 function getCookie(cname) { 42 var name = cname + "="; 43 var decodedCookie = decodeURIComponent(document.cookie); 44 var ca = decodedCookie.split(';'); 45 for (var i = 0; i < ca.length; i++) { 46 var c = ca[i]; 47 while (c.charAt(0) === ' ') { 48 c = c.substring(1); 49 } 50 if (c.indexOf(name) === 0) { 51 return c.substring(name.length, c.length); 52 } 53 } 54 return ""; 55 } 56})();
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.