PageSourceSearch

https://www.akihabara-mental-clinic2019.com/wp-content/themes/akih…/assets/js/main.js?t=1791257671

js akihabara-mental-clinic2019.com collected 2026-10-06 08:14:05 UTC 19,573 bytes, 718 lines download raw bytes

1function main() {
2  (function ($) {
3    var cName;
4    switch (true) {
5      case window._ua.Tablet:
6        cName = 'tablet';
7        break;
8      case window._ua.Mobile:
9        cName = 'mobile';
10        break;
11      default:
12        cName = '';
13    }
14    $('body').addClass(cName);
15    var isTouchDevice = (function (d) {
16      var iframe = d.createElement('iframe');
17      d.body.appendChild(iframe);
18      var result = 'ontouchstart' in iframe.contentWindow;
19      d.body.removeChild(iframe);
20      return result;
21    })(document);
22    if (!isTouchDevice) {
23      $('body').addClass('touch-disabled');
24    }
25  })($);
26
27  var headerHeight = 0;
28  var headerOffset = 0;
29  var footerOffset = 0;
30  $('#header').addClass('low');
31  $('#footer').addClass('low');
32  $('.pagetop')
33    .hide()
34    .addClass('hidden');
35
36  var ua = navigator.userAgent.toLowerCase();
37  if (ua.indexOf('android') !== -1) {
38    $('.menu_icon a').addClass('fix');
39  }
40  if (ua.indexOf('iphone') !== -1 || ua.indexOf('ipad') !== -1) {
41    $('.parallax').addClass('ios');
42  }
43  if (ua.indexOf('safari') !== -1 && ua.indexOf('iPad') !== -1) {
44    $('.parallax').addClass('ios');
45  }
46  if (ua.indexOf('iPad') !== -1) {
47    $('.parallax').addClass('ios');
48  }
49  var ipad =
50    ua.indexOf('ipad') > -1 ||
51    (ua.indexOf('macintosh') > -1 && 'ontouchend' in document);
52  if (ipad == true) {
53    $('.parallax').addClass('ios');
54  }
55
56  // scrollbar
57  var scrollbarWidth = window.innerWidth - document.body.clientWidth;
58
59  // sp gnav
60  $('.menu_icon a').on('click', function (e) {
61    e.preventDefault();
62    $(this)
63      .toggleClass('close')
64      .parent()
65      .prev();
66    $('body')
67      .removeClass('down')
68      .addClass('up');
69    $(this)
70      .closest('#header')
71      .toggleClass('menu_open');
72  });
73
74  // gnav
75  var navi_event = 'click';
76  if ($('.global_nav').css('list-style-position') === 'inside') {
77    navi_event =
78      !$('body.mobile').length && !$('body.tablet').length
79        ? 'mouseenter mouseleave'
80        : 'touchend';
81    $('.has_under').on('click', function (e) {
82      var tagName = e.target.tagName.toLowerCase();
83      if (!tagName === 'a' || $(e.target.parentNode).hasClass('has_under')) {
84        e.preventDefault();
85      }
86    });
87  }
88  $('.has_under').on(navi_event, function (e) {
89    var tagName = e.target.tagName.toLowerCase();
90    if ($('.global_nav').css('list-style-position') !== 'inside' && (tagName === 'a' && !$(e.target.parentNode).hasClass('has_under'))) {
91      return;
92    }
93    e.preventDefault();
94    var $self = $('>a', $(this));
95    //var $self = $(this);
96    if (!$self.hasClass('menu_under_open') && $('.menu_under_open').length) {
97      $('.menu_under_open')
98        .removeClass('menu_under_open')
99        .next()
100        .stop()
101        .slideToggle(200);
102    }
103    $self.toggleClass('menu_under_open');
104    $self
105      .next()
106      .stop()
107      .slideToggle(200);
108  });
109  $('.gnav_search>a').on('click', function (e) {
110    e.preventDefault();
111    //$(this).toggleClass('menu_under_open');
112    $(this)
113      .next()
114      .slideToggle(200);
115  });
116
117  // pagetop
118  $('.pagetop a').on('click', function (e) {
119    e.preventDefault();
120    $('html, body').animate({
121      scrollTop: 0
122    });
123  });
124
125  // iOS svg tap fix
126  if ($('body.mobile').length || $('body.tablet').length) {
127    $('#header .title a').on('touchend', function (e) {
128      e.preventDefault();
129      location.href = this.href;
130    });
131  }
132
133  // swipebox
134  if ($.isFunction($().swipebox)) {
135    var swipebox = $('.swipebox').swipebox();
136    $(document).on('click touchend', '#swipebox-overlay', function (e) {
137      e.preventDefault();
138      if ($(e.target).hasClass('slide')) $.swipebox.close();
139    });
140  }
141
142  // slider
143  if ($.isFunction($().sliderPro)) {
144    var sliderDefaults = {
145      center: {
146        width: 1000,
147        height: 450,
148        slideDistance: 0,
149        visibleSize: '100%',
150        arrows: true,
151        fadeArrows: false,
152        autoScaleLayers: false,
153        breakpoints: {}
154      },
155      wide: {
156        width: '100%',
157        autoHeight: true,
158        slideDistance: 0,
159        arrows: true,
160        fadeArrows: false,
161        fade: true,
162        autoScaleLayers: false,
163        touchSwipe: false,
164        breakpoints: {}
165      },
166      contents: {
167        width: 450,
168        height: 300,
169        aspectRatio: 1.5,
170        slideDistance: 10,
171        visibleSize: '100%',
172        arrows: true,
173        fadeArrows: false,
174        buttons: false,
175        fadeCaption: false,
176        breakpoints: {}
177      }
178    };
179    $('.slider-pro').each(function () {
180      var opt = $(this).data();
181      var number_of_slide = $(this).find('.sp-slide').length;
182      $(this).addClass(opt.type || 'center');
183      if (!this.hasAttribute('data-type')) {
184        return true;
185      }
186      var options = $.extend(
187        true,
188        sliderDefaults[opt.type] || sliderDefaults.center,
189        {}
190      );
191      if (opt.width) {
192        options.width = opt.width;
193      }
194      if (opt.height) {
195        options.height = opt.height;
196      }
197      if (typeof opt.distance !== 'undefined') {
198        options.slideDistance = opt.distance;
199      }
200      if (opt.type == 'contents') {
201        if (opt.width || opt.height) {
202          options.aspectRatio =
203            Math.round((options.width / options.height) * 100) / 100;
204        }
205        if (number_of_slide % 2 === 0) {
206          options.visibleSize =
207            options.width * (number_of_slide - 1) +
208            options.slideDistance * (number_of_slide - 2);
209        }
210      }
211      if (typeof opt.autoplay !== 'undefined') {
212        options.autoplay = opt.autoplay;
213      }
214      if (typeof opt.arrows !== 'undefined') {
215        switch (opt.arrows) {
216          case false:
217            options.arrows = false;
218            $(this).addClass('disable-arrows');
219            break;
220          case 'pc-only':
221            var bp = 768 - scrollbarWidth - 1;
222            options.breakpoints[bp] = options.breakpoints[bp] || {};
223            options.breakpoints[bp].arrows = false;
224            $(this).addClass('sp-disable-arrows');
225            break;
226        }
227      }
228      if (typeof opt.buttons !== 'undefined') {
229        switch (opt.buttons) {
230          case false:
231            options.buttons = false;
232            break;
233          case 'pc-only':
234            var bp = 768 - scrollbarWidth - 1;
235            options.breakpoints[bp] = options.breakpoints[bp] || {};
236            options.breakpoints[bp].buttons = false;
237            break;
238        }
239      }
240      $(this).sliderPro(options);
241    });
242  }
243
244  $('.slide_scroll').click(function (e) {
245    e.preventDefault();
246    var pos = $(this)
247      .closest('section')
248      .next()
249      .offset().top;
250    $('html, body').animate({
251      scrollTop: pos
252    });
253  });
254
255  // Q&A
256  // $('.qa:not(.qa-open) .question').click(function() {
257  //   $(this).toggleClass('open').next('.answer').slideToggle();
258  // });
259
260  // responsive scroll table
261  $('table.responsive-scroll').wrap(
262    '<div><div class="responsive-scroll-container"><div class="responsive-scroll-inner"></div></div><p class="sp-only text-center text-small">※横スクロールで全体を表示します。</p></div>'
263  );
264
265  // responsive list table
266  $('table.responsive-list').each(function () {
267    var header = [];
268    $(this)
269      .find('thead th')
270      .each(function () {
271        header.push($(this).text());
272      });
273    $(this)
274      .find('tbody td')
275      .each(function () {
276        $(this).attr('data-title', header[$(this).index()]);
277      });
278  });
279
280  // combine table
281  $('table.combine')
282    .closest('.col')
283    .css('margin-bottom', 0);
284
285  // Fix SP Menu
286  function fixSpMenu() {
287    var win_h = $(window).height();
288    var hdr_h = $('#header').height();
289    if (
290      $('.menu_icon').is(':visible') &&
291      $('#header').css('z-index') != 'auto'
292    ) {
293      // SP && Fixed
294      $('#header .global_nav>ul').css('max-height', win_h - hdr_h);
295    } else {
296      $('#header .global_nav>ul').css('max-height', 'none');
297    }
298  }
299
300  function fixPageTop(window) {
301    var currentPos = $(window).scrollTop();
302    var $pagetop = $('.pagetop');
303    if (currentPos > 200) {
304      $pagetop.fadeIn(200, function () {
305        $(this).removeClass('hidden');
306      });
307    } else {
308      $pagetop.fadeOut(200, function () {
309        $(this).addClass('hidden');
310      });
311    }
312  }
313
314  function fixMainSize() {
315    if ($('.main_visual').length) {
316      var mainPadding = +$('.main_visual')
317        .css('padding-top')
318        .replace('px', '');
319      var mainHeight = $('.main_visual').height();
320      return mainPadding > mainHeight ? mainPadding : mainHeight;
321    } else {
322      return false;
323    }
324  }
325
326  // Load Event
327  if (ep_theme_options.windowEventLoaded) {
328    windowLoadEvent()
329  } else {
330    $(window).on('load', windowLoadEvent);
331  }
332
333  function windowLoadEvent() {
334    headerOffset = fixMainSize();
335    footerOffset = $('#footer').offset().top;
336    headerHeight = $('#header').height();
337    $('body')
338      .removeClass('down')
339      .addClass('up')
340      .css('paddingTop', function () {
341        return $('#header').css('position') == 'fixed'
342          ? $('#header').height()
343          : 0;
344      });
345    if (typeof WOW !== 'undefined') {
346      new WOW().init();
347    }
348    fixSpMenu();
349    $('.tile').each(function () {
350      $(this)
351        .children()
352        .tile();
353    });
354  }
355
356  // Scroll Event
357  var scrolltimer = false;
358  var prevPos = 0;
359  $(window).on('scroll touchmove', function () {
360    $('body').addClass('scroll');
361    var currentPos = $(this).scrollTop();
362
363    headerOffset = fixMainSize();
364    footerOffset = $('#footer').offset().top;
365
366    if (currentPos > headerOffset) {
367      $('#header')
368        .removeClass('low')
369        .addClass('high');
370    } else {
371      $('#header')
372        .removeClass('high')
373        .addClass('low');
374    }
375
376    if (currentPos + $(this).height() > footerOffset) {
377      $('#footer')
378        .removeClass('low')
379        .addClass('high');
380    } else {
381      $('#footer')
382        .removeClass('high')
383        .addClass('low');
384    }
385
386    fixPageTop(this);
387
388    if (currentPos > prevPos && currentPos > 0) {
389      // down
390      $('body')
391        .removeClass('up')
392        .addClass('down'); //.css('paddingTop', 0);
393      if (currentPos > headerHeight) {
394        $('#header').addClass('hidden');
395      }
396    } else {
397      // up
398      $('body')
399        .removeClass('down')
400        .addClass('up')
401        .css('paddingTop', function () {
402          return $('#header').css('position') == 'fixed' ? headerHeight : 0;
403        });
404      $('#header').removeClass('hidden');
405    }
406    if (!currentPos) {
407      $('body').addClass('scrollTop');
408    } else {
409      $('body').removeClass('scrollTop');
410    }
411    prevPos = currentPos;
412
413    if (scrolltimer !== false) {
414      clearTimeout(scrolltimer);
415    }
416    scrolltimer = setTimeout(function () {
417      $('body').removeClass('scroll');
418      $('body')
419        .removeClass('down')
420        .addClass('up')
421        .css('paddingTop', function () {
422          return $('#header').css('position') == 'fixed' ? headerHeight : 0;
423        });
424      $('#header').removeClass('hidden');
425    }, 500);
426  });
427
428  // Resize Event
429  var resizetimer = false;
430  $(window).resize(function () {
431    if (resizetimer !== false) {
432      clearTimeout(resizetimer);
433    }
434    resizetimer = setTimeout(function () {
435      fixSpMenu();
436      $('.tile').each(function () {
437        $(this)
438          .children()
439          .tile();
440      });
441      headerHeight = $('#header').height();
442      headerOffset = $('#header').offset().top;
443      footerOffset = $('#footer').offset().top;
444      $('.tile').each(function () {
445        $(this)
446          .children()
447          .tile();
448      });
449    }, 200);
450  });
451
452  // main_slider
453  if ($.isFunction($().slick)) {
454    (function ($) {
455      if ($('.main_visual_slick li').length <= 1) return;
456      if ($('.main_visual').css('transform') !== 'none') {
457        var html = $('.main_visual_slick').html();
458        var $ul = $('<ul class="main_visual_slick_thumb">');
459        $('.main_visual').append($ul.html(html));
460      }
461      var fade = false;
462      var arrows = false;
463      var dots = false;
464      var speed = 500;
465      var appendArrows = $('.main_visual_slick');
466      if ($('.main_visual').css('table-layout') === 'fixed') {
467        fade = true;
468        speed = 1000;
469      }
470      if ($('.main_visual').css('list-style-position') === 'inside') {
471        arrows = true;
472        $('.main_visual').append('<div class="main_visual_arrow"></div>');
473        appendArrows = $('.main_visual_arrow');
474      }
475      if ($('.main_visual').css('list-style-type') === 'circle') {
476        dots = true;
477      }
478      var $currentSlick = null;
479      var slick = $('.main_visual_slick')
480        .on('init', function (e, slick) {
481          $(slick.$slides[0]).addClass('slick-visible-content');
482          $currentSlick = $(slick.$slides[0]);
483        })
484        .slick({
485          slidesToShow: 1,
486          autoplay: true,
487          fade: fade,
488          arrows: arrows,
489          dots: dots,
490          appendArrows: appendArrows,
491          autoplaySpeed: 5000,
492          speed: speed
493        })
494        .on('beforeChange', function (e, slick, currentSlide, nextSlide) {
495          $('[data-slick-index="' + nextSlide + '"]').addClass(
496            'slick-visible-content'
497          );
498          $currentSlick = $('[data-slick-index="' + currentSlide + '"]');
499          if ($('.main_visual_slick_thumb').length) {
500            $('.main_visual_slick_thumb_current').removeClass(
501              'main_visual_slick_thumb_current'
502            );
503            $('.main_visual_slick_thumb>li')
504              .eq(nextSlide)
505              .addClass('main_visual_slick_thumb_current');
506          }
507          if ($('.main_visual_copy').css('transform') !== 'none') {
508            var $copy = $('.main_visual_copy li');
509            $copy.eq(currentSlide).removeClass('active');
510            $copy.eq(nextSlide).addClass('active');
511          }
512        })
513        .on('afterChange', function (e, slick, currentSlide) {
514          $currentSlick.removeClass('slick-visible-content');
515        });
516      if ($('.main_visual_copy').css('transform') !== 'none') {
517        $('.main_visual_copy li')
518          .eq(0)
519          .addClass('active')
520          .show();
521      }
522      $('.main_visual_slick_thumb>li').on('click', function () {
523        var index = $(this).index();
524        slick.slick('slickGoTo', index);
525      });
526    })($);
527  }
528
529  if (
530    typeof skrollr !== 'undefined' &&
531    !$('body').hasClass('tablet') &&
532    !$('body').hasClass('mobile')
533  ) {
534    skrollr.init();
535  }
536
537  if (typeof objectFitImages !== 'undefined') {
538    objectFitImages('.ofi img');
539  }
540
541  // pc-only等のタグ前後に出てくる改行コードを除去
542  $(
543    'br.pc-only, br.sp-only, br.tablet-only, br.pc-hide, br.sp-hide, br.tablet-hide, sup, sub'
544  ).each(function () {
545    var $parent = $(this).parent();
546    if (!$parent.length) return true;
547    var html = $parent.html();
548    html = html
549      .replace(/\n/g, '')
550      .replace(/\s*?(<br class="(sp|pc|tablet)-(only|hide)([^>+?])>)\s*/g, '$1')
551      .replace(/(,|\.)(<br class="(sp|pc|tablet)-(only|hide))/g, '$1 $2')
552      .replace(/(\d)(<br class="(sp|pc|tablet)-(only|hide))/g, '$1 $2')
553      .replace(/\s*?<(sup|sub)/g, '<$1');
554    $parent.html(html);
555  });
556  // FromCake
557  $('.sweetswidget').each(function () {
558    var self = this;
559    var dataset = $(self).data();
560    var shopcode = dataset.widgetcode;
561    if (shopcode === undefined) return true;
562    var count = dataset.widgetcount !== undefined ? dataset.widgetcount : 50;
563    var class_name =
564      dataset.widgetcarousel && dataset.widgetcarousel !== undefined
565        ? 'reservation_widget_carousel_wrap'
566        : '';
567    var url = 'https://sweetsguide.jp/shop/' + shopcode + '/widget';
568    var ajaxOption = {
569      method: 'get',
570      url: url,
571      data: {
572        class_name: class_name,
573        count: count
574      },
575      dataType: 'html'
576    };
577    $.ajax(ajaxOption).done(function (html) {
578      getWidget(self, html);
579    });
580  });
581
582  function getWidget(self, html) {
583    $(self).after(html);
584    var current = $(self).next();
585    $(self).remove();
586    var $container = $(current);
587
588    customTile('h3', $container);
589    // Resize Event
590    var resizetimer = false;
591    $(window).resize(function () {
592      if (resizetimer !== false) {
593        clearTimeout(resizetimer);
594      }
595      resizetimer = setTimeout(function () {
596        customTile('h3', $container);
597      }, 200);
598    });
599    function customTile(selector, $container) {
600      var $selector = $(selector, $container);
601      var h, max;
602      var last = $selector.length - 1;
603      $selector
604        .each(function (i) {
605          $(this).removeAttr('style');
606        })
607        .each(function (i) {
608          h = $(this).outerHeight();
609          if (i === 0 || h > max) max = h;
610          if (i == last) {
611            $selector.each(function (i) {
612              $(this).css('height', max);
613            });
614          }
615        });
616    }
617    if (!$container.hasClass('reservation_widget_carousel_wrap')) return true;
618    var length = $('>li', $container).length;
619    if (length <= 4) {
620      $container.removeClass('reservation_widget_carousel_wrap');
621      return;
622    }
623    $container.removeClass('row_inline');
624    $('>li', $container).each(function () {
625      $(this)
626        .removeClass('span_3 col')
627        .addClass('reservation_widget_carousel');
628    });
629    $container.after('<div class="reservation_widget_arrow"></div>');
630    appendArrows = $container.next();
631    var slickOption = {
632      slidesToShow: 4,
633      autoplay: true,
634      arrows: true,
635      dots: true,
636      appendArrows: appendArrows,
637      responsive: [
638        {
639          breakpoint: 900,
640          settings: {
641            slidesToShow: 3
642          }
643        },
644        {
645          breakpoint: 768,
646          settings: {
647            slidesToShow: 2
648          }
649        }
650      ]
651    };
652    $container.slick(slickOption);
653    customTile('h3', $container);
654  }
655
656  // 遅延読み込み時のtile強制発火
657  if (typeof MutationObserver !== 'undefined') {
658    // IE10-
659    var observer = new MutationObserver(function () {
660      $(window).trigger('resize');
661    });
662
663    var config = {
664      attributes: true,
665      childList: true,
666      characterData: true
667    };
668
669    $('.tile .lazy-hidden').each(function () {
670      observer.observe(this, config);
671    });
672  }
673}
674
675function loadFunc(callback) {
676  if (
677    sessionStorage.getItem('access') &&
678    wp_theme_options.loader.timming === 'once'
679  ) {
680    $('#loader').css({
681      display: 'none'
682    });
683    callback();
684  } else {
685    setTimeout(function () {
686      callback();
687      $('#loader').fadeOut(wp_theme_options.loader.fadeout);
688    }, wp_theme_options.loader.delay);
689  }
690  sessionStorage.setItem('access', wp_theme_options.loader.timming);
691}
692
693window.addEventListener('DOMContentLoaded', function () {
694  if (
695    typeof wp_theme_options !== 'undefined' &&
696    wp_theme_options.loader &&
697    wp_theme_options.loader.enable &&
698    !(wp_theme_options.loader.home_only && !wp_theme_options.is_front)
699  ) {
700    loadFunc(main);
701  } else {
702    main();
703  }
704});
705
706window.onpageshow = function (event) {
707  if (event.persisted) {
708    window.location.reload();
709  }
710}
711
712var ep_theme_options = typeof ep_theme_options !== 'undefined' ? ep_theme_options : {};
713ep_theme_options.windowEventLoaded = false;
714window.addEventListener('load', function () {
715  ep_theme_options.windowEventLoaded = true;
716});
717
718  

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.