1// back to top js 2function isHidden() { 3 let scrollTop = document.documentElement.scrollTop || document.body.scrollTop 4 if (scrollTop > 0) { 5 document.querySelector(".back-to-top").className = "back-to-top"; 6 } else { 7 document.querySelector(".back-to-top").className = "back-to-top hidden"; 8 } 9} 10 11const backToTop = () => { 12 let scrollTop = 13 document.documentElement.scrollTop || document.body.scrollTop, 14 delay = 10, 15 time = 200; 16 let step = Math.ceil(scrollTop * delay / time); 17 let timer = setInterval(() => { 18 scrollTop = 19 document.documentElement.scrollTop || document.body.scrollTop; 20 if (scrollTop - step <= 0) { 21 document.documentElement.scrollTop = 0; 22 document.body.scrollTop = 0; 23 clearInterval(timer); 24 } else { 25 document.documentElement.scrollTop = scrollTop - step; 26 document.body.scrollTop = scrollTop - step; 27 } 28 }, delay); 29} 30 31isHidden() 32document.addEventListener("scroll", isHidden, false); 33document.querySelector(".back-to-top").addEventListener("click", backToTop, false);
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.