1// Create Cookie Function 2function setCookie(cname, cvalue, exdays) { 3 var d = new Date(); 4 d.setTime(d.getTime() + (exdays*24*60*60*1000)); 5 var expires = "expires="+ d.toUTCString(); 6 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 7} 8// Get Cookie Function 9function getCookie(cname) { 10 var name = cname + "="; 11 var decodedCookie = decodeURIComponent(document.cookie); 12 var ca = decodedCookie.split(';'); 13 for(var i = 0; i <ca.length; i++) { 14 var c = ca[i]; 15 while (c.charAt(0) == ' ') { 16 c = c.substring(1); 17 } 18 if (c.indexOf(name) == 0) { 19 return c.substring(name.length, c.length); 20 } 21 } 22 return ""; 23} 24 25var cookieOpt = getCookie('cookieOptOut'); 26console.log('Cookie Opt: ' + cookieOpt); 27 28 29$(document).ready(function(){ 30 if (cookieOpt == 'true'){ 31 $('#cookiesSwitch').prop('checked', false); 32 } 33// Set cookie switch 34 $('#cookiesSwitch').change(function(){ 35 if($('#cookiesSwitch').prop('checked') == true){ 36 // Set Opt out cookie to false 37 setCookie('cookieOptOut','fal
37se','0'); 38 location.reload(); 39 } else { 40 // Set Opt out cookie to true 41 setCookie('cookieOptOut','true','365'); 42 location.reload(); 43 } 44 }); 45 46});
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.