PageSourceSearch

https://campingcar-rental-ogaki.com/wp/wp-content/themes/theme2024/assets/js/main.js?ver=1.0

js campingcar-rental-ogaki.com collected 2026-10-04 04:40:19 UTC 3,159 bytes, 92 lines download raw bytes

1/* HTML読み込み完了後に実行
2-------------------------------------------------*/
3window.addEventListener('load', function () {
4
5    var newContent = '<a href="#" id="to_top" role="button"><i class="fas fa-chevron-up"></i><br><span class="text">TOP</span></a>';
6    var wrapper = document.getElementById('wrapper');
7    wrapper.insertAdjacentHTML('beforeend', newContent);
8
9    //サブメニューがある要素に、トグルボタンを追加
10    let elems = document.querySelectorAll('.mobile-nav .menu-item-has-children > a');
11    for (let i in elems) {
12        if (elems.hasOwnProperty(i)) {
13            var newContent = '<button class="has-children-btn" aria-expanded="false" aria-label="サブメニューを開く"></button>';
14            elems[i].insertAdjacentHTML('afterend', newContent);
15        }
16    }
17
18    smooth_scroll();
19
20    new ScrollHint('.scrollTable');
21
22});
23
24/* click イベント
25-------------------------------------------------*/
26window.addEventListener('click', function (e) {
27
28    var elem = e.target;
29
30    //サブメニューボタン(toggle)をクリック
31    if (elem.className.match(/has-children-btn/)) {
32
33        const content = elem.nextElementSibling;
34
35        if (elem.className.match(/active/)) {
36            content.style.height = 0;
37            content.style.visibility = 'hidden';
38            elem.classList.remove("active");
39            elem.setAttribute("aria-expanded", "false");
40            elem.setAttribute("aria-label", "サブメニューを開く");
41
42        } else {
43            slideDown(content);
44            elem.classList.add("active");
45            content.style.visibility = 'visible';
46            elem.setAttribute("aria-expanded", "true");
47            elem.setAttribute("aria-label", "サブメニューを閉じる");
48        }
49
50    }
51
52    //メニューボタン(toggle)をクリック
53    if (elem.className.match(/menu-btn/)) {
54        e.preventDefault();
55        if (elem.className.match(/active/)) {
56            control_mobile_nav('', elem);
57            elem.classList.remove('active');
58            elem.setAttribute("aria-expanded", "false");
59            elem.setAttribute("aria-label", "メニューを開く");
60        } else {
61            control_mobile_nav('open', elem);
62            elem.classList.add('active');
63            elem.setAttribute("aria-expanded", "true");
64            elem.setAttribute("aria-label", "メニューを閉じる");
65        }
66    }
67
68
69});
70
71/* scroll イベント
72-------------------------------------------------*/
73window.addEventListener('scroll', function (e) {
74
75    //指定の要素を上スクロールで現れる 下スクロールで消える
76    const header_elem = document.getElementById('header');
77    if (header_elem) {
78        scroll_up_down_elem(header_elem);
79    }
80
81    scroll_top();
82
83});
84
85
86//escキー押下でメニューを閉じられるように
87window.addEventListener("keydown", (event) => {
88    if (event.key === "Escape") {
89        var elem = document.getElementById('menu-btn');
90        control_mobile_nav('', elem);
91    }
92});

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.