1 function getCookieDate(){ 2 3 let date = new Date(Date.now() + 365*86400e3); 4 date = date.toUTCString(); 5 6 return date; 7 } 8 9 function getCookie(name) { 10 let matches = document.cookie.match(new RegExp( 11 "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)" 12 )); 13 return matches ? decodeURIComponent(matches[1]) : undefined; 14 } 15 16 function setCookie(name, value, options = {}) { 17 18 options = Object.assign({path: '/',}, options); 19 20 21 if (options.expires instanceof Date) { 22 options.expires = options.expires.toUTCString(); 23 } 24 25 let updatedCookie = encodeURIComponent(name) + "=" + encodeURIComponent(value); 26 27 for (let optionKey in options) { 28 updatedCookie += "; " + optionKey; 29 let optionValue = options[optionKey]; 30 if (optionValue !== true) { 31 updatedCookie += "=" + optionValue; 32 } 33 } 34 35 document.cookie = updatedCookie; 36 } 37 38 function deleteCookie(name) { 39 setCookie(name, "", { 40 'max-age': -1 41 }) 42 }
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.