1document.addEventListener('DOMContentLoaded', function () { 2 const header = document.querySelector('header.header'); 3 const menuBtn = document.querySelector('.menu-btn'); 4 const mainMenu = document.querySelector('.main-menu'); 5 const menuOverlay = document.querySelector('.menu-overlay'); 6 const body = document.body; 7 8 if (document.querySelector('#gcAccountUserMenu') && header) { 9 header.classList.add('gc-menu-exist'); 10 } 11 12 function fadeIn(element, duration) { 13 if (!element) return; 14 element.style.opacity = '0'; 15 element.style.display = 'block'; 16 element.style.transition = 'opacity ' + duration + 'ms'; 17 18 requestAnimationFrame(function () { 19 element.style.opacity = '0.5'; 20 }); 21 } 22 23 function fadeOut(element, duration) { 24 if (!element) return; 25 element.style.transition = 'opacity ' + duration + 'ms'; 26 element.style.opacity = '0'; 27 28 window.setTimeout(function () { 29 element.style.display = 'none'; 30 element.style.removeProperty('transition'); 31 }, duration); 32 } 33 34 function closeMenu() { 35 fadeOut(menuOverlay, 300); 36 if (menuBtn) menuBtn.classList.remove('menu-open'); 37 if (mainMenu) mainMenu.classList.remove('active'); 38 body.classList.remove('fixed'); 39 } 40 41 if (menuBtn) { 42 menuBtn.addEventListener('click', function () { 43 const isOpening = !menuBtn.classList.contains('menu-open'); 44 45 menuBtn.classList.toggle('menu-open'); 46 if (mainMenu) mainMenu.classList.toggle('active'); 47 body.classList.toggle('fixed'); 48 49 if (isOpening) { 50 fadeIn(menuOverlay, 300); 51 } else { 52 fadeOut(menuOverlay, 300); 53 } 54 }); 55 } 56 57 document.querySelectorAll('[scroll-target]').forEach(function (trigger) { 58 trigger.addEventListener('click', function (event) { 59 const target = document.querySelector(trigger.getAttribute('scroll-target')); 60 61 event.preventDefault(); 62 closeMenu(); 63 64 if (target) { 65 target.scrollIntoView({ behavior: 'smooth', block: 'start' }); 66 } 67 }); 68 }); 69 70 document.querySelectorAll('.header__btn').forEach(function (button) { 71 button.addEventListener('click', closeMenu); 72 }); 73 74 if (menuOverlay) { 75 menuOverlay.addEventListener('click', closeMenu); 76 } 77 78 window.setTimeout(function () { 79 fadeOut(document.querySelector('#preloader'), 600); 80 }, 500); 81});
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.