1import { addMartechStack } from './delayed.js'; 2 3const createOptanonWrapper = () => { 4 const script = document.createElement('script'); 5 script.type = 'text/javascript'; 6 script.textContent = 'function OptanonWrapper() { }'; 7 document.head.append(script); 8}; 9 10const createSatTrack = () => { 11 const script = document.createElement('script'); 12 script.type = 'text/javascript'; 13 script.innerHTML = `const getCookie = (sName) => { 14 const sValue = "; " + document.cookie; 15 const aParts = sValue.split("; " + sName + "="); 16 if (aParts.length === 2) return aParts.pop().split(";").shift(); 17 }; 18 19 const satTrackHandler = () => { 20 const sSatTrackCookie = getCookie('sat_track'); 21 22 if (typeof sSatTrackCookie !== 'undefined') { 23 return; 24 } 25 26 // list of geos where only strictly necessary cookies are allowed 27 const aSNGeos = ["GB", "BE", "IE", "FR", "RU", "ES", "IT", "DE", "AT", "CH"]; 28 if (aSNGeos.indexOf(window.otUserLocation) !== -1) { 29 document.cookie = "sat_track=false;path=/;secure;max-age=31536000;SameSite=Strict"; 30 } 31 else { 32 document.cookie = "sat_track=true;path=/;secure;max-age=31536000;SameSite=Strict"; 33 } 34 console.log("creating sat_track"); 35 }; 36 satTrackHandler();`; 37 38 document.head.append(script); 39}; 40 41const loadGeoScript = () => { 42 createOptanonWrapper(); 43 createSatTrack(); 44 45 const jsonFeed = (locationJson) => { 46 window.otUserLocation = locationJson.country; 47 addMartechStack(); 48 }; 49 50 const origin = window.location.origin.toLowerCase(); 51 if (origin.indexOf('.cn') > 1 || origin.indexOf('.cdnsvc') > 1) { 52 window.otUserLocation = 'CN'; 53 } else { 54 const geolink = '//geolocation.onetrust.com/'; 55 const link1 = document.createElement('link'); 56 link1.setAttribute('rel', 'preconnect'); 57 link1.setAttribute('href', geolink); 58 link1.setAttribute('crossorigin', ''); 59 document.head.appendChild(link1); 60 61 const link2 = document.createElement('link'); 62 link2.setAttribute('rel', 'dns-prefetch'); 63 link2.setAttribute('href', geolink); 64 document.head.appendChild(link2); 65 66 const geolink2 = 'https://geolocation.onetrust.com/cookieconsentpub/v1/geo/location'; 67 68 fetch(geolink2, { 69 headers: { 70 Accept: 'application/json', 71 }, 72 }) 73 .then((response) => response.json()) 74 .then((geo) => jsonFeed(geo)); 75 } 76}; 77 78loadGeoScript();
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.