1const initParallax = (id,sf = 0.5,debug = false) => { 2 let wrapper = document.querySelector('[data-dzm-parallax-wrapper="'+id+'"]'); 3 let scrollFactor = sf; 4 let img = wrapper.querySelector('[data-dzm-parallax-img]'); 5 if(img === null) 6 return; 7 let viewHeight = window.visualViewport.height; 8 let docHeight = document.body.offsetHeight; 9 let scrollMax = docHeight-viewHeight; 10 /* happens sometimes, when script loads too quick in prefetch mode */ 11 if(scrollMax < 0){scrollMax = viewHeight;} 12 let wRect = wrapper.getBoundingClientRect(); 13 let wTop = wRect.top; 14 let wBottom = wRect.bottom; 15 let wTopMax = Math.max(0,wTop-scrollMax+window.scrollY); 16 let wBottomMin = Math.min(viewHeight, wBottom+window.scrollY); 17 let innerDist = wBottomMin-wTopMax - wrapper.offsetHeight; 18 let imgHeight = innerDist*scrollFactor+wrapper.offsetHeight; 19 img.style.height = imgHeight + 'px'; 20 let ty = ((-wRect.top+wTopMax)*scrollFactor); 21 img.style.transform = 'translate(-50%,'+ty+'px)'; 22 img.style.opacity = 1; 23 window.addEventListener('scroll',()=>{ 24 let cRect = wrapper.getBoundingClientRect(); 25 let ty = ((-cRect.top+wTopMax)*scrollFactor); 26 img.style.transform = 'translate(-50%,'+ty+'px)'; 27 },{ 28 passive: true 29 }); 30 window.addEventListener('resize',()=>{ 31 let cRect = wrapper.getBoundingClientRect(); 32 let ty = ((-cRect.top+wTopMax)*scrollFactor); 33 img.style.transform = 'translate(-50%,'+ty+'px)'; 34 }); 35 36} 37
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.