1(function () { 2 3 function getCookie(name) { 4 const value = `; ${document.cookie}`; 5 const parts = value.split(`; ${name}=`); 6 if (parts.length === 2) return parts.pop().split(';').shift(); 7 } 8 9 function getLocalStorage(key) { 10 try { 11 return localStorage.getItem(key); 12 } catch (e) { 13 return null; 14 } 15 } 16 17 function setLocalStorage(key, val) { 18 try { 19 localStorage.setItem(key, val); 20 } catch (e) { 21 } 22 } 23 24 const cookieName = 'ag'; 25 const currentUrl = new URL(window.location.href); 26 27 let agValue = currentUrl.searchParams.get(cookieName); 28 if (!agValue) { 29 agValue = getCookie(cookieName); 30 } 31 if (!agValue) { 32 agValue = getLocalStorage(cookieName); 33 } 34 35 if (agValue) { 36 if (getLocalStorage(cookieName) !== agValue) { 37 setLocalStorage(cookieName, agValue); 38 } 39 40 if (currentUrl.searchParams.get(cookieName) !== agValue) { 41 currentUrl.searchParams.set(cookieName, agValue); 42 window.history.replaceState(null, '', currentUrl.toString()); 43 } 44 } 45})();
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.