1const getMembershipStatus = () => { 2 const jwtCookie = decodeURIComponent(document.cookie) 3 .split(/\s*;\s*/) 4 .filter(c => c.match(/^jwt=/)); 5 6 if ("AppSettings" in window && window.AppSettings.premium) { 7 return "premium"; 8 } else if (jwtCookie.length) { 9 return "registered"; 10 } 11 12 return "guest"; 13}; 14 15const addSlot = ({ id, sizes, target, minSize, maxSize }) => { 16 if (!streamlineData.adTarget) { 17 console.log("No ad target set in enviorment"); 18 return; 19 } 20 21 let notRendered = true; 22 let slot; 23 const params = new URLSearchParams(window.location.search); 24 const debug = params.get("streamline-debug") !== null; 25 26 const render = () => { 27 const windowSize = window.innerWidth; 28 const activeViewportSize = windowSize >= minSize && windowSize < maxSize; 29 30 if (activeViewportSize && notRendered) { 31 googletag.cmd.push(() => { 32 const urlArray = window.location.pathname 33 .split("/") 34 .filter(Boolean) 35 .map(part => part.substring(0, 40)); 36 37 slot = googletag 38 .defineSlot(streamlineData.adTarget, sizes, `${id}`) 39 .setTargeting("membership", getMembershipStatus()) 40 .setTargeting("url", urlArray) 41 .setTargeting("pos", [target]) 42 .setTargeting("tags", streamlineData.tags || []) 43 .setTargeting("categories", streamlineData.categories || []) 44 .addService(googletag.pubads()); 45 notRendered = false; 46 googletag.enableServices(); 47 }); 48 googletag.cmd.push(() => { 49 googletag.display(`${id}`); 50 }); 51 } else if (!notRendered && slot && !activeViewportSize) { 52 googletag.cmd.push(() => { 53 googletag.destroySlots([slot]); 54 let adContainer = document.getElementById(`${id}`); 55 if (adContainer) { 56 let adLabel = adContainer.previousSibling; 57 adContainer.parentNode.style.height = ""; 58 if (adLabel && adLabel.innerHTML === "ANNONS") { 59 adLabel.remove(); 60 } 61 } 62 }); 63 notRendered = true; 64 } 65 66 if (debug && notRendered && activeViewportSize) { 67 const emptySlotContainer = document.createElement("div"); 68 emptySlotContainer.classList.add("empty-slot"); 69 emptySlotContainer.innerHTML = id; 70 document.getElementById(`${id}`).append(emptySlotContainer); 71 } 72 }; 73 74 render(); 75 76 window.addEventListener("resize", () => { 77 render(); 78 }); 79};
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.