1(function () { 2 var header = document.querySelector('[data-mgd-header]'); 3 if (!header) return; 4 var lastY = window.scrollY; 5 var threshold = 80; 6 var delta = 6; 7 var ticking = false; 8 function update() { 9 var y = window.scrollY; 10 header.classList.toggle('is-scrolled', y > 20); 11 var menuOpen = header.classList.contains('is-menu-open') || 12 document.body.classList.contains('mgd-menu-open'); 13 if (!menuOpen && Math.abs(y - lastY) > delta) { 14 if (y > lastY && y > threshold) { 15 header.classList.add('is-hidden'); 16 } else { 17 header.classList.remove('is-hidden'); 18 } 19 lastY = y; 20 } 21 ticking = false; 22 } 23 window.addEventListener('scroll', function () { 24 if (!ticking) { requestAnimationFrame(update); ticking = true; } 25 }, { passive: true }); 26 update(); 27})(); 28 29(function () { 30 var header = document.querySelector('[data-mgd-header]'); 31 if (!header) return; 32 function setPad() { 33 document.body.style.paddingTop = header.offsetHeight + 'px'; 34 } 35 setPad(); 36 window.addEventListener('resize', setPad, { passive: true }); 37 setTimeout(setPad, 300); 38 setTimeout(setPad, 1000); 39})(); 40 41(function () { 42 var btn = document.querySelector('[data-mgd-hamburger]'); 43 var menu = document.querySelector('[data-mgd-mobile-menu]'); 44 var header = document.querySelector('[data-mgd-header]'); 45 if (!btn || !menu) return; 46 47 48 if (menu.parentNode !== document.body) { 49 document.body.appendChild(menu); 50 } 51 52 function setOpen(open) { 53 btn.classList.toggle('is-open', open); 54 menu.classList.toggle('is-open', open); 55 if (header) { 56 header.classList.toggle('is-menu-open', open); 57 header.classList.remove('is-hidden'); 58 } 59 btn.setAttribute('aria-expanded', open ? 'true' : 'false'); 60 menu.setAttribute('aria-hidden', open ? 'false' : 'true'); 61 document.body.classList.toggle('mgd-menu-open', open); 62 } 63 64 btn.addEventListener('click', function () { 65 setOpen(!btn.classList.contains('is-open')); 66 }); 67 68 69 menu.addEventListener('click', function (e) { 70 if (e.target.closest('[data-mgd-menu-close]')) { setOpen(false); return; } 71 var a = e.target.closest('a'); 72 if (a && !a.closest('.mgd-m-sub-toggle')) setOpen(false); 73 }); 74 75 76 document.addEventListener('keydown', function (e) { 77 if ((e.key === 'Escape' || e.key === 'Esc') && menu.classList.contains('is-open')) { 78 setOpen(false); 79 } 80 }); 81})(); 82 83(function () { 84 var toggles = document.querySelectorAll('[data-mgd-submenu-toggle]'); 85 toggles.forEach(function (t) { 86 t.addEventListener('click', function () { 87 var sub = t.nextElementSibling; 88 if (!sub) return; 89 t.classList.toggle('is-open'); 90 sub.classList.toggle('is-open'); 91 }); 92 }); 93})(); 94 95(function () { 96 if (typeof IntersectionObserver === 'undefined') { 97 document.documentElement.classList.add('no-mg-io'); 98 return; 99 } 100 var initialized = false; 101 var io = new IntersectionObserver(function (entries) { 102 entries.forEach(function (e) { 103 if (!e.isIntersecting) return; 104 if (e.target.classList.contains('mg-anim')) { io.unobserve(e.target); return; } 105 e.target.classList.add('mg-anim'); 106 io.unobserve(e.target); 107 }); 108 }, { threshold: 0.1, rootMargin: '0px 0px -40px 0px' }); 109 110 function init() { 111 if (initialized) return; 112 initialized = true; 113 document.querySelectorAll('.mg-fade').forEach(function (el) { 114 if (!el.classList.contains('mg-anim')) io.observe(el); 115 }); 116 } 117 if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init); 118 else init(); 119})(); 120 121(function () { 122 var tips = document.querySelectorAll('[data-tip]'); 123 if (!tips.length) return; 124 tips.forEach(function (tip) { 125 var btn = tip.querySelector('.mgd-tip-btn'); 126 var back = tip.querySelector('.mgd-tip-backdrop'); 127 if (!btn) return; 128 129 function open() { 130 tip.classList.add('is-open'); 131 document.documentElement.classList.add('mgd-tip-lock'); 132 document.addEventListener('keydown', onKey); 133 } 134 function close() { 135 tip.classList.remove('is-open'); 136 document.documentElement.classList.remove('mgd-tip-lock'); 137 document.removeEventListener('keydown', onKey); 138 } 139 function onKey(e) { if (e.key === 'Escape') close(); } 140 141 btn.addEventListener('click', function (e) { 142 e.stopPropagation(); 143 tip.classList.contains('is-open') ? close() : open(); 144 }); 145 if (back) back.addEventListener('click', close); 146 }); 147})();
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.