PageSourceSearch

https://sonekenkou-sunnyside.com/wp-content/themes/drop_tcd087/js/jscript.js?ver=2.12.5

js sonekenkou-sunnyside.com collected 2026-09-30 23:29:30 UTC 11,554 bytes, 404 lines download raw bytes

1jQuery(document).ready(function($){
2
3  var $window = $(window);
4
5
6  $("a").bind("focus",function(){if(this.blur)this.blur();});
7  $("a.target_blank").attr("target","_blank");
8
9
10// animation scroll link
11$('a[href*="#"]').not('#comment_tab li a, #mobile_menu a').click(function (e) {
12
13
14  var href = $(this).attr("href");
15  if (!href) return;
16
17  // #以降だけ抜き出す(絶対URL / 相対URL 両対応)
18  if (href.indexOf('#') === -1) return;
19
20  var myHref = '#' + href.split('#').pop();
21
22  // "#" 単体は除外
23  if (myHref === '#') return;
24
25  var $target = $(myHref);
26  if (!$target.length) return;
27
28  e.preventDefault();
29
30  var myPos;
31
32  if ($("html").hasClass("mobile") && $("body").hasClass("use_mobile_header_fix")) {
33    myPos = $target.offset().top - 60;
34
35  } else if ($("html").hasClass("mobile")) {
36    myPos = $target.offset().top;
37
38  } else if ($("html").hasClass("pc") && $("body").hasClass("use_header_fix")) {
39    if ($("html").hasClass("pc") && $("body").hasClass("menu_type2 hide_header_logo hide_global_menu")) {
40      myPos = $target.offset().top;
41    } else {
42      myPos = $target.offset().top - 70;
43    }
44
45  } else {
46    myPos = $target.offset().top;
47  }
48
49  // 目次内アンカーのみ微調整
50  if ($(this).closest('.p-toc').length) {
51    myPos -= 30;
52  }
53
54  $("html,body").stop(true).animate(
55    { scrollTop: myPos },
56    1000,
57    'easeOutExpo'
58  );
59
60  return false;
61});
62
63
64
65  //return top button
66  var return_top_button = $('#return_top');
67  $('a',return_top_button).click(function() {
68    var myHref= $(this).attr("href");
69    var myPos = $(myHref).offset().top;
70    $("html,body").animate({scrollTop : myPos}, 1000, 'easeOutExpo');
71    return false;
72  });
73  return_top_button.removeClass('active');
74  $window.scroll(function () {
75    if ($(this).scrollTop() > 100) {
76      return_top_button.addClass('active');
77    } else {
78      return_top_button.removeClass('active');
79    }
80  });
81
82
83  //fixed footer content
84  var fixedFooter = $('#fixed_footer_content');
85  fixedFooter.removeClass('active');
86  $window.scroll(function () {
87    if ($(this).scrollTop() > 330) {
88      fixedFooter.addClass('active');
89    } else {
90      fixedFooter.removeClass('active');
91    }
92  });
93  $('#fixed_footer_content .close').click(function() {
94    $("#fixed_footer_content").hide();
95    return false;
96  });
97
98
99  // comment button
100  $("#comment_tab li").click(function() {
101    $("#comment_tab li").removeClass('active');
102    $(this).addClass("active");
103    $(".tab_contents").hide();
104    var selected_tab = $(this).find("a").attr("href");
105    $(selected_tab).fadeIn();
106    return false;
107  });
108
109
110  //custom drop menu widget
111  $(".tcdw_custom_drop_menu li:has(ul)").addClass('parent_menu');
112  $(".tcdw_custom_drop_menu li").hover(function(){
113     $(">ul:not(:animated)",this).slideDown("fast");
114     $(this).addClass("active");
115  }, function(){
116     $(">ul",this).slideUp("fast");
117     $(this).removeClass("active");
118  });
119
120
121  // design select box widget
122  $(".design_select_box select").on("click" , function() {
123    $(this).closest('.design_select_box').toggleClass("open");
124  });
125  $(document).mouseup(function (e){
126    var container = $(".design_select_box");
127    if (container.has(e.target).length === 0) {
128      container.removeClass("open");
129    }
130  });
131
132
133  //tab post list widget
134  $(".tab_post_list_widget").each(function () {
135    $('.widget_tab_post_list_button a:first-child',this).addClass('active');
136    $('.widget_tab_post_list:first',this).show();
137  });
138  $('.widget_tab_post_list_button').on('click', 'a', function(){
139    $(this).addClass('active');
140    $(this).siblings().removeClass('active');
141    var $tab_list_class = "." + $(this).attr('data-tab');
142    $(this).closest('.tab_post_list_widget').find(".widget_tab_post_list").hide();
143    $(this).closest('.tab_post_list_widget').find($tab_list_class).show();
144    $(this).closest('.tab_post_list_widget').find($tab_list_class).find('ol').slick('setPosition');
145    return false;
146  });
147
148
149  //archive list widget
150  if ($('.p-dropdown').length) {
151    $('.p-dropdown__title').click(function() {
152      $(this).toggleClass('is-active');
153      $('+ .p-dropdown__list:not(:animated)', this).slideToggle();
154    });
155  }
156
157
158  //category widget
159  $(".tcd_category_list li:has(ul)").addClass('parent_menu');
160  $(".tcd_category_list li.parent_menu > a").parent().prepend("<span class='child_menu_button'></span>");
161  $(".tcd_category_list li .child_menu_button").on('click',function() {
162     if($(this).parent().hasClass("open")) {
163       $(this).parent().removeClass("active");
164       $(this).parent().removeClass("open");
165       $(this).parent().find('>
165ul:not(:animated)').slideUp("fast");
166       return false;
167     } else {
168       $(this).parent().addClass("active");
169       $(this).parent().addClass("open");
170       $(this).parent().find('>ul:not(:animated)').slideDown("fast");
171       return false;
172     };
173  });
174
175
176  //search widget
177  $('.widget_search #searchsubmit').wrap('<div class="submit_button"></div>');
178  $('.google_search #searchsubmit').wrap('<div class="submit_button"></div>');
179
180
181  // header search
182  $("#header_search_button").on('click',function() {
183    if($(this).parent().hasClass("active")) {
184      $(this).parent().removeClass("active");
185      return false;
186    } else {
187      $(this).parent().addClass("active");
188      return false;
189    }
190  });
191
192
193  // header hover
194  $("#header").addClass("off_hover");
195  $("#header").hover(function(){
196     $(this).removeClass("off_hover");
197  }, function(){
198     $(this).addClass("off_hover");
199  });
200
201// responsive ------------------------------------------------------------------------
202var mql = window.matchMedia('screen and (min-width: 1151px)');
203function checkBreakPoint(mql) {
204
205 if(mql.matches){ //PC
206
207   $("html").removeClass("mobile");
208   $("html").addClass("pc");
209
210   $(".global_menu_button").css("display","none");
211
212 } else { //smart phone
213
214   $("html").removeClass("pc");
215   $("html").addClass("mobile");
216
217   // perfect scroll
218   if ($('#drawer_menu').length) {
219     if(! $(body).hasClass('mobile_device') ) {
220       new SimpleBar($('#drawer_menu')[0]);
221     };
222   };
223   if ($('.data_table.type2').length) {
224     $('.data_table.type2').each(function(){
225       if(! $(body).hasClass('mobile_device') ) {
226         new SimpleBar($(this)[0]);
227       }
228     });
229   }
230
231   // drawer menu
232   $("#mobile_menu .child_menu_button").remove();
233   $('#mobile_menu li > ul').parent().prepend("<span class='child_menu_button'><span class='icon'></span></span>");
234   $("#mobile_menu .child_menu_button").on('click',function() {
235     if($(this).parent().hasClass("open")) {
236       $(this).parent().removeClass("open");
237       $(this).parent().find('>ul:not(:animated)').slideUp("fast");
238       return false;
239     } else {
240       $(this).parent().addClass("open");
241       $(this).parent().find('>ul:not(:animated)').slideDown("fast");
242       return false;
243     };
244   });
245
246   // drawer menu button
247   var menu_button = $('.global_menu_button');
248   menu_button.off();
249   menu_button.removeAttr('style');
250   menu_button.toggleClass("active",false);
251
252  // open drawer menu
253   menu_button.on('click', function(e) {
254
255      e.preventDefault();
256      e.stopPropagation();
257      $('html').toggleClass('open_menu');
258
259      $('#container').one('click', function(e){
260        if($('html').hasClass('open_menu')){
261          $('html').removeClass('open_menu');
262          return false;
263        };
264      });
265
266   });
267 };
268};
269
270// ===== drawer menu anchor scroll + close (スマホのみ) =====
271function closeDrawerMenuHard() {
272  // 確実に消す(付け直し対策で複数回)
273  document.documentElement.classList.remove('open_menu');
274  document.body.classList.remove('open_menu');
275  $('html, body').removeClass('open_menu');
276
277  setTimeout(function () {
278    document.documentElement.classList.remove('open_menu');
279    document.body.classList.remove('open_menu');
280    $('html, body').removeClass('open_menu');
281  }, 0);
282
283  setTimeout(function () {
284    document.documentElement.classList.remove('open_menu');
285    document.body.classList.remove('open_menu');
286    $('html, body').removeClass('open_menu');
287  }, 50);
288}
289
290function getHeaderOffset() {
291  if ($('html').hasClass('mobile') && $('body').hasClass('use_mobile_header_fix')) return 60;
292  if ($('html').hasClass('pc') && $('body').hasClass('use_header_fix')) {
293    if ($('body').hasClass('menu_type2') && $('body').hasClass('hide_header_logo') && $('body').hasClass('hide_global_menu')) return 0;
294    return 70;
295  }
296  return 0;
297}
298
299// 位置ズレ対策:数回リトライして安定したら確定
300function scrollToHashStable(hash) {
301  if (!hash || hash === '#') return;
302
303  var $target = $(hash);
304  if (!$target.length) return;
305
306  var tries = 0;
307  var lastPos = -1;
308
309  function attempt() {
310    tries++;
311
312    var pos = Math.max(0, $target.offset().top - getHeaderOffset());
313
314    if (Math.abs(pos - lastPos) < 2 || tries >= 10) {
315      $('html,body').stop(true, false).animate({ scrollTop: pos }, 1000, 'easeOutExpo');
316      return;
317    }
318
319    lastPos = pos;
320    setTimeout(attempt, 120);
321  }
322
323  setTimeout(attempt, 0);
324}
325
326// ★積み増し防止:offしてからon(名前付き)
327$(document)
328  .off('click.tcdDrawerAnchor', '#mobile_menu a[href*="#"]')
329  .on('click.tcdDrawerAnchor', '#mobile_menu a[href*="#"]', function (e) {
330
331    // スマホ画角以外は何もしない(PCの既存挙動を崩さない)
332    if (!$('html').hasClass('mobile')) return;
333
334    var href = $(this).attr('href') || '';
335    if (href.indexOf('#') === -1) return;
336
337    var hash = '#' + href.split('#').pop();
338    if (!hash || hash === '#') return;
339
340    // 別ページへの # は通常遷移(遷移先で load 時に補正したいなら別途)
341    var linkPage = href.split('#')[0];
342    var currentPage = location.href.split('#')[0];
343    if (linkPage && linkPage !== currentPage) return;
344
345    e.preventDefault();
346    e.stopPropagation();
347    e.stopImmediatePropagation();
348
349    // まず閉じる
350    closeDrawerMenuHard();
351
352    // 閉じた後にスクロール(少し待つと安定)
353    setTimeout(function () {
354      scrollToHashStable(hash);
355    }, 60);
356
357    return false;
358  });
359
360
361mql.addListener(checkBreakPoint);
362checkBreakPoint(mql);
363
364// ===== 別ページから #hash で来たときのズレ補正(PC/スマホ共通)=====
365
366// 1回だけ実行するためのガード
367var __tcdLastFixedHash = null;
368
369function fixLandingHashScroll() {
370  var hash = window.location.hash;
371  if (!hash || hash === '#') return;
372
373  // 同じhashで何度も補正しない
374  if (__tcdLastFixedHash === hash) return;
375  __tcdLastFixedHash = hash;
376
377  // まず target がいるか確認(いなければ何もしない)
378  var $target = $(hash);
379  if (!$target.length) return;
380
381  // ここが重要:ブラウザの“先スクロール”が残っているので、補正をかける
382  // いきなり animate だけだと、画像遅延等でまだズレるので「安定版」を使う
383  scrollToHashStable(hash);
384}
385
386// load: 画像やフォントが揃った後に一度補正
387$(window).on('load', function () {
388  fixLandingHashScroll();
389});
390
391// pageshow: 戻る(bfcache)でズレるケース対策
392$(window).on('pageshow', function () {
393  // 少し遅らせるとiOS系で安定しやすい
394  setTimeout(fixLandingHashScroll, 50);
395});
396
397// hashchange: 同一ページ内で URL hash が変更されるタイプのUIにも保険
398$(window).on('hashchange', function () {
399  // クリック側の既存処理と競合しにくいように少し遅らせる
400  setTimeout(fixLandingHashScroll, 0);
401});
402
403
404});

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.