PageSourceSearch

https://japanir.jp/wp-content/themes/astra-child/js/japan-ir-scripts.js?ver=1.0.0

js japanir.jp collected 2026-09-25 09:00:30 UTC 3,126 bytes, 82 lines download raw bytes

1/**
2 * Japan IR 100 のフロントエンド機能を処理するスクリプト(jQuery非依存版)
3 */
4document.addEventListener('DOMContentLoaded', function() {
5    // フィルターボタン処理
6    const filterButtons = document.querySelectorAll('.filter-btn');
7    filterButtons.forEach(function(button) {
8        button.addEventListener('click', function() {
9            // 兄弟から active クラスを削除
10            const parent = this.parentNode;
11            const siblings = parent.querySelectorAll('.filter-btn');
12            siblings.forEach(function(sibling) {
13                sibling.classList.remove('active');
14            });
15            
16            // クリックされたボタンに active クラスを追加
17            this.classList.add('active');
18            
19            // デバッグログ
20            console.log('Button clicked:', this.textContent);
21        });
22    });
23    
24    // フィルターリセット
25    const filterReset = document.querySelector('.filter-reset');
26    if (filterReset) {
27        filterReset.addEventListener('click', function(e) {
28            e.preventDefault();
29            
30            const filterGroups = document.querySelectorAll('.filter-group');
31            filterGroups.forEach(function(group) {
32                const buttons = group.querySelectorAll('.filter-btn');
33                buttons.forEach(function(btn, index) {
34                    if (index === 0) {
35                        btn.classList.add('active');
36                    } else {
37                        btn.classList.remove('active');
38                    }
39                });
40            });
41            
42            console.log('Filters reset');
43        });
44    }
45    
46    // ヘッダースクロール効果
47    window.addEventListener('scroll', function() {
48        const header = document.querySelector('header');
49        if (window.scrollY > 50) {
50            header.classList.add('header-compact');
51        } else {
52            header.classList.remove('header-compact');
53        }
54    });
55    
56    // 検索バーのフォーカス効果
57    const searchInputs = document.querySelectorAll('.search-container input');
58    searchInputs.forEach(function(input) {
59        input.addEventListener('focus', function() {
60            this.parentNode.classList.add('focused');
61        });
62        
63        input.addEventListener('blur', function() {
64            this.parentNode.classList.remove('focused');
65        });
66    });
67    
68    // デバッグ情報
69    console.log('DOM loaded, script initialized');
70    console.log('Filter buttons found:', filterButtons.length);
71
72    // タグリンク(data-tag-url)のクリック遷移
73    // hrefにcustom_tagクエリを持たせない(クロール対象から除外するため)代わりに
74    // data-tag-url属性で遷移先を持たせ、クリック時にJSで遷移する
75    document.addEventListener('click', function(e) {
76        const el = e.target.closest('[data-tag-url]');
77        if (el) {
78            e.preventDefault();
79            window.location.href = el.getAttribute('data-tag-url');
80        }
81    });
82});

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.