PageSourceSearch

https://pro-kaguya.com/assets/js/tab+.js

js pro-kaguya.com collected 2026-10-06 13:16:40 UTC 2,255 bytes, 70 lines download raw bytes

1// ページ内リンククリック時にメニューを閉じる処理
2document.addEventListener("DOMContentLoaded", function () {
3  const hash = window.location.hash;
4
5  // タブ名のマッピング
6  const tabMapping = {
7    'ticket': 'tab1',
8    'novelty': 'tab2',
9    'goods': 'tab3',
10    'bd': 'tab4'
11  };
12
13  // ハッシュからタブ名を取得
14  const tabName = hash.replace('#', '');
15  
16  if (tabMapping[tabName]) {
17    const tabInputId = tabMapping[tabName];
18    const targetPanel = document.getElementById(tabName);
19    const tabInput = document.getElementById(tabInputId);
20
21    if (targetPanel && tabInput) {
22      tabInput.checked = true;
23
24      // ページトップにスクロール(タブの切り替えとコンテンツ読み込みを待つ)
25      setTimeout(() => {
26        window.scrollTo({ top: 0, behavior: "smooth" });
27      }, 300);
28    }
29  }
30
31  // メニュー内のアンカーリンクにイベントリスナーを追加
32  const menuLinks = document.querySelectorAll('.fsmenu a[href^="./ticket.html#"], .fsmenu a[href^="#"]');
33  
34  menuLinks.forEach(link => {
35    link.addEventListener('click', function(e) {
36      const href = this.getAttribute('href');
37      
38      // 同一ページ内のアンカーリンクの場合
39      if (href.startsWith('#') || href.includes('ticket.html#')) {
40        e.preventDefault();
41        
42        // ハッシュ部分を取得
43        const hashPart = href.includes('#') ? href.split('#')[1] : '';
44        
45        if (hashPart && tabMapping[hashPart]) {
46          const tabInputId = tabMapping[hashPart];
47          const tabInput = document.getElementById(tabInputId);
48          const targetPanel = document.getElementById(hashPart);
49          
50          if (tabInput) {
51            tabInput.checked = true;
52          }
53          
54          // メニューを閉じる
55          const hamburger = document.querySelector('.hamburger');
56          if (hamburger) {
57            hamburger.click();
58          }
59          
60          // スクロール
61          if (targetPanel) {
62            setTimeout(() => {
63              window.scrollTo({ top: 0, behavior: "smooth" });
64            }, 300); // メニューが閉じるのを待つ
65          }
66        }
67      }
68    });
69  });
70});

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.