PageSourceSearch

https://ergamedesign.net/wp-content/themes/cocoon-master/javascript.js?ver=6.6.10&fver=20240731062532

js ergamedesign.net collected 2026-10-07 14:20:59 UTC 7,863 bytes, 230 lines download raw bytes

1/**
2 * Cocoon WordPress Theme
3 * @author: yhira
4 * @link: https://wp-cocoon.com/
5 * @license: http://www.gnu.org/licenses/gpl-2.0.html GPL v2 or later
6 */
7/////////////////////////////////
8// JavaScriptコード
9/////////////////////////////////
10
11(function ($) {
12  /////////////////////////////////
13  //TOPへ戻るボタン
14  /////////////////////////////////
15  var prevScrollTop = -1;
16  var $window = $(window);
17  $window.scroll(function () {
18    //最上部から現在位置までの距離を取得して、変数[scrollTop]に格納
19    var scrollTop = $window.scrollTop();
20    var threashold = 600;
21    var s1 = (prevScrollTop > threashold);
22    var s2 = (scrollTop > threashold);
23
24    // スレッショルドを跨いだ時のみ処理をする
25    if (s1 ^ s2) {
26      if (s2) {
27        //[.go-to-to]をゆっくりフェードインする
28        $('.go-to-top').fadeIn('slow');
29      } else {
30        //それ以外だったらフェードアウトする
31        $('.go-to-top').fadeOut('slow');
32      }
33    }
34
35    prevScrollTop = scrollTop;
36  });
37
38  //ボタン(.go-to-top-common)のクリックイベント
39  $('.go-to-top-common').click(function () {
40    //ページトップへ移動する
41    $('body,html').animate({
42      scrollTop: 1
43    }, 800);
44  });
45  //ボタン(.go-to-toc-common)のクリックイベント
46  $('.go-to-toc-common').click(function () {
47    //目次へ移動する
48    $('body,html').animate({
49      scrollTop: $('.entry-content .toc').offset().top
50    }, 800);
51  });
52
53  //検索ボタンクリックでフォーカスを入力エリアに移す
54  $('#search-menu-input').change(function (e) {
55    var searchEdit = $('#search-menu-content .search-edit').first();
56    if (e.target.checked) {
57      searchEdit.focus();
58    } else {
59      searchEdit.blur();
60    }
61  });
62
63  //下にスクロールで管理パネルを隠す
64  //上にスクロールで管理パネルを表示
65  var adminMenu = $("#admin-panel");
66  var adminHeight = adminMenu.outerHeight();
67  var adminStartPos = 0;
68  $(window).scroll(function () {
69    var adminCurrentPos = $(this).scrollTop();
70    if (adminCurrentPos > adminStartPos) {
71      if (adminCurrentPos >= 200) {
72        adminMenu.css("bottom", "-" + adminHeight + "px");
73      }
74    } else {
75      adminMenu.css("bottom", 0);
76    }
77    adminStartPos = adminCurrentPos;
78  });
79
80  //モバイルボタンが固定じゃない場合
81  if (cocoon_localize_script_options.is_fixed_mobile_buttons_enable != 1) {
82    //ヘッダーモバイルメニュー
83    var headerMenu = $('.mobile-header-menu-buttons');
84    var headerHight = headerMenu.outerHeight();
85    var headerStartPos = 0;
86    $(window).scroll(function () {
87      var headerCurrentPos = $(this).scrollTop();
88      if (headerCurrentPos > headerStartPos) {
89        if (headerCurrentPos >= 100) {
90          headerMenu.css('top', '-' + headerHight + 'px');
91        }
92      } else {
93        headerMenu.css('top', 0);
94      }
95      headerStartPos = headerCurrentPos;
96    });
97
98    //フッターモバイルメニュー
99    var footerMenu = $(".mobile-footer-menu-buttons");
100    var footerHeight = footerMenu.outerHeight();
101    var footerStartPos = 0;
102    $(window).scroll(function () {
103      var footerCurrentPos = $(this).scrollTop();
104
105      if (footerCurrentPos > footerStartPos) {
106        if (footerCurrentPos >= 100) {
107          footerMenu.css("bottom", "calc( -1 * (env(safe-area-inset-bottom) + " + footerHeight + "px) )");
108        }
109      } else if (footerCurrentPos - footerStartPos < -8) {
110        footerMenu.css("bottom", 0);
111      }
112
113      footerStartPos = footerCurrentPos;
114    });
115
116    var headerButtons = $(".mobile-header-menu-buttons");
117    var footerButtons = $(".mobile-footer-menu-buttons");
118    headerButtons.click(function () {
119      headerButtons.css("z-index", "3");
120      footerButtons.css("z-index", "2");
121    });
122
123    footerButtons.click(function () {
124      headerButtons.css("z-index", "2");
125      footerButtons.css("z-index", "3");
126    })
127  }
128
129  //コメントボタンがクリックされたとき
130  const clickEventType = ((window.ontouchstart !== null) ? 'click' : 'touchend');
131  $(document).on(clickEventType,'#comment-reply-btn, .comment-reply-link', function() {
132    $('#comment-reply-btn').slideUp();
133    const respond = document.getElementById('respond');
134    const styles = { inset: 'auto', position: 'static', visibility: 'visible' };
135    Object.entries(styles).forEach(([key, value]) => {
136      respond.style[key] = value;
137    });
138    $('#respond').slideDown();
139  });
140
141  //Google検索ボタン
142  $('.sbtn').click(function () {
143    var w = $(this).prev('.sform').text();
144    if (w) window.open('https://www.google.co.jp/search?q=' + encodeURIComponent(w), '_blank');
145  });
146
147  //スライドインサイドバーのアーカイブセレクトボックス選択処理
148  $('.sidebar-menu-content .widget_archive select').change(function () {
149    document.location.href = this.options[this.selectedIndex].value;
150  });
151
152  //スライドインサイドバーのカテゴリーセレクトボックス選択処理
153  $('.sidebar-menu-content .widget_categories select').change(function () {
154    if (this.options[this.selectedIndex].value > 0) {
155      this.parentNode.submit();
156    }
157  });
158
159  function drawerCloser(selecter, checkbox) {
160    $(selecter).click(function () {
161      $(checkbox).prop('checked', false);
162      // const href = $(this).attr('href');
163      // if (href.match(/#/)) {
164      //   $(checkbox).prop('checked', false);
165      // }
166    })
167  }
168
169  //モバイルメニューをクリックしたら閉じる
170  drawerCloser('.menu-drawer .menu-item a', '#navi-menu-input');
171
172  //モバイルサイドバーをクリックしたら閉じる
173  drawerCloser('#slide-in-sidebar a', '#sidebar-menu-input');
174
175  //モバイルヘッダーメニューのロゴ処理
176  $('.mobile-menu-buttons').each(function () {
177    if ($(this).has('.logo-menu-button').length) {
178      $(this).addClass('has-logo-button');
179    }
180  });
181
182  $(window).on('load', function () {
183    $('#carousel').addClass('loaded');
184  });
185
186  //FAQボックスのアコーディオン化用
187  $('.is-style-accordion > .faq > .faq-answer').hide();
188  $('.is-style-accordion > .faq > .faq-question').click(function () {
189    $(this).next('.is-style-accordion .faq-answer').slideToggle();
190    $(this).toggleClass('active');
191  });
192
193  //モバイルサイドバー表示時にサイドバーを移動する・モバイルサイドバーを閉じる時に元の位置に戻す
194  $(document).on("change", '#sidebar-menu-input', function () {
195    if ($(this).prop('checked')) {
196      $('#sidebar').appendTo('#sidebar-menu-content');
197      $('#sidebar').attr('id', 'slide-in-sidebar');
198      $('#sidebar').addClass('slide-in-sidebar');
199      //モバイルサイドバーのリンクをクリックしたら閉じる
200      drawerCloser('#slide-in-sidebar a', '#sidebar-menu-input');
201    } else {
202      $('#sidebar').removeClass('slide-in-sidebar');
203      $('#slide-in-sidebar').attr('id', 'sidebar');
204      $('#sidebar').insertAfter('#main');
205    }
206  });
207
208  //リサイズした時はサイドバーを元に戻す
209  var vw = window.innerWidth;
210  $(window).resize(function () {
211    if (vw != window.innerWidth) {
212      $('#sidebar-menu-input').prop('checked', false).change();
213    }
214    vw = window.innerWidth;
215  });
216})(jQuery);
217
218/*
219* Cocoon WordPress Theme incorporates code from "Youtube SpeedLoad" WordPress Plugin, Copyright 2017 Alexufo[http://habrahabr.ru/users/alexufo/]
220"Youtube SpeedLoad" WordPress Plugin is distributed under the terms of the GNU GPL v2
221*/
222(function () {
223  var f = document.querySelectorAll(".video-click");
224  for (var i = 0; i < f.length; ++i) {
225    f[i].onclick = function () {
226      var iframe = this.getAttribute("data-iframe");
227      this.parentElement.innerHTML = '<div class="video">' + iframe + '</div>';
228    }
229  }
230})();

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.