PageSourceSearch

https://kyotsukudani.com/template/default/js/function.js?v=3.0.13

js kyotsukudani.com collected 2026-10-09 02:56:23 UTC 12,470 bytes, 366 lines download raw bytes

1$(function () {
2
3    /////////// Drawer menu
4
5    $('.nav-trigger').on('click', function (event) {
6        event.preventDefault();
7        if ($('.drawer-open #drawer').size() == 0) {
8            $('.overlay').addClass('is-visible');
9            $('#wrapper').addClass('drawer-open');
10        } else {
11            $('#wrapper').removeClass('drawer-open');
12            $('.overlay').removeClass('is-visible');
13            toggleCart('close')
14        }
15        return false;
16    });
17
18    //open cart form
19    $('.cart-trigger').on('click', function (event) {
20        event.preventDefault();
21        toggleCart();
22        $('#wrapper').removeClass('drawer-open');
23
24    });
25
26    //close lateral menu on mobile
27    $('.overlay').on('swiperight', function () {
28        if ($('#wrapper').hasClass('drawer-open')) {
29            $('#wrapper').removeClass('drawer-open');
30            $('.overlay').removeClass('is-visible');
31        }
32    });
33    $('.overlay').on('click', function () {
34        $('#wrapper').removeClass('drawer-open');
35        toggleCart('close')
36        $('.overlay').removeClass('is-visible');
37    });
38
39    function toggleCart(type) {
40        if (type == "close") {
41            //close cart
42            $('.cart').removeClass('is-visible');
43            $('.cart-trigger').removeClass('cart-is-visible');
44            $('.overlay').removeClass('cart-is-visible');
45        } else {
46            //toggle cart visibility
47            $('.cart').toggleClass('is-visible');
48            $('.cart-trigger').toggleClass('cart-is-visible');
49            $('.overlay').toggleClass('cart-is-visible');
50            ($('.cart').hasClass('is-visible')) ? $('.overlay').addClass('is-visible') : $('.overlay').removeClass('is-visible');
51        }
52    }
53
54
55    /////////// category accordion
56    $("#category li .toggle").on('click', function () {
57        var togglepanel = $(this).parent('a').next('ul');
58        if (togglepanel.css("display") == "none") {
59            $(this).parent('a').addClass("active");
60            togglepanel.slideDown(300);
61        } else {
62            $(this).parent('a').removeClass("active");
63            togglepanel.slideUp(300);
64        }
65        return false;
66    });
67
68    /////////// アコーディオン
69    $(".accordion dl dt").on('click', function () {
70        if ($(this).parent('dl').children('dd').css('display') == 'none') {
71            $(this).addClass('active');
72            $(this).parent('dl').children('dd').slideDown(300);
73        } else {
74            $(this).removeClass('active');
75            $(this).parent('dl').children('dd').slideUp(300);
76        }
77        return false;
78    });
79
80    /////////// スムーススクロール
81    $('a.anchor').on('click', function () {
82        var speed = 400;//スクロール速度 単位:ミリ秒
83        var href = $(this).attr("href");
84        var destination = $(href == "#" || href == "" ? 'html' : href);
85        var position = destination.offset().top;
86        $("html,body").animate({scrollTop: position}, speed, 'swing');
87        return false;
88    });
89
90    /////////// dropdownの中をクリックしても閉じないようにする
91    $(".dropdown-menu").click(function (e) {
92        e.stopPropagation();
93    });
94
95    /////////// 追従サイドバー + ページトップフェードイン
96
97    // スクロールした時に以下の処理
98    $(window).on("scroll", function () {
99        // ページトップフェードイン
100        if ($(this).scrollTop() > 300) {
101            $('.pagetop').fadeIn();
102        } else {
103            $('.pagetop').fadeOut();
104        }
105
106        //PC表示の時のみに適用
107        if (window.innerWidth > 767) {
108
109            if ($('#shopping_confirm').length) {
110
111                var side = $("#confirm_side"),
112                    wrap = $("#shopping_confirm"),
113                    min_move = wrap.offset().top,
114                    max_move = min_move + wrap.height() - side.height() - 2 * parseInt(side.css("top")),
115                    margin_bottom = max_move - min_move;
116
117                var scrollTop = $(window).scrollTop();
118                if (scrollTop > min_move && scrollTop < max_move) {
119                    var margin_top = scrollTop - min_move;
120                    side.css({"margin-top": margin_top});
121                } else if (scrollTop < min_move) {
122                    side.css({"margin-top": 0});
123                } else if (scrollTop > max_move) {
124                    side.css({"margin-top": margin_bottom});
125                }
126
127            }
128        }
129        return false;
130    });
131
132    // マスク処理
133    $('.prevention-mask').on('click', function() {
134        $overlay = $('<div class="prevention-masked">');
135        $('body').append($overlay);
136    });
137
138    // ダブルクリック禁止
139    $('.prevention-btn').on('click', function() {
140        $(this).attr('disabled', 'disabled');
141        var $form = $(this).parents('form');
142        // マスク表示させるためsetTimeoutを使って処理を遅らせる
143        setTimeout(function(){
144            $form.submit();
145        }, 0);
146        return false;
147    });
148
149});
150
151
152/////////// ロールオーバー
153$.fn.rollover = function () {
154    return this.each(function () {
155        var src = $(this).attr('src');
156        if (src.match('_on.')) return;
157        var src_on = src.replace(/^(.+)(\.[a-z]+)$/, "$1_on$2");
158        $('').attr('src', src_on);
159        $(this).hover(
160            function () {
161                $(this).attr('src', src_on);
162            },
163            function () {
164                $(this).attr('src', src);
165            }
166        );
167    });
168};
169
170// 画像をロールオーバーする箇所(imgタグ)を指定
171$(function () {
172    $('.rollover').rollover();
173});
174
175
176/////////// 高さ揃え
177/**
178 * jquery.matchHeight-min.js v0.6.0
179 * http://brm.io/jquery-match-height/
180 * License: MIT
181 */
182(function (c) {
183    var n = -1, f = -1, g = function (a) {
184        return parseFloat(a) || 0
185    }, r = function (a) {
186        var b = null, d = [];
187        c(a).each(function () {
188            var a = c(this), k = a.offset().top - g(a.css("margin-top")), l = 0 < d.length ? d[d.length - 1] : null;
189            null === l ? d.push(a) : 1 >= Math.floor(Math.abs(b - k)) ? d[d.length - 1] = l.add(a) : d.push(a);
190            b = k
191        });
192        return d
193    }, p = function (a) {
194        var b = {byRow: !0, property: "height", target: null, remove: !1};
195        if ("object" === typeof a)return c.extend(b, a);
196        "boolean" === typeof a ? b.byRow = a : "remove" === a && (b.remove = !0);
197        return b
198    }, b = c.fn.matchHeight =
199        function (a) {
200            a = p(a);
201            if (a.remove) {
202                var e = this;
203                this.css(a.property, "");
204                c.each(b._groups, function (a, b) {
205                    b.elements = b.elements.not(e)
206                });
207                return this
208            }
209            if (1 >= this.length && !a.target)return this;
210            b._groups.push({elements: this, options: a});
211            b._apply(this, a);
212            return this
213        };
214    b._groups = [];
215    b._throttle = 80;
216    b._maintainScroll = !1;
217    b._beforeUpdate = null;
218    b._afterUpdate = null;
219    b._apply = function (a, e) {
220        var d = p(e), h = c(a), k = [h], l = c(window).scrollTop(), f = c("html").outerHeight(!0), m = h.parents().filter(":hidden");
221        m.each(function () {
222            var a = c(this);
223            a.data("style-cache", a.attr("style"))
224        });
225        m.css("display", "block");
226        d.byRow && !d.target && (h.each(function () {
227            var a = c(this), b = "inline-block" === a.css("display") ? "inline-block" : "block";
228            a.data("style-cache", a.attr("style"));
229            a.css({
230                display: b,
231                "padding-top": "0",
232                "padding-bottom": "0",
233                "margin-top": "0",
234                "margin-bottom": "0",
235                "border-top-width": "0",
236                "border-bottom-width": "0",
237                height: "100px"
238            })
239        }), k = r(h), h.each(function () {
240            var a = c(this);
241            a.attr("style", a.data("style-cache") || "")
242        }));
243        c.each(k, function (a, b) {
244            var e = c(b), f = 0;
245            if (d.target)f =
246                d.target.outerHeight(!1); else {
247                if (d.byRow && 1 >= e.length) {
248                    e.css(d.property, "");
249                    return
250                }
251                e.each(function () {
252                    var a = c(this), b = {display: "inline-block" === a.css("display") ? "inline-block" : "block"};
253                    b[d.property] = "";
254                    a.css(b);
255                    a.outerHeight(!1) > f && (f = a.outerHeight(!1));
256                    a.css("display", "")
257                })
258            }
259            e.each(function () {
260                var a = c(this), b = 0;
261                d.target && a.is(d.target) || ("border-box" !== a.css("box-sizing") && (b += g(a.css("border-top-width")) + g(a.css("border-bottom-width")), b += g(a.css("padding-top")) + g(a.css("padding-bottom"))), a.css(d.property,
262                    f - b))
263            })
264        });
265        m.each(function () {
266            var a = c(this);
267            a.attr("style", a.data("style-cache") || null)
268        });
269        b._maintainScroll && c(window).scrollTop(l / f * c("html").outerHeight(!0));
270        return this
271    };
272    b._applyDataApi = function () {
273        var a = {};
274        c("[data-match-height], [data-mh]").each(function () {
275            var b = c(this), d = b.attr("data-mh") || b.attr("data-match-height");
276            a[d] = d in a ? a[d].add(b) : b
277        });
278        c.each(a, function () {
279            this.matchHeight(!0)
280        })
281    };
282    var q = function (a) {
283        b._beforeUpdate && b._beforeUpdate(a, b._groups);
284        c.each(b._groups, function () {
285            b._apply(this.elements,
286                this.options)
287        });
288        b._afterUpdate && b._afterUpdate(a, b._groups)
289    };
290    b._update = function (a, e) {
291        if (e && "resize" === e.type) {
292            var d = c(window).width();
293            if (d === n)return;
294            n = d
295        }
296        a ? -1 === f && (f = setTimeout(function () {
297            q(e);
298            f = -1
299        }, b._throttle)) : q(e)
300    };
301    c(b._applyDataApi);
302    c(window).bind("load", function (a) {
303        b._update(!1, a)
304    });
305    c(window).bind("resize orientationchange", function (a) {
306        b._update(!0, a)
307    })
308})(jQuery);
309
310// 高さ揃えの要素を指定
311$(function () {
312
313    $('.pickup_item').matchHeight({
314        byRow: true,
315        property: 'height'
316    });
317
318    $('.product_item .item_name').matchHeight({
319        byRow: true,
320        property: 'height'
321    });
322    $('button.thumbnail').matchHeight({
323        byRow: true,
324        property: 'height'
325    });
326    $('#login_box > div').matchHeight({});
327});
328
329// anchorをクリックした時にformを裏で作って指定のメソッドでリクエストを飛ばす
330// Twigには以下のように埋め込む
331// <a href="PATH" {{ csrf_token_for_anchor() }} data-method="(put/delete/postのうちいずれか)" data-confirm="xx
331xx" data-message="xxxx">
332//
333// オプション要素
334// data-confirm : falseを定義すると確認ダイアログを出さない。デフォルトはダイアログを出す
335// data-message : 確認ダイアログを出す際のメッセージをデフォルトから変更する
336//
337$(function () {
338    var createForm = function (action, data) {
339        var $form = $('<form action="' + action + '" method="post"></form>');
340        for (input in data) {
341            if (data.hasOwnProperty(input)) {
342                $form.append('<input name="' + input + '" value="' + data[input] + '">');
343            }
344        }
345        return $form;
346    };
347
348    $('a[token-for-anchor]').click(function (e) {
349        e.preventDefault();
350        var $this = $(this);
351        var data = $this.data();
352        if (data.confirm != false) {
353            if (!confirm(data.message ? data.message : '削除してもよろしいですか?')) {
354                return false;
355            }
356        }
357
358        var $form = createForm($this.attr('href'), {
359            _token: $this.attr('token-for-anchor'),
360            _method: data.method
361        }).hide();
362
363        $('body').append($form); // Firefox requires form to be on the page to allow submission
364        $form.submit();
365    });
366});

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.