PageSourceSearch

https://www.ni-allure.co.jp/wp-content/themes/ni-allure2.com_theme/assets/js/main.js?t=1791343389

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

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.