1document.addEventListener('DOMContentLoaded', () => { 2 const SCROLL_OFFSET = 3000; 3 const scrollTop = document.querySelector('._scroll-top'); 4 scrollTop.addEventListener('click', () => { 5 document.body.scrollTop = 0; 6 document.documentElement.scrollTop = 0; 7 }) 8 window.addEventListener('scroll', () => { 9 if (document.body.scrollTop > SCROLL_OFFSET || document.documentElement.scrollTop > SCROLL_OFFSET) { 10 scrollTop.classList.add('_active') 11 document.documentElement.classList.add('_has-scroll'); 12 } else { 13 scrollTop.classList.remove('_active') 14 document.documentElement.classList.remove('_has-scroll'); 15 } 16 }) 17 18 // ÐÑÑоÑа ÑÑÑеÑа-клона в css-пеÑеменной --footer-clone-height на <html> 19 let frame = null; 20 const setFooterHeight = () => { 21 const clone = document.querySelector('.i-footer_clone'); 22 document.documentElement.style.setProperty('--footer-clone-height', `${clone ? clone.offsetHeight : 0}px`); 23 }; 24 const updateFooterHeight = () => { 25 if (frame !== null) return; 26 frame = requestAnimationFrame(() => { 27 frame = null; 28 setFooterHeight(); 29 }); 30 }; 31 const observeFooterClone = () => { 32 const clone = document.querySelector('.i-footer_clone'); 33 if (!clone) return false; 34 if (window.ResizeObserver) { 35 new ResizeObserver(updateFooterHeight).observe(clone); 36 } 37 return true; 38 }; 39 40 setFooterHeight(); 41 window.addEventListener('resize', updateFooterHeight); 42 43 // клон Ð¿Ð¾Ð¿Ð°Ð´Ð°ÐµÑ Ð² body ÑолÑко поÑле "показаÑÑ ÐµÑÑ" 44 if (!observeFooterClone()) { 45 const watcher = new MutationObserver(() => { 46 if (!observeFooterClone()) return; 47 watcher.disconnect(); 48 updateFooterHeight(); 49 }); 50 watcher.observe(document.body, { childList: true, subtree: true }); 51 } 52})
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.