PageSourceSearch

https://karasu-hc.com/wp-content/themes/cocoon-master/javascript.js?ver=6.2.13&fver=20230617042156

js karasu-hc.com collected 2026-10-01 23:55:31 UTC 7,803 bytes, 231 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  $('#comment-reply-btn, .comment-reply-link').click(function () {
131    $('#comment-reply-btn').slideUp();
132    const respond = document.getElementById('respond');
133    const styles = { inset: 'auto', position: 'static', visibility: 'visible' };
134    Object.entries(styles).forEach(([key, value]) => {
135      respond.style[key] = value;
136    });
137    $('#respond').slideDown();
138  });
139
140  //Google検索ボタン
141  $('.sbtn').click(function () {
142    var w = $(this).prev('.sform').text();
143    if (w) window.open('https://www.google.co.jp/search?q=' + encodeURIComponent(w), '_blank');
144  });
145
146  //スライドインサイドバーのアーカイブセレクトボックス選択処理
147  $('.sidebar-menu-content .widget_archive select').change(function () {
148    document.location.href = this.options[this.selectedIndex].value;
149  });
150
151  //スライドインサイドバーのカテゴリーセレクトボックス選択処理
152  $('.sidebar-menu-content .widget_categories select').change(function () {
153    if (this.options[this.selectedIndex].value > 0) {
154      this.parentNode.submit();
155    }
156  });
157
158  function drawerCloser(selecter, checkbox) {
159    $(selecter).click(function () {
160      href = $(this).attr('href');
161      url = location.href;
162      url = url.replace(/#.*$/, '');
163      if ((href.indexOf(url) != -1) && 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  //console.log($('.mobile-menu-buttons'));
177  $('.mobile-menu-buttons').each(function () {
178    if ($(this).has('.logo-menu-button').length) {
179      $(this).addClass('has-logo-button');
180    }
181  });
182
183  $(window).on('load', function () {
184    $('#carousel').addClass('loaded');
185  });
186
187  //FAQボックスのアコーディオン化用
188  $('.is-style-accordion .faq-answer').hide();
189  $('.is-style-accordion .faq-question').click(function () {
190    $(this).next('.is-style-accordion .faq-answer').slideToggle();
191    $(this).toggleClass('active');
192  });
193
194  //モバイルサイドバー表示時にサイドバーを移動する・モバイルサイドバーを閉じる時に元の位置に戻す
195  $('#sidebar-menu-input').change(function () {
196    if ($(this).prop('checked')) {
197      $('#sidebar').appendTo('#sidebar-menu-content');
198      $('#sidebar').attr('id', 'slide-in-sidebar');
199      $('#sidebar').addClass('slide-in-sidebar');
200      //モバイルサイドバーのリンクをクリックしたら閉じる
201      drawerCloser('#slide-in-sidebar a', '#sidebar-menu-input');
202    } else {
203      $('#sidebar').removeClass('slide-in-sidebar');
204      $('#slide-in-sidebar').attr('id', 'sidebar');
205      $('#sidebar').insertAfter('#main');
206    }
207  });
208
209  //リサイズした時はサイドバーを元に戻す
210  var vw = window.innerWidth;
211  $(window).resize(function () {
212    if (vw != window.innerWidth) {
213      $('#sidebar-menu-input').prop('checked', false).change();
214    }
215    vw = window.innerWidth;
216  });
217})(jQuery);
218
219/*
220* Cocoon WordPress Theme incorporates code from "Youtube SpeedLoad" WordPress Plugin, Copyright 2017 Alexufo[http://habrahabr.ru/users/alexufo/]
221"Youtube SpeedLoad" WordPress Plugin is distributed under the terms of the GNU GPL v2
222*/
223(function () {
224  var f = document.querySelectorAll(".video-click");
225  for (var i = 0; i < f.length; ++i) {
226    f[i].onclick = function () {
227      var iframe = this.getAttribute("data-iframe");
228      this.parentElement.innerHTML = '<div class="video">' + iframe + '</div>';
229    }
230  }
231})();

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.