PageSourceSearch

https://www.jpasta.net/wp-content/themes/jpasta2.com_theme/assets/js/main.js?t=1791256327

js jpasta.net collected 2026-10-06 15:21:34 UTC 19,067 bytes, 557 lines download raw bytes

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

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.