1let next_cta_nav_executed = !1; 2function next_cta_nav() { 3 if (next_cta_nav_executed) { 4 return; 5 } 6 document.querySelectorAll(".next-cta-nav").forEach((ctaNav) => { 7 const offsetTop = parseFloat(ctaNav.getAttribute("data-offset")); 8 const cta = ctaNav.querySelector(".next-cta-nav__cta"); 9 const nav = ctaNav.querySelector(".next-cta-nav__nav"); 10 let ctaWidth, navWidth, ctaHeight, navHeight; 11 let triggerPosition; 12 let flow = ctaNav._nbCtaFlow || null; 13 14 function ensureFlow() { 15 if (!flow) { 16 flow = document.createElement("div"); 17 flow.className = "next-cta-nav__flow"; 18 flow.setAttribute("aria-hidden", "true"); 19 ctaNav._nbCtaFlow = flow; 20 } 21 return flow; 22 } 23 24 function reserveFlow() { 25 const spacer = ensureFlow(); 26 const rect = ctaNav.getBoundingClientRect(); 27 const cs = getComputedStyle(ctaNav); 28 spacer.style.height = rect.height + "px"; 29 spacer.style.width = rect.width + "px"; 30 spacer.style.marginTop = cs.marginTop; 31 spacer.style.marginRight = cs.marginRight; 32 spacer.style.marginBottom = cs.marginBottom; 33 spacer.style.marginLeft = cs.marginLeft; 34 if (spacer.parentNode !== ctaNav.parentNode) { 35 ctaNav.parentNode.insertBefore(spacer, ctaNav); 36 } 37 } 38 39 function releaseFlow() { 40 if (flow && flow.parentNode) { 41 flow.parentNode.removeChild(flow); 42 } 43 } 44 45 function calcDimensions() { 46 cta.style.display = "flex"; 47 nav.style.display = "flex"; 48 nav.style.position = "absolute"; 49 nav.style.visibility = "hidden"; 50 nav.style.width = "auto"; 51 ctaNav.offsetHeight; 52 requestAnimationFrame(() => { 53 const navRect = nav.getBoundingClientRect(); 54 const navChildren = Array.from(nav.children); 55 let maxNavWidth = navRect.width; 56 navChildren.forEach((child) => { 57 const childRect = child.getBoundingClientRect(); 58 maxNavWidth = Math.max(maxNavWidth, childRect.right - navRect.left); 59 }); 60 ctaWidth = cta.getBoundingClientRect().width; 61 navWidth = maxNavWidth; 62 ctaHeight = cta.getBoundingClientRect().height; 63 navHeight = navRect.height; 64 nav.style.position = ""; 65 nav.style.visibility = ""; 66 nav.style.width = ""; 67 cta.style.display = ""; 68 nav.style.display = ""; 69 navWidth += 2; 70 updateContainerDimensions(); 71 if (flow && flow.parentNode) { 72 flow.style.width = ctaWidth + "px"; 73 flow.style.height = ctaHeight + "px"; 74 } 75 const anchor = flow && flow.parentNode ? flow : ctaNav; 76 const rect = anchor.getBoundingClientRect(); 77 const scrollTop = window.pageYOffset || document.documentElement.scrollTop; 78 triggerPosition = rect.top + scrollTop; 79 }); 80 } 81 function updateContainerDimensions() { 82 if (ctaNav.classList.contains("next-cta-nav--stick")) { 83 ctaNav.style.width = `${navWidth}px`; 84 ctaNav.style.height = `${navHeight}px`; 85 } else { 86 ctaNav.style.width = `${ctaWidth}px`; 87 ctaNav.style.height = `${ctaHeight}px`; 88 } 89 } 90 function updateButtonVisibility() { 91 const scrollPosition = window.pageYOffset || document.documentElement.scrollTop; 92 const containerRect = ctaNav.getBoundingClientRect(); 93 if (containerRect.top <= offsetTop && detectScrollDirection() === "down") { 94 if (!ctaNav.classList.contains("next-cta-nav--stick")) { 95 reserveFlow(); 96 ctaNav.classList.add("next-cta-nav--stick"); 97 requestAnimationFrame(() => { 98 ctaNav.style.width = `${navWidth}px`; 99 ctaNav.style.height = `${navHeight}px`; 100 }); 101 } 102 } else if (scrollPosition <= triggerPosition) { 103 if (ctaNav.classList.contains("next-cta-nav--stick")) { 104 ctaNav.classList.remove("next-cta-nav--stick"); 105 releaseFlow(); 106 requestAnimationFrame(() => { 107 ctaNav.style.width = `${ctaWidth}px`; 108 ctaNav.style.height = `${ctaHeight}px`; 109 }); 110 } 111 } 112 } 113 calcDimensions(); 114 let resizeTimeout; 115 window.addEventListener("resize", () => { 116 clearTimeout(resizeTimeout); 117 resizeTimeout = setTimeout(calcDimensions, 250); 118 }); 119 window.addEventListener("orientationchange", () => { 120 setTimeout(calcDimensions, 100); 121 }); 122 let scrollTimeout; 123 window.addEventListener("scroll", () => { 124 if (!scrollTimeout) { 125 scrollTimeout = setTimeout(() => { 126 updateButtonVisibility(); 127 scrollTimeout = null; 128 }, 10); 129 } 130 }); 131 }); 132 let lastScrollTop = 0; 133 function detectScrollDirection() { 134 const currentScroll = window.pageYOffset || document.documentElement.scrollTop; 135 const direction = currentScroll > lastScrollTop ? "down" : "up"; 136 lastScrollTop = currentScroll; 137 return direction; 138 } 139 next_cta_nav_executed = !0; 140} 141document.addEventListener("DOMContentLoaded", function () { 142 if (typeof bricksIsFrontend !== "undefined" && bricksIsFrontend) { 143 document.fonts.ready.then(() => { 144 setTimeout(next_cta_nav, 100); 145 }); 146 } 147});
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.