1(function () { 2 function init() { 3 // --- 1. Chrome 2åã¿ããåé¡å¯¾ç & ã¹ã ã¼ã¹ã¹ã¯ãã¼ã« --- 4 document.addEventListener('touchstart', function () {}, {passive: true}); 5 const scrollLinks = document.querySelectorAll('a[href^="#"]'); 6 scrollLinks.forEach(link => { 7 link.addEventListener('click', function(e) { 8 const href = this.getAttribute('href'); 9 const target = href === "#" || href === "" ? document.documentElement : document.querySelector(href); 10 if (target) { 11 e.preventDefault(); 12 const offset = window.innerWidth <= 765 ? 60 : 0; 13 const targetPosition = target.getBoundingClientRect().top + window.pageYOffset - offset; 14 window.scrollTo({ top: targetPosition, behavior: 'smooth' }); 15 } 16 }); 17 }); 18 // --- 2. ãããã¼ --- 19 const header = document.querySelector('.g-headericon'); 20 const bgTrigger = 500; // èæ¯ãåºãpx 21 const hideTrigger = 200; // åºãå ¥ãéå§px 22 let lastScroll = 0; 23 window.addEventListener('scroll', () => { 24 const current = window.scrollY; 25 /* èæ¯ã®ON/OFF */ 26 if (current > bgTrigger) { 27 header.classList.add('is-scrolled'); 28 } else { 29 header.classList.remove('is-scrolled'); 30 } 31 /* æä¸é¨ã§ã¯å¿ ã表示 */ 32 if (current < hideTrigger) { 33 header.classList.remove('is-hide'); 34 lastScroll = current; 35 return; 36 } 37 /* ã¹ã¯ãã¼ã«æ¹åå¤å® */ 38 if (current > lastScroll) { 39 // ä¸ã¹ã¯ãã¼ã« 40 header.classList.add('is-hide'); 41 } else { 42 // ä¸ã¹ã¯ãã¼ã« 43 header.classList.remove('is-hide'); 44 } 45 lastScroll = current; 46 }); 47 48 // --- 3. ãã³ãã¼ã¬ã¼ã¡ãã¥ã¼ --- 49 const menuBtn = document.querySelector(".g-menubutton"); 50 const nav = document.getElementById("g-nav"); 51 52 if (menuBtn && nav) { 53 menuBtn.addEventListener("click", function (e) { 54 e.stopPropagation(); 55 this.classList.toggle("active"); 56 nav.classList.toggle("panelactive"); 57 }); 58 59 nav.addEventListener("click", function () { 60 menuBtn.classList.remove("active"); 61 this.classList.remove("panelactive"); 62 }); 63 64 // nav å ã®ãªã³ã¯ã§ãéãã 65 nav.querySelectorAll("a").forEach(link => { 66 link.addEventListener("click", function () { 67 menuBtn.classList.remove("active"); 68 nav.classList.remove("panelactive"); 69 }); 70 }); 71 } 72 73 // --- 4. YouTube ãµã ãã¤ã«è»½éå --- 74 document.querySelectorAll(".youtube").forEach((youtube) => { 75 const iframe = youtube.querySelector("iframe"); 76 if (!iframe) return; 77 78 const url = iframe.getAttribute("data-src") || iframe.src; 79 const match = url.match(/[\/?=]([a-zA-Z0-9_-]{11})[&\?]?/); 80 if (!match) return; 81 82 const id = match[1]; 83 youtube.innerHTML = `<img src="https://img.youtube.com/vi/${id}/maxresdefault.jpg" alt="ãµã ãã¤ã«" style="cursor:pointer;">`; 84 85 youtube.addEventListener("click", function () { 86 const arrow = youtube.parentElement.querySelector(".arrow"); 87 if (arrow) { 88 arrow.style.transition = "opacity 0.2s ease"; 89 arrow.style.opacity = "0"; 90 setTimeout(() => arrow.remove(), 200); 91 } 92 youtube.innerHTML = `<iframe src="https://www.youtube.com/embed/${id}?autoplay=1&mute=1&controls=1&fs=0&rel=0&loop=1&playlist=${id}&modestbranding=1" 93 frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>`; 94 }); 95 }); 96 97 // --- 5. ã¹ã¯ãã¼ã«ã¤ãã³ã --- 98 const pageTop = document.getElementById('page-top'); 99 const fadeElements = document.querySelectorAll('.fadeTrigger'); 100 101 const checkFade = () => { 102 const scroll = window.scrollY; 103 const windowHeight = window.innerHeight; 104 if (pageTop) { 105 if (scroll >= 800) pageTop.classList.add('fadein'); 106 else pageTop.classList.remove('fadein'); 107 }
108 fadeElements.forEach(element => { 109 const elemPos = element.getBoundingClientRect().top + scroll; 110 if (scroll > elemPos - windowHeight + 0) { 111 element.classList.add('is-active'); 112 } 113 }); 114 }; 115 116 window.addEventListener('scroll', checkFade, {passive: true}); 117 118 // --- 6. ãã¼ãã£ã³ã°é£åãã¸ã㯠--- 119 const loadingScreen = document.getElementById("loading-screen"); 120 121 if (!loadingScreen || loadingScreen.style.display === "none") { 122 // ãã¼ãã£ã³ã°ä¸è¦ãªå ´åï¼loading.jså´ã§æ¢ã«ã¹ãããæ¸ã¿ï¼ 123 checkFade(); 124 } else { 125 // ãã¼ãã£ã³ã°ãå¿ è¦ãªå ´åï¼ååã¾ãã¯æ´æ°ï¼: å®éã®é表示ã¿ã¤ãã³ã°ã¯loading.jså´ã管ç 126 loadingScreen.addEventListener("loading-hidden", function () { 127 // èæ¯ãè¦ãå§ããé ã«ãã§ã¼ããéå§ 128 setTimeout(checkFade, 300); 129 }, { once: true }); 130 } 131 } 132 133 if (document.readyState === "loading") { 134 document.addEventListener("DOMContentLoaded", init); 135 } else { 136 init(); 137 } 138})();
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.