1document.addEventListener("DOMContentLoaded", function () { 2 3 const STORAGE_KEY = "persistQuery"; 4 5 if (location.search) { 6 7 const current = new URLSearchParams(location.search); 8 const utm = new URLSearchParams(); 9 10 current.forEach((v, k) => { 11 if ( 12 k.startsWith("utm_") || 13 k === "autm_id" || 14 k === "gclid" || 15 k === "fbclid" 16 ) { 17 utm.set(k, v); 18 } 19 }); 20 21 if (utm.toString()) { 22 sessionStorage.setItem(STORAGE_KEY, utm.toString()); 23 } 24 25 } else { 26 sessionStorage.removeItem(STORAGE_KEY); 27 return; 28 } 29 30 const saved = sessionStorage.getItem(STORAGE_KEY); 31 if (!saved) return; 32 33 document.querySelectorAll("a[href]").forEach(function(link){ 34 35 let href = link.getAttribute("href"); 36 37 if( 38 !href || 39 href.startsWith("#") || 40 href.startsWith("javascript:") || 41 href.startsWith("mailto:") || 42 href.startsWith("tel:") 43 ){ 44 return; 45 } 46 47 const url = new URL(href, location.origin); 48 49 const params = new URLSearchParams(saved); 50 51 params.forEach((v,k)=>{ 52 if(!url.searchParams.has(k)){ 53 url.searchParams.set(k,v); 54 } 55 }); 56 57 link.href = url.pathname + "?" + url.searchParams.toString(); 58 }); 59 60});
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.