1export function initializePDStickyBottomBar() { 2 const ctaWrapper = document.querySelector(".pd-cta__wrapper"); 3 const bottomBar = document.querySelector(".pd-bottom-bar"); 4 5 if (!ctaWrapper || !bottomBar) return; 6 7 let ctaWrapperPassed = false; 8 let lastExecution = 0; 9 10 function throttle(func, limit) { 11 return function () { 12 const now = Date.now(); 13 if (now - lastExecution >= limit) { 14 func(); 15 lastExecution = now; 16 } 17 }; 18 } 19 20 function checkScroll() { 21 const ctaRect = ctaWrapper.getBoundingClientRect(); 22 const windowHeight = window.innerHeight; 23 const documentHeight = document.documentElement.scrollHeight; 24 const scrollPosition = window.scrollY + windowHeight; 25 const tolerance = 100; 26 27 if (ctaRect.top <= windowHeight && !ctaWrapperPassed) { 28 ctaWrapperPassed = true; 29 } 30 31 // Zobrazit lištu, když jsme pod CTA, ale ne na konci stránky 32 let showBar = 33 ctaWrapperPassed && 34 ctaRect.bottom <= 0 && 35 scrollPosition < documentHeight - tolerance; 36 bottomBar.classList.toggle("pd-bottom-bar--is-visible", showBar); 37 } 38 39 const throttledCheckScroll = throttle(checkScroll, 16); 40 41 window.addEventListener("scroll", throttledCheckScroll); 42 checkScroll(); // Initial check 43}
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.