1class AltimaxCookie { 2 static readCookie(name) { 3 let nameEQ = name + "="; 4 let ca = document.cookie.split(';'); 5 for (let i = 0; i < ca.length; i++) { 6 let c = ca[i]; 7 while (c.charAt(0) == ' ') c = c.substring(1, c.length); 8 if (c.indexOf(nameEQ) == 0) { 9 let value = decodeURI(c.substring(nameEQ.length, c.length)) 10 return (value && value != null && value != 'null') ? value : false; 11 } 12 } 13 return false; 14 }; 15 16 static writeCookie(cname, cvalue, exhours) { 17 let d = new Date(); 18 d.setTime(d.getTime() + (exhours * 60 * 60 * 1000)); 19 let expires = "expires=" + d.toUTCString(); 20 document.cookie = cname + "=" + encodeURI(cvalue) + ";" + expires + ";path=/"; 21 }; 22 23 static removeCookieItem(cookie, item) { 24 if (this.inArray(item, cookie)) { 25 let index = cookie.indexOf(item); 26 if (index > -1) 27 cookie.splice(index, 1); 28 } 29 30 return cookie; 31 } 32 33 static addCookieItem(cookie, item) { 34 if (!this.inArray(item, cookie)) { 35 if (cookie.indexOf('null') > -1) 36 this.removeCookieItem(cookie, 'null'); 37 cookie.push(String(item)); 38 } 39 40 return cookie; 41 } 42 43 static inArray(needle, haystack) { 44 let length = haystack.length; 45 for (let i = 0; i < length; i++) { 46 if (haystack[i] == needle) 47 return true; 48 } 49 50 return false; 51 } 52}
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.