1 2window.addEventListener("load", function() { 3 4 // Check if the cookie is set 5 var hideSiteAlert = getSiteAlertCookie('hideSiteAlert'); 6 7 // If set hide the siteAlert (hidden by default) 8 if (hideSiteAlert == "") { 9 var element = document.getElementById("siteAlert"); 10 element.classList.remove("siteAlertHide"); 11 } 12 13 // jQuery is loaded (use it for animation on close) 14 if (window.jQuery) { 15 // Using pure js to set cookie and using jquery 16 // to slide and close site alert 17 window.jQuery("#siteAlertClose").click(function() { 18 setSiteAlertCookie(); 19 20 // hide site alert 21 window.jQuery('#siteAlert').slideUp(500); 22 }); 23 24 // jQuery is not loaded 25 } else { 26 27 // Using pure js to set cookie and close site alert 28 document.getElementById("siteAlertClose").addEventListener("click", function() { 29 setSiteAlertCookie(); 30 31 // hide site alert 32 var element = document.getElementById("siteAlert"); 33 element.classList.add("siteAlertHide"); 34 }); 35 36 } 37}); 38 39function setSiteAlertCookie() { 40 // set cookie to expire 1 day from now 41 var date = new Date(); 42 date.setTime(date.getTime() + (1 * 24 * 60 * 60 * 1000)); 43 44 document.cookie = "hideSiteAlert=true; expires="+date.toGMTString()+"; path=/"; 45 document.cookie = "hideSiteAlert=true; expires="+date.toGMTString()+"; path=/"; 46} 47 48function getSiteAlertCookie(cname) { 49 var name = cname + "="; 50 var decodedCookie = decodeURIComponent(document.cookie); 51 var ca = decodedCookie.split(';'); 52 for(var i = 0; i <ca.length; i++) { 53 var c = ca[i]; 54 while (c.charAt(0) == ' ') { 55 c = c.substring(1); 56 } 57 if (c.indexOf(name) == 0) { 58 return c.substring(name.length, c.length); 59 } 60 } 61 return ""; 62}
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.