1/* global window */ 2(function (w) { 3 'use strict'; 4 5 const 6 7 document = w.document, 8 9 debounce = (fn, delay) => { 10 let timer = null; 11 return function () { 12 const 13 context = this, 14 args = arguments 15 ; 16 w.clearTimeout(timer); 17 timer = w.setTimeout( 18 () => { 19 fn.apply(context, args); 20 }, 21 delay 22 ); 23 }; 24 }, 25 26 handleScroll = () => { 27 const pageOffset = document.documentElement.scrollTop || document.body.scrollTop; 28 document.querySelectorAll('#back-to-top-button').forEach((button) => { 29 button.classList.toggle('visible', pageOffset >= 100); 30 }); 31 }, 32 33 run = () => { 34 handleScroll(); 35 w.addEventListener( 36 'scroll', 37 () => { 38 debounce( 39 () => { 40 handleScroll(); 41 }, 42 100 43 )(); 44 } 45 ); 46 }, 47 48 init = () => { 49 if (['complete', 'interactive'].includes(document.readyState)) { 50 run(); 51 } else { 52 document.addEventListener('DOMContentLoaded', run); 53 } 54 }; 55 init(); 56})(window);
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.