1'use strict'; 2 3(function () { 4 function initSmoothScroll() { 5 document.querySelectorAll('a[href^="#"]').forEach(function (link) { 6 link.addEventListener('click', function (e) { 7 const href = this.getAttribute('href'); 8 if (!href || href === '#' || href === '#!') return; 9 10 const target = document.querySelector(href); 11 if (!target) return; 12 13 e.preventDefault(); 14 if (target.tagName === 'DETAILS') target.open = true; 15 target.scrollIntoView({ behavior: 'smooth' }); 16 history.replaceState(null, '', href); 17 }); 18 }); 19 } 20 21 function initGallery() { 22 const galleryBackground = document.querySelector('.gallery-background'); 23 if (!galleryBackground) return; 24 25 const slides = [ 26 'photo/lesson-1.webp', 27 'photo/lesson-2.webp', 28 'photo/lesson-3.webp' 29 ]; 30 let currentSlide = 0; 31 32 setInterval(function () { 33 currentSlide = (currentSlide + 1) % slides.length; 34 galleryBackground.style.backgroundImage = "url('" + slides[currentSlide] + "')"; 35 }, 5000); 36 } 37 38 function initMobileMenu() { 39 const menuButton = document.getElementById('mobile-menu-toggle'); 40 const mobileMenu = document.getElementById('mobile-menu'); 41 if (!menuButton || !mobileMenu) return; 42 43 function toggleMenu() { 44 const isOpen = menuButton.getAttribute('aria-expanded') === 'true'; 45 menuButton.setAttribute('aria-expanded', String(!isOpen)); 46 mobileMenu.classList.toggle('hidden'); 47 } 48 49 menuButton.addEventListener('click', toggleMenu); 50 mobileMenu.querySelectorAll('a[href^="#"]').forEach(function (link) { 51 link.addEventListener('click', function () { 52 if (menuButton.getAttribute('aria-expanded') === 'true') toggleMenu(); 53 }); 54 }); 55 } 56 57 document.addEventListener('DOMContentLoaded', function () { 58 initSmoothScroll(); 59 initGallery(); 60 initMobileMenu(); 61 }); 62})();
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.