1(function ($) { 2 window["cozyBlockScrollTopInit"] = (e) => { 3 const n = e.replace(/-/gi, "_"); 4 const scrollTopClass = `#cozyBlock_${n}`; 5 const cozyScrollTop = document.querySelector(scrollTopClass); 6 7 let scrollTimeout; 8 let isHovered = false; 9 10 function scrollFunction() { 11 if ( 12 document.body.scrollTop > 10 || 13 document.documentElement.scrollTop > 10 14 ) { 15 cozyScrollTop.classList.add("visibility-visible"); 16 cozyScrollTop.classList.remove("visibility-hidden"); 17 } else { 18 cozyScrollTop.classList.add("visibility-hidden"); 19 cozyScrollTop.classList.remove("visibility-visible"); 20 } 21 } 22 23 function handleScroll() { 24 // Run while scrolling 25 scrollFunction(); 26 27 // Clear previous timeout 28 clearTimeout(scrollTimeout); 29 30 // Set new timeout (fires when scrolling has stopped for 150ms) 31 scrollTimeout = setTimeout(() => { 32 if (!isHovered) { 33 cozyScrollTop.classList.add("visibility-hidden"); 34 cozyScrollTop.classList.remove("visibility-visible"); 35 } 36 // you can call another function here 37 }, 3000); 38 } 39 40 // attach listener 41 window.addEventListener("scroll", handleScroll); 42 43 // hover listeners 44 cozyScrollTop.addEventListener("mouseenter", () => { 45 isHovered = true; 46 }); 47 48 cozyScrollTop.addEventListener("mouseleave", () => { 49 isHovered = false; 50 handleScroll(); 51 }); 52 53 cozyScrollTop.addEventListener("click", function () { 54 jQuery("html, body").animate({ scrollTop: 0 }, 600); 55 return false; 56 }); 57 }; 58})(jQuery);
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.