1const head = document.getElementsByTagName("head")[0]; 2const html = document.getElementsByTagName("html")[0]; 3const body = document.getElementsByTagName("body")[0]; 4const navToggleButton = document.querySelector('button[data-action="Header#toggleMenu"]'); 5const headerHolder = document.querySelector(".header__container"); 6const headerOverlay = document.querySelector(".header__overlay"); 7const headerNavbar = document.querySelector(".header__navbar"); 8const dropdowns = document.querySelectorAll('[data-controller="Dropdown"]'); 9const mobileMenuCategoryButtons = document.querySelectorAll(".m-mega__toggle-btn"); 10const scrollToTopButtons = document.querySelectorAll('button[data-action="ScrollTo#scrollTo"]'); 11const brandings = document.querySelectorAll(".branding__bg "); 12 13const stickyAdsCloseButtons = document.querySelectorAll(".ad-div--sticky button"); 14 15var scrollState = ""; 16 17const isMobile = window.matchMedia("(max-width: 749px)").matches; 18 19document.addEventListener("DOMContentLoaded", () => { 20 head.appendChild(scrollbarCompensateStyle()); 21 setScrollState(); 22 setMenuMaxHeight(); 23 24 window.addEventListener("scroll", setScrollState); 25 26 if (navToggleButton) { 27 navToggleButton.addEventListener("click", () => { 28 setMenuMaxHeight(); 29 html.classList.toggle("compensate-for-scrollbar"); 30 headerHolder.classList.toggle("compensate-for-scrollbar");
31 brandings.forEach((branding) => { 32 branding.classList.toggle("compensate-for-scrollbar"); 33 }); 34 if (body.getAttribute("data-header-menu-state") === "opened") { 35 body.removeAttribute("data-header-menu-state"); 36 } else { 37 body.setAttribute("data-header-menu-state", "opened"); 38 } 39 }); 40 } 41 42 dropdowns.forEach((dropdown) => { 43 dropdown.addEventListener("click", () => { 44 dropdown.classList.toggle("is-open"); 45 }); 46 }); 47 48 mobileMenuCategoryButtons.forEach((button) => { 49 button.addEventListener("click", () => { 50 button.parentElement.parentElement.classList.toggle("is-toggled"); 51 }); 52 }); 53 54 scrollToTopButtons.forEach((button) => { 55 button.addEventListener("click", () => { 56 let target = document.querySelector(button.getAttribute("data-scrollto-target")); 57 target.scrollIntoView({ behavior: "smooth" }); 58 }); 59 }); 60 61 stickyAdsCloseButtons.forEach((button) => { 62 button.addEventListener("click", () => { 63 button.parentElement.remove(); 64 }); 65 }); 66 67 if (!isMobile) { 68 var s = document.createElement("script"); 69 s.async = true; 70 s.src = "https://cdn.performax.cz/yi/adsbypx/px_autoads.js"; 71 72 var css = document.createElement("link"); 73 css.rel = "stylesheet"; 74 css.href = "https://cdn.performax.cz/yi/adsbypx/px_autoads.css"; 75 76 head.appendChild(s); 77 // head.appendChild(css); 78 } 79}); 80 81const getScrollbarWidth = () => { 82 const box = document.createElement("div"); 83 const { style } = box; 84 let width; 85 86 style.position = "absolute"; 87 style.top = style.left = "-9999px"; 88 style.width = style.height = "100px"; 89 style.overflow = "scroll"; 90 91 body.appendChild(box); 92 93 width = box.offsetWidth - box.clientWidth; 94 95 box.parentNode.removeChild(box); 96 97 return width; 98}; 99 100const scrollbarCompensateStyle = () => { 101 const style = document.createElement("style"); 102 103 style.type = "text/css"; 104 style.innerHTML = ` 105 .compensate-for-scrollbar {
106 margin-right: ${getScrollbarWidth()}px; 107 } 108`; 109 110 return style; 111}; 112 113function setMenuMaxHeight() { 114 if (scrollState == "expanded") { 115 headerOverlay.style.height = `${window.innerHeight - headerHolder.offsetHeight}px`; 116 } else if (scrollState == "collapsed") { 117 headerOverlay.style.height = `${window.innerHeight - headerNavbar.offsetHeight}px`; 118 } 119} 120 121function setScrollState() { 122 const { scrollTop } = document.documentElement; 123 scrollState = scrollTop > 88 ? "collapsed" : "expanded"; 124 if (scrollTop > 88) { 125 body.classList.add("is-scrolled"); 126 body.setAttribute("data-header-state", "collapsed"); 127 } else { 128 body.classList.remove("is-scrolled"); 129 body.removeAttribute("data-header-state"); 130 } 131} 132 133// var intervalBrandingHeightCheck = window.setInterval(function () { 134// let layoutBranding = document.querySelector(".layout__branding"); 135// if (!layoutBranding){ 136// return; 137// } 138// let brandingBg = layoutBranding.querySelector(".branding__bg"); 139 140// if (brandingBg.children.length > 0) { 141// let brandingHeigh = brandingBg.children[0].offsetHeight; 142// layoutBranding.style.height = `${brandingHeigh + 10}px`; 143// } 144// }, 500);
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.