1(function () { 2 document.addEventListener("DOMContentLoaded", () => { 3 const hamburgerBtn = document.querySelector(".js-hamburger-menu-btn"); 4 const mobileMenu = document.querySelector(".js-header-menu"); 5 const headerInner = document.querySelector(".js-header-inner"); 6 7 if (!hamburgerBtn || !mobileMenu || !headerInner) { 8 return; 9 } 10 11 // topã¸ã®ãªã³ã¯åå¾ 12 const topLinks = document.querySelectorAll(".js-top-link"); 13 14 const closeMenu = () => { 15 // ã¡ãã¥ã¼ãéãã¦ããå ´åã®ã¿å¦çãå®è¡ 16 const isExpanded = hamburgerBtn.getAttribute("aria-expanded") === "true"; 17 18 if (isExpanded) { 19 // 1. ãã¿ã³ã®ç¶æ ã¨ã¯ã©ã¹ãåãæ¿ã (é常ã¢ã¤ã³ã³ã«æ»ã) 20 hamburgerBtn.setAttribute("aria-expanded", "false"); 21 hamburgerBtn.classList.remove("is-active"); 22 23 // 2. ã¡ãã¥ã¼ã®ç¶æ ã¨ã¯ã©ã¹ãåãæ¿ã (ã¹ã©ã¤ãã¢ã¦ã) 24 mobileMenu.setAttribute("aria-hidden", "true"); 25 mobileMenu.classList.remove("is-open"); 26 27 // 3. ãããã¼ã®å å´é¨åã®ã¯ã©ã¹ãåãæ¿ã (èæ¯è²ãå ã«æ»ã) 28 headerInner.classList.remove("is-open"); 29 30 // 4. ã¹ã¯ãã¼ã«åºå®ãè§£é¤ 31 document.body.classList.remove("no-scroll"); 32 } 33 }; 34 35 const toggleMenu = () => { 36 // ç¾å¨ã®ç¶æ ããã§ã㯠37 const isExpanded = 38 hamburgerBtn.getAttribute("aria-expanded") === "true" || false; 39 40 // isExpanded ã false ã®å ´åã¯éãå¦çãtrue ã®å ´åã¯éããå¦ç 41 if (!isExpanded) { 42 // éãå¦ç 43 hamburgerBtn.setAttribute("aria-expanded", "true"); 44 hamburgerBtn.classList.add("is-active"); 45 mobileMenu.setAttribute("aria-hidden", "false"); 46 mobileMenu.classList.add("is-open"); 47 headerInner.classList.add("is-open"); 48 document.body.classList.add("no-scroll"); 49 } else { 50 // éããå¦ç 51 closeMenu(); 52 } 53 }; 54 55 // ãã³ãã¼ã¬ã¼ãã¿ã³ã®ã¯ãªãã¯ã¤ãã³ã 56 hamburgerBtn.addEventListener("click", toggleMenu); 57 58 // ãã´ãªã³ã¯ã®å¦ç 59 topLinks.forEach(topLink => { 60 topLink.addEventListener("click", e => { 61 // 1. ã¡ãã¥ã¼ãéãã 62 closeMenu(); 63 64 // 2. ã¹ã ã¼ãºã¹ã¯ãã¼ã«å¦çãå®è¡ï¼ä»¥åã®ãã¸ãã¯ï¼ 65 const currentPath = window.location.pathname; 66 67 // ããããã¼ã¸ï¼"/" ã¾ã㯠"/index.html"ï¼ã«ããå ´åã®ã¿çºå 68 if (currentPath === "/" || currentPath === "/index.html") { 69 e.preventDefault(); 70 71 window.scrollTo({ 72 top: 0, 73 behavior: "smooth" 74 }); 75 } 76 // ããããã¼ã¸ä»¥å¤ã«ããå ´åã¯ãpreventDefault() ããªãã®ã§ 77 // ãã®ã¾ã¾ href="/" ã«å¾ã£ã¦ããããã¼ã¸ã¸é·ç§»ãã¾ã 78 }); 79 }); 80 }); 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.