PageSourceSearch

https://thanks-blog.com/wp-content/themes/cocoon-master/javascript.js?ver=7.1.3&fver=20240828013833

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

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.