PageSourceSearch

https://webdesi9.com/wp-content/themes/cocoon-master/javascript.js?fver=20250307042913

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

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.