PageSourceSearch

https://www.daiei.co.jp/kywp/wp-content/themes/kohyo/assets/js/common.js?ver=1.0.0

js daiei.co.jp collected 2026-10-02 05:51:50 UTC 22,373 bytes, 657 lines download raw bytes

1;jQuery(function ($) {
2    // PC,SPでの画像の切替え
3    // PC,SPで切り替える画像のsrcを一旦退避し読み込まないようにする
4    $('.pc img, img.pc, .sp img, img.sp').each(function () {
5        var $this = $(this);
6        $this.data('src', $this.attr('src'));
7        if ($this.is(':hidden')) {
8            $this.attr('src', '');
9        }
10    });
11    // リサイズ時に画像を読み込む
12    var resizeTimer;
13    $(window).on('resize', function() {
14        clearTimeout(resizeTimer);
15        resizeTimer = setTimeout(function() {
16            imageLoad();
17        }, 200);
18    });
19    imageLoad();
20    // 表示される画像を読み込む
21    function imageLoad()
22    {
23        $('.pc img:visible, img.pc:visible, .sp img:visible, img.sp:visible').each(function () {
24            var $this = $(this);
25            $this.attr('src', $this.data('src'));
26        });
27    }
28
29    // 「ページトップへ」の表示
30    $('.pageTopFix').hide();
31    $(window).scroll(function () {
32        var scrollHeight = $(document).height();
33        var scrollPosition = $(window).height() + $(window).scrollTop();
34        var topSpan = 100;    //上端から○pxで表示
35        var bottomSpan = 100;    //下端から○pxで非表示
36
37        if ($(this).scrollTop() > topSpan ) {
38            if ((scrollHeight - scrollPosition) < bottomSpan ) {
39                //$('.pageTopFix').fadeOut();
40                $('.pageTopFix').fadeIn();
41            } else {
42                $('.pageTopFix').fadeIn();
43            }
44        } else {
45            $('.pageTopFix').fadeOut();
46        }
47    });
48
49    // textareaの高さ自動調整
50    if ($('textarea.autosize').length) {
51        autosize($('textarea.autosize'));
52    }
53
54    // ドロワーメニュー
55    if ($('.gnavButton').length > 0 && $('.gnavOverlay').length > 0) {
56        $('.gnavButton').click(function () {
57            switchGnav(!$(this).hasClass('active'));
58        });
59        $('.gnavOverlay').click(function () {
60            switchGnav(false);
61        });
62        function switchGnav(isSw) {
63            var $button = $('.gnavButton'),
64                menuWidth = $('.gnav').width();
65
66            if (isSw) {
67                $('.gnavOverlay').show();
68                $('.contentsBase').addClass('blur');
69                $name = $button.find('.fa-bars').removeClass('fa-bars').addClass('fa-close').end().find('.name');
70                $name.text($name.data('openedName'));
71                $button.stop().animate({'left': menuWidth}, 300, 'easeOutQuart', function () {
72                    $button.addClass('active');
73                });
74                $('.gnav').stop().animate({'left': 0}, 300, 'easeOutQuart');
75                $('html').addClass('gnavOpen');
76                $('body').addClass('gnavOpen');
77            } else {
78                $name = $button.find('.fa-close').removeClass('fa-close').addClass('fa-bars').end().find('.name');
79                $name.text($name.data('closedName'));
80                $button.stop().animate({'left': 0}, 300, 'easeOutQuart', function () {
81                    $button.removeClass('active');
82                });
83                $('.gnav').stop().animate({'left': -menuWidth}, 300, 'easeOutQuart');
84                $('.contentsBase').removeClass('blur');
85                $('.gnavOverlay').hide();
86                $('html').removeClass('gnavOpen');
87                $('body').removeClass('gnavOpen');
88            }
89        }
90    }
91
92    // ドロップダウンメニュー
93    if ($('.dropdownMenu').length > 0) {
94        $('.dropdownMenu').find('.name').click(function () {
95            var $childMenu = $(this).parents('.dropdownMenu').find('.childMenu');
96            if ($childMenu.is(':hidden')) {
97                $childMenu.slideDown();
98            } else {
99                $childMenu.slideUp();
100            }
101            return false;
102        });
103    }
104
105    // スライド
106    $('.bxslider').each(function () {
107        if ($(this).find('li').length > 1) {
108            var $bxslider = $(this).bxSlider({
109                'controls': true,
110                'auto': true,
111                minSlides  : 1,
112                maxSlides  : 1,
113                moveSlides : 1,
114                'speed': 1000,
115                'pause': 5000,
116                onSlideAfter: function ($slideElement, oldIndex, newIndex) {
117                    $bxslider.startAuto();
118                }
119            });
120        }
121    });
122
123    // スライド2
124    var w = $(window).width();
125    var x = 768;
126    if (w >= x) { // PC
127        var ww = 6;
128        var mm = 20;
129        var sw = 157;
130    } else { // SP
131        var ww = 3;
132        var mm = 10;
133        var sw = 154;
134    }
135    var $bxslider2 = $('.bxslider2').bxSlider({
136        speed: 500,
137        auto: true,
138        controls: false,
139        pager: false,
140        pause: 4000,
141        maxSlides: ww,
142        minSlides: ww,
143        slideWidth: sw,
144        moveSlides: 1,
145        slideMargin: mm,
146        onSlideAfter: function ($slideElement, oldIndex, newIndex) {
147            $bxslider2.startAuto();
148        }
149    });
150
151    // bxSliderのtouchstart内でe.preventDefault()されるため
152    // スマホでリンクがタップできない問題を修正
153    // タップ(移動なし)とスワイプ(移動あり)を判別して遷移する
154    (function () {
155        var startX, startY, startTime;
156        var $slider = $('.bxslider2').closest('.bx-viewport');
157        $slider
158            .on('touchstart', function (e) {
159                var touch = e.originalEvent.changedTouches[0];
160                startX = touch.pageX;
161                startY = touch.pageY;
162                startTime = Date.now();
163            })
164            .on('touchend', function (e) {
165                var touch = e.originalEvent.changedTouches[0];
166                var dx = Math.abs(touch.pageX - startX);
167                var dy = Math.abs(touch.pageY - startY);
168                var dt = Date.now() - startTime;
169                if (dx < 10 && dy < 10 && dt < 300) {
170                    var $link = $(e.target).closest('a');
171                    if ($link.length && $link.attr('href')) {
172                        window.location.href = $link.attr('href');
173                    }
174                }
175            });
176    })();
177
178    //スライド3
179    // var slider3;
180    // var sliderflag = false;
181
182    // //読み込み時初回実行
183    // sliderSetting();
184
185    // // リサイズ時の実行
186    // $(window).on('resize', function () {
187    //     sliderSetting();
188    // });
189
190    // function sliderSetting() {
191    //     var width = $('body').width();
192
193    //     if (width < 768 && sliderflag === false ) {
194    //         slider3 = $('.bxslider3').bxSlider({
195    //             'controls': false,
196    //             'auto': true,
197    //             pager: false,
198    //             minSlides  : 1,
199    //             maxSlides  : 3,
200    //             moveSlides : 1,
201    //             'speed': 1000,
202    //             'pause': 5000,
203    //             onSlideAfter: function ($slideElement, oldIndex, newIndex) {
204    //                 $bxslider.startAuto();
205    //             }
206    //         });
207    //         sliderflag = true;
208
209    //     } else if (width >= 768 && sliderflag === true ) {
210    //         slider3.destroySlider();
211    //         sliderflag = false;
212    //     }
213    // }
214
215    // スライド4
216    // $('.bxslider4').each(function () {
217    //     if ($(this).find('li').length > 1) {
218    //         var $bxslider = $(this).bxSlider({
219    //             'controls': false,
220    //             'auto': true,
221    //             minSlides  : 1,
222    //             maxSlides  : 5,
223    //             moveSlides : 1,
224    //             'speed': 1000,
225    //             'pause': 5000,
226    //             onSlideAfter: function ($slideElement, oldIndex, newIndex) {
227    //                 $bxslider.startAuto();
228    //             }
229    //         });
230    //     }
231    // });
232
233    // スライド5
234    // $('.bxslider5').each(function () {
235    //     if ($(this).find('li').length > 1) {
236    //         var $bxslider = $(this).bxSlider({
237    //             'controls': false,
238    //             'auto': true,
239    //             minSlides  : 1,
240    //             maxSlides  : 5,
241    //             moveSlides : 1,
242    //             'speed': 1000,
243    //             'pause': 5000,
244    //             onSlideAfter: function ($slideElement, oldIndex, newIndex) {
245    //                 $bxslider.startAuto();
246    //             }
247    //         });
248    //     }
249    // });
250
251    // スライド6
252    // $('.bxslider6').each(function () {
253    //     if ($(this).find('li').length > 1) {
254    //         var $bxslider = $(this).bxSlider({
255    //             'controls': false,
256    //             'auto': true,
257    //             minSlides  : 1,
258    //             maxSlides  : 3,
259    //             moveSlides : 1,
260    //             'speed': 1000,
261    //             'pause': 5000,
262    //             onSlideAfter: function ($slideElement, oldIndex, newIndex) {
263    //                 $bxslider.startAuto();
264    //             }
265    //         });
266    //     }
267    // });
268
269    // スライド:mainImg
270    $(".slickSlider.mainImg").slick({
271        arrows: true,
272        dots: false,
273        infinite: true,
274        centerMode: true,
275        slidesToShow: 1,
276        slidesToScroll: 1,
277//        centerPadding: '24.7%',
278        centerPadding: 'calc((100% - 980px)/2)',
279        autoplay:true,
280        autoplaySpeed: 6000,
281        responsive: [
282            {
283            breakpoint: 1070,
284                settings: {
285                    centerPadding: 'calc((100% - 768px)/2)',
286                }
287            },
288            {
289            breakpoint: 767,
290                settings: {
291                    arrows:false,
292                    dots: true,
293                    infinite: true,
294                    slidesToShow: 1,
295                    slidesToScroll: 1,
296                    centerMode: true,
297                    centerPadding: '0',
298                }
299            }
300        ]
301    });
302
303
304    // スライド:slick pickup
305    $(".slickSlider.pickup").slick({
306        arrows: false,
307        dots: true,
308        infinite: true,
309        centerMode: true,
310        slidesToShow: 3,
311        slidesToScroll: 1,
312        centerPadding: '0',
313        autoplay:true,
314        autoplaySpeed: 6000,
315        responsive: [{
316            breakpoint: 767,
317                settings: {
318                    arrows:false,
319                    dots:false,
320                    infinite: true,
321                    slidesToShow: 1,
322                    slidesToScroll: 1,
323                    centerMode: true,
324                    centerPadding: '12%',
325                }
326        }]
327    });
328
329
330    // スライド:slick shop
331    $(".slickSlider.shop").slick({
332        arrows:false,
333        dots: true,
334        infinite: true,
335        centerMode: true,
336        slidesToShow: 4,
337        slidesToScroll: 1,
338        centerPadding: '10%',
339        autoplay:true,
340        autoplaySpeed: 6000,
341        responsive: [{
342            breakpoint: 767,
343                settings: {
344                    arrows:false,
345                    dots:true,
346                    infinite: true,
347                    slidesToShow: 1,
348                    slidesToScroll: 1,
349                    centerMode: true,
350                    centerPadding: '12%',
351                }
352        }]
353    });
354
355
356    // スライド:slick channel
357    $(".slickSlider.channel").slick({
358        arrows:false,
359        dots: true,
360        infinite: true,
361        centerMode: true,
362        slidesToShow: 4,
363        slidesToScroll: 1,
364        centerPadding: '10%',
365        autoplay:true,
366        autoplaySpeed: 6000,
367        responsive: [{
368            breakpoint: 767,
369                settings: {
370                    arrows:false,
371                    dots:true,
372                    infinite: true,
373                    slidesToShow: 2,
374                    slidesToScroll: 1,
375                    centerMode: true,
376                    centerPadding: '0',
377                }
378        }]
379    });
380
381
382    // スライド:slick campaign
383    $(".slickSlider.campaign").slick({
384        arrows:false,
385        dots: true,
386        infinite: true,
387        centerMode: true,
388        slidesToShow: 4,
389        slidesToScroll: 1,
390        centerPadding: '12%',
391        autoplay:true,
392        autoplaySpeed: 6000,
393        responsive: [{
394            breakpoint: 767,
395                settings: {
396                    arrows:false,
397                    dots:false,
398                    infinite: true,
399                    slidesToShow: 1,
400                    slidesToScroll: 1,
401                    centerMode: true,
402                    centerPadding: '12%',
403                }
404        }]
405    });
406
407
408
409
410
411
412   // 店舗詳細ページのスライド
413    $('.storeslider').each(function () {
414        if ($(this).find('li').length > 1) {
415            var $bxslider = $(this).bxSlider({
416                'controls': false,
417                'auto': true,
418                maxSlides: 3,
419                minSlides: 1,
420                slideWidth: 620,
421                'speed': 1000,
422                'pause': 5000,
423		 moveSlides: 1,
424                onSlideAfter: function ($slideElement, oldIndex, newIndex) {
425                    $bxslider.startAuto();
426                }
427            });
428        }
429    });
430
431    // タブ
432    if ($('.tabGroup').length > 0) {
433        var $firstTab = $('.tabMenu li a').on('click', function () {
434            if (!$(this).hasClass('disabled')) {
435                // ボックスが非表示なら切り替える
436                if ($($(this).attr('href')).is(':hidden')) {
437                    switchTab($(this));
438                }
439            }
440            return false;
441        }).first();
442
443        // 最初のタブに切替え
444        switchTab($firstTab);
445
446        // タブ切替え
447        function switchTab($this) {
448            $('.tabMenu li').removeClass('active');
449            // 同じグループのボックスをすべて非表示にする
450            $this.parents('.tabGroup').find('.tabBox').slideUp();
451            // 指定のタブのボックスを表示する
452            $($this.attr('href')).fadeToggle();
453            $this.parents('li').addClass('active');
454        }
455
456
457
458    }
459    $('.close__btn').click(function() {
460         $(this).parents('.tab-wrap').css({'max-height' : '0'});
461    });
462    $('.tab-label').click(function() {
463         $(this).siblings('.tab-wrap').css({'max-height' : '50vh'});
464    });
465
466    // フロアで探す、ジャンルで探すタブ
467    if ($('.storeFloorGuide__tab').length > 0) {
468        $('.storeFloorGuide__tab-item').on('click', function() {
469            const mode = $(this).data('mode');
470
471            // タブのアクティブ切り替え
472            $('.storeFloorGuide__tab-item').removeClass('is-active');
473            $(this).addClass('is-active');
474
475            // 本体の表示切り替え
476            $('.storeFloorGuide__content-item').hide();
477            $('.' + mode + '-mode').show();
478        });
479    }
480
481    // 沿革:年代別タブ(ダイエーから転用)
482    if ($('.tab_link').length > 0) {
483        function GethashID (hashIDName){
484            if(hashIDName){
485                //タブ設定
486                $('.tab_link li').find('a').each(function() {
487                var idName = $(this).attr('href');
488                if(idName == hashIDName){
489                    var parentElm = $(this).parent();
490                    $('.tab_link li').removeClass("active");
491                    $(parentElm).addClass("active");
492                    //表示させるエリア設定
493                    $(".area").removeClass("is-active");
494                    $(hashIDName).addClass("is-active");
495                }
496                });
497            }
498        }
499
500        //タブをクリックしたら
501        $('.tab_link a').on('click', function() {
502            var idName = $(this).attr('href');
503            GethashID (idName);
504            return false;
505        });
506
507        // 上記の動きをページが読み込まれたらすぐに動かす
508        $(window).on('load', function () {
509            $('.tab_link li:first-of-type').addClass("active");
510            $('.area:first-of-type').addClass("is-active");
511            var hashName = location.hash;
512            GethashID (hashName);
513        });
514
515        //ページ下部の前/次の年代リンクをクリックしたら
516        $('.year_link a').on('click', function() {
517            var idName = $(this).attr('href');
518            GethashID (idName);
519            return false;
520        });
521
522        $('.year_link a[href*="#"]').click(function () {
523            var pos = $('.tab_link').offset().top;
524            $('body,html').animate({scrollTop: pos}, 0);
525            return false;
526        });
527    }
528
529    // 店舗高さ揃える
530    $('.matchHeightGroup > .matchHeight').matchHeight();
531    $('.matchHeightGroup > .matchHeight > h4').matchHeight();
532    $('.matchHeightGroup > .matchHeight > .shopInfo').matchHeight();
533
534    //サイトマップの項目の高さをそろえる
535    $('.pageSitemap .siteBlock .item').matchHeight();
536
537    //レシピ一覧の高さをそろえる
538    $('.pageRecipes .recipe').matchHeight();
539
540    //Line店舗一覧
541    $('.pageLine #kohyo .store li .left h4').matchHeight();
542
543    //journal高さ揃える
544    $('.matchHeightGroup > .matchHeight > .journalInfo').matchHeight();
545    //社会貢献高さ揃える
546    $('.matchHeight > .socialInfo').matchHeight();
547    $('.subMenu li').matchHeight();
548
549    Fancybox.bind(".modalYoutubeButton", {
550        iframe: {
551            preload: false,
552        },
553    });
554
555    $('.mw_wp_form_input .error').parents('td').addClass('error');
556
557    $('.pulldownLink').on('change', function () {
558        var url = $('option:selected', this).val();
559        if (url) {
560            window.location.href = url;
561        }
562        return false;
563    });
564
565    if ($('#autoAddress').length) {
566        $('#autoAddress').on('click', function (e) {
567            AjaxZip3.zip2addr('zip[data][0]', 'zip[data][1]', 'address01', 'address01');
568        });
569    }
570
571    /* スクロール関連 */
572    // ページトップへ
573    $('.pageTopFix, .pageTop, .pageTopBlock').targetScroller({
574        target: 'html',
575        duration: 800,
576        easing: 'easeOutQuint'
577    });
578    // サイト内リンク
579    $('a.scroll[href^="#"]').targetScroller({
580        duration: 800,
581        easing: 'easeOutQuint',
582        header: 'header.header'
583    });
584    $('a[href^="#"]:not(.noscroll)').targetScroller({
585        duration: 800,
586        easing: 'easeOutQuint',
587        header: 'header.header'
588    });
589    // ハッシュによるロード時のスクロール
590    $.targetScroller({
591        duration: 800,
592        easing: 'easeOutQuint',
593        header: 'header.header'
594    });
595
596    // タブの画像切り替え.
597    $('.tabImageBox .tab li').on('click', function() {
598        // タブ部分.
599        const tabImageList = $('.tabImageBox .tab li img');
600        // 画像を非アクティブにする.
601        tabImageList.each(function() {
602            const src = $(this).attr('src');
603            $(this).attr('src', src.replace('_on', ''));
604        });
605        // 押下されたタブの画像に_onを付与する.
606        const currentImage = $(this).find('img');
607        const currentsrc = currentImage.attr('src');
608        const match = currentsrc.match(/^(.*?)(\.[^.]+)$/);
609        if (match) {
610            currentImage.attr('src', match[1] + '_on' + match[2]);
611        }
612
613        // タブに対応したコンテンツを表示する.
614        const tabId = $(this).data('tab-id');
615        $('.tabImageBox .tabContentsBox .tabItem').removeClass('active');
616        $(`.tabImageBox .tabContentsBox .tabItem:nth-of-type(${tabId})`).addClass('active');
617    });
618
619    // タブ切り替え.
620    $('.tabListBox .tab li').on('click', function() {
621        // タブ部分.
622        $('.tabListBox .tab li').removeClass('active');
623        // タブに対応したコンテンツを表示する.
624        const tabId = $(this).data('tab-id');
625        $(this).addClass('active');
626        $('.tabListBox .tabContentsBox .tabItem').removeClass('active');
627        $(`.tabListBox .tabContentsBox .tabItem:nth-of-type(${tabId})`).addClass('active');
628    });
629
630    // Webからのお問い合わせの返信をご希望の方で「希望しない」場合の表示.
631    if($('.pageContact .form01').length > 0) {
632        $('.pageContact .form01 input[name="send"]').on('change', function() {
633            if ('希望しない' === $(this).val()) {
634                $(this).parents('.mainBox').find('.sendOption').addClass('nosend');
635                $('.pageContact .sendOption input[type="text"]').prop('disabled', true);
636            } else {
637                $(this).parents('.mainBox').find('.sendOption').removeClass('nosend');
638                $('.pageContact .sendOption input[type="text"]').prop('disabled', false);
639            }
640        });
641
642        if ('希望しない' === $('.pageContact.index .form01 input[name="send"]:checked').val()
643        || '希望しない' === $('.pageContact.confirm .form01 input[name="send"]').val()) {
644            $('.pageContact .sendOption').addClass('nosend');
645            $('.pageContact .sendOption input[type="text"]').prop('disabled', true);
646        }
647    }
648    if($('.pageContact .mw_wp_form').length > 0) {
649        const errors = $('.pageContact .mw_wp_form .error');
650        const headerHeight = $('header.header').height();
651        if (errors.length > 0) {
652            const errorForm = $('.pageContact #Contactform');
653            const offset = errorForm.offset().top;
654            $('html, body').animate({ scrollTop: offset - headerHeight }, 500);
655        }
656    }
657});

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.