1var header, headerShouldAnimate, body, headerHeight, headerFixed, headerAttVal, offsetVal; 2 3function removeClass(element, className) { 4 element && (element.className = element.className.replace(new RegExp(className, 'g'), '')); 5} 6 7function addClass(element, className) { 8 element && element.classList.add(className); 9} 10 11function VariableInit(e) { 12 var data = e && e.detail; 13 header = document.querySelector('[data-element-type="topbandSection"]'); //NO I18N 14 if (data) { 15 headerAttVal = data.onscrollingEffect; 16 } else { 17 headerAttVal = header && header.getAttribute('data-onscrollingeffect-type').trim(); 18 } 19 headerShouldAnimate = (headerAttVal === 'floating' || headerAttVal === 'transparent'); //NO I18N 20 body = document.getElementsByTagName('body')[0]; 21} 22 23document.addEventListener('DOMContentLoaded', function (event) { 24 if (!body) { 25 VariableInit(); 26 } 27 28 if (!header) { 29 return; 30 } 31 if (document.documentElement.clientWidth > 992) { 32 headerHeight = header.clientHeight; 33 offsetVal = window.scrollY; 34 if (offsetVal > headerHeight && headerShouldAnimate) { 35 addClass(header, 'theme-topband-animate'); //NO I18N 36 if (headerAttVal === 'transparent') { 37 addClass(header, 'theme-topband-transparent'); //NO I18N 38 } 39 } 40 headerFixed = header.classList.contains('theme-topband-animate'); //NO I18N 41 headerHeight = header.clientHeight; 42 if (headerFixed == true) { 43 body.style.paddingTop = headerHeight + 'px'; //NO I18N 44 } 45 } 46}); 47 48window.addEventListener('resize', function (event) { 49 if (!header) { 50 return; 51 } 52 headerHeight = header.clientHeight; 53 if (document.documentElement.clientWidth > 992) { 54 offsetVal = window.scrollY; 55 if (offsetVal > headerHeight && headerFixed == true) { 56 body.style.paddingTop = headerHeight + 'px'; //NO I18N 57 } 58 } else { 59 if (headerFixed == true) { 60 body.style.paddingTop = '0px'; //NO I18N 61 } 62 } 63}); 64 65window.addEventListener('scroll', function (event) { 66 if (!body) { 67 VariableInit(); 68 } 69 if (!header) { 70 return; 71 } 72 if (document.documentElement.clientWidth > 992) { 73 offsetVal = window.scrollY; 74 headerFixed = header.classList.contains('theme-topband-animate'); //NO I18N 75 if (offsetVal > headerHeight) { 76 if (!headerFixed && headerShouldAnimate) { 77 addClass(header, 'theme-topband-animate'); //NO I18N 78 if (headerAttVal === 'transparent') { 79 addClass(header, 'theme-topband-transparent'); //NO I18N 80 } 81 } 82 if (headerFixed == false && headerShouldAnimate) { 83 body.style.paddingTop = headerHeight + 'px'; //NO I18N 84 } 85 } else if (offsetVal == 0) { 86 if (header.classList.contains('theme-topband-animate')) { 87 removeClass(header, 'theme-topband-animate'); //NO I18N 88 if (headerAttVal === 'transparent') { 89 removeClass(header, 'theme-topband-transparent'); //NO I18N 90 } 91 body.style.paddingTop = '0px'; //NO I18N 92 } 93 } 94 } 95}); 96 97document.addEventListener('canvas:topbandOnScrollEffectChanged', VariableInit); 98 99
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.