1(function () { 2 "use strict"; 3 4 function initButton() { 5 var buttonPath = document.querySelector('.smooth-back-to-top-button path, .smooth-back-to-top-button rect'); 6 7 if (!buttonPath) { 8 return; 9 } 10 11 var pathLength = buttonPath.getTotalLength(); 12 13 buttonPath.style.strokeDasharray = pathLength + ' ' + pathLength; 14 buttonPath.style.strokeDashoffset = pathLength; 15 16 var isTicking = false; 17 18 var updateButtonProgress = function () { 19 var scroll = window.scrollY; 20 var height = document.documentElement.scrollHeight - window.innerHeight; 21 22 // Calculate progress, handling division by zero if page is smaller than viewport 23 var progress = height > 0 ? pathLength - (scroll * pathLength / height) : pathLength; 24 25 buttonPath.style.strokeDashoffset = progress; 26 isTicking = false; 27 }; 28 29 var onScroll = function () { 30 if (!isTicking) { 31 window.requestAnimationFrame(updateButtonProgress); 32 isTicking = true; 33 } 34 }; 35 36 updateButtonProgress(); 37 38 // Use passive listener for better scroll performance on mobile 39 window.addEventListener('scroll', onScroll, { passive: true }); 40 } 41 42 if (document.readyState === 'loading') { 43 document.addEventListener('DOMContentLoaded', initButton); 44 } else { 45 initButton(); 46 } 47})();
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.