PageSourceSearch

https://nihon-denshobatokyokai.com/js/index.js

js nihon-denshobatokyokai.com collected 2026-10-10 00:30:58 UTC 2,016 bytes, 72 lines download raw bytes

1// ===== BGM(FVのボタンから手動再生) =====
2(function() {
3  var bgm = document.getElementById('bgm');
4  var toggle = document.getElementById('bgmToggle');
5  if (!bgm || !toggle) return;
6
7  bgm.volume = 0.2;
8
9  var icon = toggle.querySelector('i');
10  var label = toggle.querySelector('span');
11
12  function updateButton() {
13    toggle.classList.toggle('is-muted', bgm.paused);
14    if (icon) icon.className = bgm.paused ? 'fa-solid fa-volume-high' : 'fa-solid fa-volume-xmark';
15    if (label) label.textContent = bgm.paused ? 'イメージサウンドを再生する' : 'サウンドを停止する';
16  }
17
18  toggle.addEventListener('click', function() {
19    if (bgm.paused) {
20      bgm.play().catch(function() {});
21    } else {
22      bgm.pause();
23    }
24    updateButton();
25  });
26
27  updateButton();
28})();
29
30// ===== MV Slider =====
31(function() {
32  var slides = document.querySelectorAll('.mv-slide');
33  var dots   = document.querySelectorAll('.mv-dot');
34  var current = 0;
35  var timer;
36
37  function goTo(idx) {
38    slides[current].classList.remove('active');
39    dots[current].classList.remove('active');
40    current = idx;
41    slides[current].classList.add('active');
42    dots[current].classList.add('active');
43  }
44
45  function next() {
46    goTo((current + 1) % slides.length);
47  }
48
49  function startTimer() {
50    timer = setInterval(next, 5000);
51  }
52
53  dots.forEach(function(dot) {
54    dot.addEventListener('click', function() {
55      clearInterval(timer);
56      goTo(parseInt(this.dataset.idx));
57      startTimer();
58    });
59  });
60
61  startTimer();
62})();
63
64// ===== News Tabs =====
65document.querySelectorAll('.news-tab').forEach(function(tab) {
66  tab.addEventListener('click', function() {
67    document.querySelectorAll('.news-tab').forEach(function(t) { t.classList.remove('active'); });
68    document.querySelectorAll('.news-list').forEach(function(l) { l.classList.remove('active'); });
69    this.classList.add('active');
70    document.getElementById('tab-' + this.dataset.tab).classList.add('active');
71  });
72});

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.