1var body = document.body; 2var mtv_header_scroll = 0; 3var scrollUp = "mtv-scrolling-up"; 4var scrollDown = "mtv-scrolling-down"; 5var lastScroll = 0; 6var element = document.getElementById('site-header'); 7var height = element.clientHeight; 8var headerTransparency = document.body.getAttribute('data-transparent'); 9if (headerTransparency == 'transparent') { 10 var main_content = document.getElementById('content'); 11 main_content.style.marginTop = -element.clientHeight + 'px'; 12 document.body.style.opacity = 1; 13} 14 15window.addEventListener("scroll", () => { 16 clearTimeout(mtv_header_scroll); 17 mtv_header_scroll = setTimeout(mtv_sticky_header(), 300); 18}); 19 20function mtv_sticky_header() { 21 var scrollDistanceFromBottom = document.body.offsetHeight - (window.pageYOffset + window.innerHeight); 22 var currentScroll = window.pageYOffset; 23 if (currentScroll <= height) { 24 body.classList.remove(scrollUp); 25 body.classList.remove(scrollDown); 26 document.body.style.marginTop = '0px'; 27 return; 28 } 29 30 if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) { 31 body.classList.remove(scrollUp); 32 body.classList.add(scrollDown); 33 document.body.style.marginTop = '0px'; 34 return; 35 } 36 37 38 if (currentScroll > lastScroll && !body.classList.contains(scrollDown)) { 39 // down 40 body.classList.remove(scrollUp); 41 body.classList.add(scrollDown); 42 document.body.style.marginTop = '0px'; 43 44 } else if ( 45 currentScroll < lastScroll && 46 body.classList.contains(scrollDown) 47 ) { 48 // up 49 if (scrollDistanceFromBottom > 200) { 50 body.classList.remove(scrollDown); 51 body.classList.add(scrollUp); 52 document.body.style.marginTop = height + 'px'; 53 } 54 } 55 56 lastScroll = currentScroll; 57}
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.