1(function () { 2 var card = document.querySelector(".subscription-offer-card"); 3 if (!card) return; 4 var slot = document.createElement("div"); 5 slot.className = "subscription-offer-placeholder"; 6 slot.hidden = true; 7 card.before(slot); 8 var pinned = false, scheduled = false; 9 function update() { 10 scheduled = false; 11 // Match the subscription page's single-column mobile layout. 12 if (window.matchMedia("(max-width: 900px)").matches) { 13 card.classList.remove("is-pinned"); 14 slot.hidden = true; 15 pinned = false; 16 return; 17 } 18 var header = document.querySelector(".app-header"); 19 var top = Math.max(0, header ? header.getBoundingClientRect().bottom : 0) + 12; 20 var anchor = (pinned ? slot : card).getBoundingClientRect(); 21 if (anchor.top < top) { 22 if (!pinned) { 23 var style = getComputedStyle(card); 24 slot.style.gridColumn = style.gridColumn; 25 slot.style.gridRow = style.gridRow; 26 slot.style.order = style.order; 27 slot.style.height = card.offsetHeight + "px"; 28 slot.style.width = anchor.width + "px"; 29 slot.hidden = false; 30 pinned = true; 31 card.classList.add("is-pinned"); 32 } 33 card.style.setProperty("--offer-max-height", Math.max(0, window.innerHeight - top - 12) + "px"); 34 card.style.setProperty("--offer-width", anchor.width + "px"); 35 var benefits = document.querySelector(".subscription-benefit-grid"); 36 var stopTop = benefits ? benefits.getBoundingClientRect().bottom - card.offsetHeight : top; 37 card.style.setProperty("--offer-top", Math.min(top, stopTop) + "px"); 38 card.style.setProperty("--offer-left", anchor.left + "px"); 39 card.style.setProperty("--offer-width", anchor.width + "px"); 40 } else if (pinned) { 41 card.classList.remove("is-pinned"); slot.hidden = true; pinned = false; 42 } 43 } 44 function schedule() { if (!scheduled) { scheduled = true; requestAnimationFrame(update); } } 45 window.addEventListener("scroll", schedule, { passive: true }); 46 window.addEventListener("resize", function () { 47 card.classList.remove("is-pinned"); slot.hidden = true; pinned = false; schedule(); 48 }); 49 window.addEventListener("load", schedule); 50 schedule(); 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.