PageSourceSearch

https://www.jrcp-shop.jp/view/asset/user-1-1-2-3adf01b0a2bb1424424b231b6458c5f3.js

js jrcp-shop.jp collected 2026-10-04 08:01:03 UTC 21,154 bytes, 643 lines download raw bytes

1$(function() {
2    var _window = $(window),
3        _header = $('header');
4
5    _window.on('scroll', function() {
6        if(_window.scrollTop() > 20){
7            _header.addClass('fixed');
8        } else {
9            _header.removeClass('fixed');
10        }
11    });
12
13    function isMobile() {
14        return window.matchMedia("(max-width: 768px)").matches;
15    }
16
17    function toggleModeSpClass() {
18        if (isMobile()) {
19            $('body').addClass('mode-sp');
20        } else {
21            $('body').removeClass('mode-sp');
22        }
23    }
24
25    // 初回判定 + resize時にクラス付け替え
26    toggleModeSpClass();
27    $(window).on('resize', toggleModeSpClass);
28
29    // カテゴリーアコーディオン
30    if (isMobile()) {
31      $('.accordion-open').each(function() {
32        var $icon = $(this);
33
34        if ($icon.hasClass('is-open')) {
35          // 静的に is-open が付いている場合は必ず「-」
36          //$icon.text('-');
37        } else {
38          // それ以外はサブメニューの表示状態で判定
39          var $link = $icon.closest('a');
40          var $subMenu = $link.siblings('.block-category-tree--level-2, .block-category-tree--level-3');
41
42          if ($subMenu.is(':visible')) {
43            $icon.addClass('is-open');
44          } else {
45            $icon.removeClass('is-open');
46          }
47        }
48      });
49    } else {
50      // 初期化: .accordion-open要素にデフォルトのアイコン「+」を設定
51      $('.accordion-open').each(function() {
52        var $icon = $(this);
53
54        if ($icon.hasClass('is-open')) {
55          // 静的に is-open が付いている場合は必ず「-」
56          $icon.text('-');
57        } else {
58          // それ以外はサブメニューの表示状態で判定
59          var $link = $icon.closest('a');
60          var $subMenu = $link.siblings('.block-category-tree--level-2, .block-category-tree--level-3');
61
62          if ($subMenu.is(':visible')) {
63            $icon.text('-').addClass('is-open');
64          } else {
65            $icon.text('+').removeClass('is-open');
66          }
67        }
68      });
69    }
70
71    if (isMobile()) {
72      $('.block-category-tree--level-1 > li:has(.block-category-tree--level-2) > a .accordion-open, .block-category-tree--level-1 > li:has(.block-category-tree--level-2) > div .accordion-open').on('click', function (e) {
73        //console.log("Mobile");
74        e.preventDefault();
75        e.stopPropagation();
76
77        var $icon = $(this);
78        var $link = $icon.closest('a, div');
79        var $subMenu = $link.siblings('.block-category-tree--level-2');
80
81
82        if($(this).hasClass('is-open')) {
83          $icon.removeClass('is-open');
84          $subMenu.slideUp();
85
86        } else {
87          $icon.addClass('is-open');
88          $subMenu.slideDown();
89        }
90      });
91
92      $('.block-category-tree--level-2 > li:has(.block-category-tree--level-3) > a .accordion-open').on('click', function (e) {
93        e.preventDefault();
94        e.stopPropagation();
95
96        var $icon = $(this);
97        var $link = $icon.closest('a');
98        var $subMenu = $link.siblings('.block-category-tree--level-3');
99
100
101        if($(this).hasClass('is-open')) {
102          $icon.removeClass('is-open');
103          $subMenu.slideUp();
104        } else {
105          $icon.addClass('is-open');
106          $subMenu.slideDown();
107        }
108      });
109    } else {
110      $('.block-category-tree--level-1 > li:has(.block-category-tree--level-2) > a .accordion-open').on('click', function (e) {
111        //console.log("PC");
112        e.preventDefault();
113        e.stopPropagation();
114
115        var $icon = $(this);
116        var $link = $icon.closest('a');
117        var $subMenu = $link.siblings('.block-category-tree--level-2');
118
119
120        if($(this).hasClass('is-open')) {
121          $icon.removeClass('is-open').text('+');
122          $subMenu.slideUp();
123
124/*           //$(this).removeClass('is-open');
125          $icon.removeClass('is-open');
126          $icon.text('+'); 
127          $subMenu.slideDown(); */
128
129        } else {
130          $icon.addClass('is-open').text('-');
131          $subMenu.slideDown();
132
133/*           //$(this).addClass('is-open');
134
135          $icon.addClass('is-open');
136          $icon.text('-'); 
137          $link.siblings('.block-category-tree--level-2').slideDown(); */
138
139        }
140      });
141
142      $('.block-category-tree--level-2 > li:has(.block-category-tree--level-3) > a .accordion-open').on('click', function (e) {
143        e.preventDefault();
144        e.stopPropagation();
145
146        var $icon = $(this);
147        var $link = $icon.closest('a');
148        var $subMenu = $link.siblings('.block-category-tree--level-3');
149
150
151        if($(this).hasClass('is-open')) {
152          //$(this).removeClass('is-open');
153
154          $icon.removeClass('is-open').text('+');
155          $subMenu.slideUp();
156
157
158        } else {
159          //$(this).addClass('is-open');
160
161          $icon.addClass('is-open').text('-');
162          $subMenu.slideDown();
163        }
164      });
165    }
166
167    // スマホメニュー
168    $('.sp-menunavi').on('click', function() {
169        var openClass = '.sub-categories';
170        if ($(this).hasClass('campaign-title')) {
171            openClass = '.campaign-list';
172        } else if($(this).hasClass('sp-menu')) {
173            openClass = '.sp-menu-hide';
174        }
175        if ($(this).hasClass('open')) {
176            $(this).removeClass('open');
177            $(this).children('.menunavi-arrow').removeClass('up');
178            $(this).next(openClass).removeClass('open');
179        } else {
180            $('.menunavi-wrap').find('.menunavi-arrow').removeClass('up');
181            $('.menunavi-wrap').find('.open').removeClass('open');
182            $(this).addClass('open');
183            $(this).children('.menunavi-arrow').addClass('up');
184            $(this).next(openClass).addClass('open');
185        }
186    });
187
188    // ヘッダーメニュー
189    $('.nav-item').on('click', function() {
190        var isOpen = $(this).hasClass('now');
191        
192        $('.menunavi-wrap').find('.menunavi-arrow').removeClass('up');
193        $('.menunavi-wrap').find('.open').removeClass('open');
194        $('.nav-item').removeClass('now');
195        $('.head-nav-icon').removeClass('up');
196        $('.menunavi-wrap').removeClass('open');
197        $('.menunavi').removeClass('open');
198        
199        if (!isOpen) {
200            var menuClass = $(this).attr('class').split(' ')[1];
201            switch (menuClass) {
202                case 'nav-category':
203                    $('.menunavi-category').addClass('open');
204                    break;
205                case 'nav-price':
206                    $('.menunavi-price').addClass('open');
207                    break;
208                case 'nav-area':
209                    $('.menunavi-area').addClass('open');
210                    break;
211                case 'menu-icon':
212                    $('.menunavi-wrap').addClass('open');
213                    break;
214                default:
215                    break;
216            }
217            $(this).addClass('now');
218            $(this).find('.head-nav-icon').addClass('up');
219        }
220    });
221    $('body').on('click', '.menunavi-title:not(a)', function() {
222      if($(this).closest('.menunavi-wrap.open').length > 0) {
223        $(this).toggleClass('now');
224        $(this).next('.menunavi-content').slideToggle();
225      }
226    });
227    $('body').on('click', '.menunavi-subcategory-title', function() {
228      $(this).toggleClass('now');
229      $(this).next('.menunavi-subcategory-list').slideToggle();
230    });
231    $('.nav-item-close').on('click', function() {
232      $('.nav-item.now').trigger('click');
233      return false;
234    });
235
236    // 検索フォーム
237    $('.nav-search-input').on('keypress', function(e) {
238        if (e.keyCode == 13) {
239            $('.search-btn-link')[0].click();
240        }
241    });
242    $('.sp-search-input').on('keypress', function(e) {
243        if (e.keyCode == 13) {
244            $('.sp-search-btn-link')[0].click();
245        }
246    });
247    
248    // カレンダー
249    $('.calendar-slick').slick({
250        infinite: false,
251        prevArrow: '<span class="slick-arrow slick-prev material-icons">arrow_left</span>',
252        nextArrow: '<span class="slick-arrow slick-next material-icons">arrow_right</span>'
253    });
254    $('.day-list').each(function() {
255        var month = $(this).attr('data-month');
256        var day = $(this).attr('data-day');
257        var color = $(this).attr('data-color');
258
259        $('.makeshop-calendar' + month +' .day' + day).css({
260            'background-color': color,
261            'color': '#fff',
262            'font-weight': 'bold'
263        });
264    });
265    
266    // WebFont
267    WebFontConfig = {
268        google: {
269            families: ['Noto+Sans+JP', 'Lato', 'Poppins']
270        }
271    };
272    (function (d) {
273        var wf = d.createElement('script'), s = d.scripts[0];
274        wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js';
275        wf.async = true;
276        s.parentNode.insertBefore(wf, s);
277    })(document);
278
279    // アンカーリンク
280    $('a[href^="#"]').on("click", function() {
281      if($($(this).attr('href')).length == 0) {
282        return false;
283      }
284      let target_href = $(this).attr('href');
285      let target_pos = $(target_href).position().top;
286      let header_height = $('header').height();
287      $('body, html').animate({scrollTop: target_pos - header_height}, 300);
288    });
289    
290    // 商品一覧 高さ合わせ
291    $(window).on("resize", function() {
292      goodsListAutoHeight();
293    });
294    goodsListAutoHeight();
295});
296
297function goodsListAutoHeight() {
298  if(window.innerWidth > 768) {
299    $('.product-list.ranking-ul').each(function() {
300      $(this).find('.product-item-icon').tile();
301      $(this).find('.product-item-name').tile();
302      $(this).find('.product-item-pankuzu').tile();
303    });
304    $('.product-list.railway-goods-newarrival-list').each(function() {
305      $(this).find('.product-item-icon').tile(4);
306      $(this).find('.product-item-name').tile(4);
307      $(this).find('.product-item-pankuzu').tile(4);
308    });
309    $('.product-list.railway-goods-recommend-list').each(function() {
310      $(this).find('.product-item-icon').tile(4);
311      $(this).find('.product-item-name').tile(4);
312      $(this).find('.product-item-pankuzu').tile(4);
313    });
314    $('.product-list.station-goods-newarrival-list').each(function() {
315      $(this).find('.product-item-icon').tile(4);
316      $(this).find('.product-item-name').tile(4);
317      $(this).find('.product-item-pankuzu').tile(4);
318    });
319    $('.product-list.station-goods-recommend-list').each(function() {
320      $(this).find('.product-item-icon').tile(4);
321      $(this).find('.product-item-name').tile(4);
322      $(this).find('.product-item-pankuzu').tile(4);
323    });
324    $('.product-list.history-goods-list').each(function() {
325      $(this).find('.product-item-icon').tile();
326      $(this).find('.product-item-name').tile();
327      $(this).find('.product-item-pankuzu').tile();
328    });
329  } else {
330    $('.product-list.ranking-ul').each(function() {
331      $(this).find('.product-item-icon').tile();
332      $(this).find('.product-item-name').tile();
333      $(this).find('.product-item-pankuzu').tile();
334    });
335    $('.product-list.railway-goods-newarrival-list').each(function() {
336      $(this).find('.product-item-icon').tile(2);
337      $(this).find('.product-item-name').tile(2);
338      $(this).find('.product-item-pankuzu').tile(2);
339    });
340    $('.product-list.railway-goods-recommend-list').each(function() {
341      $(this).find('.product-item-icon').tile(2);
342      $(this).find('.product-item-name').tile(2);
343      $(this).find('.product-item-pankuzu').tile(2);
344    });
345    $('.product-list.station-goods-newarrival-list').each(function() {
346      $(this).find('.product-item-icon').tile(2);
347      $(this).find('.product-item-name').tile(2);
348      $(this).find('.product-item-pankuzu').tile(2);
349    });
350    $('.product-list.station-goods-recommend-list').each(function() {
351      $(this).find('.product-item-icon').tile(2);
352      $(this).find('.product-item-name').tile(2);
353      $(this).find('.product-item-pankuzu').tile(2);
354    });
355    $('.product-list.history-goods-list').each(function() {
356      $(this).find('.product-item-icon').tile();
357      $(this).find('.product-item-name').tile();
358      $(this).find('.product-item-pankuzu').tile();
359    });
360  }
361}
362$(function() {
363  // メインスライダー slick化
364  var $mainSlider = $('.main-visual-slider');
365  var $thumbnails = $('.main-visual-thumbnail li');
366
367  $mainSlider.slick({
368    arrows: false,
369    dots: false,
370    slidesToShow: 1,
371    centerMode: true,
372    centerPadding: 'calc(50% - 340px)',
373    autoplay: true,
374    autoplaySpeed: 4000
375  });
376
377  // サムネイルに連番データ属性を付与
378  $thumbnails.each(function(index) {
379    $(this).attr('data-number', index);
380  });
381
382  // 初期状態で1番目にcurrentクラス
383  $thumbnails.removeClass('current').eq(0).addClass('current');
384
385  // メインスライド切り替え時、サムネイルのcurrentを更新
386  $mainSlider.on('afterChange', function(event, slick, currentSlide) {
387    $thumbnails.removeClass('current').eq(currentSlide).addClass('current');
388  });
389
390  // サムネイルクリック時、該当スライドへ
391  $thumbnails.on('click', function() {
392    var index = $(this).data('number');
393    $mainSlider.slick('slickGoTo', index, false);
394    $thumbnails.removeClass('current');
395    $(this).addClass('current');
396  });
397});
398
399
400var thumbnail_break_flg;
401$(function() {
402  let standard_itemlist_url = "/view/page/standardgoods";
403  let railway_feature_url =  "/view/page/trainfeaturelist";
404  let railway_collaboration_url =  "/view/page/collaborationlist";
405  let station_feature_url =  "/view/page/ekinakafeature";
406  let goods_list_url =  "/view/category/traingoodstop";
407
408
409  $("section.top-standard-goods .section-wrap").each(function() {
410    let $this = $(this);
411    $.ajax({
412      type: "GET",
413      url: standard_itemlist_url,
414      cache: false,
415      dataType: "html",
416      success: function(data) {
417        if($(data).find("ul.product-list").length > 0) {
418          let $item_list = $this.find("ul.product-list.standard-goods-list");
419          $(data).find("ul.product-list li.product-item").each(function(index) {
420            if(index < 4) {
421              $item_list.append($(this));
422            }
423          });
424        }
425      },
426      error: function(xhr, status, thrown) {
427      },
428    });
429  });
430  $("section.top-railway-goods-feature .section-wrap").each(function() {
431    let $this = $(this);
432    $.ajax({
433      type: "GET",
434      url: railway_feature_url,
435      cache: false,
436      dataType: "html",
437      success: function(data) {
438        if($(data).find("ul.product-list").length > 0) {
439          let $item_list = $this.find("ul.product-list.railway-goods-feature-list");
440          $(data).find("ul.product-list li.product-item").each(function(index) {
441            if(index < 8) {
442              $item_list.append($(this));
443            }
444          });
445        }
446      },
447      error: function(xhr, status, thrown) {
448      },
449    });
450  });
451  $("section.top-railway-goods-collaboration .section-wrap").each(function() {
452    let $this = $(this);
453    $.ajax({
454      type: "GET",
455      url: railway_collaboration_url,
456      cache: false,
457      dataType: "html",
458      success: function(data) {
459        if($(data).find("ul.product-list").length > 0) {
460          let $item_list = $this.find("ul.product-list.railway-goods-collaboration-list");
461          $(data).find("ul.product-list li.product-item").each(function(index) {
462            if(index < 8) {
463              $item_list.append($(this));
464            }
465          });
466        }
467      },
468      error: function(xhr, status, thrown) {
469      },
470    });
471  });
472  $("section.top-railway-goods-newarrival .section-wrap").each(function() {
473    let $this = $(this);
474    $.ajax({
475      type: "GET",
476      url: goods_list_url,
477      data: {
478        "category_code": "traingoodstop",
479        "sort": "order",
480      },
481      cache: false,
482      dataType: "html",
483      success: function(data) {
484        if($(data).find("ul.product-list").length > 0) {
485          let $item_list = $this.find("ul.product-list.railway-goods-newarrival-list");
486          $(data).find("ul.product-list li.product-item").each(function(index) {
487            if(index < 8) {
488              $item_list.append($(this));
489            }
490          });
491        }
492      },
493      error: function(xhr, status, thrown) {
494      },
495    });
496  });
497  $("section.top-railway-goods-recommend .section-wrap").each(function() {
498    let $this = $(this);
499    $.ajax({
500      type: "GET",
501      url: goods_list_url,
502      data: {
503        "category_code": "traingoodstop",
504        "sort": "recommend",
505      },
506      cache: false,
507      dataType: "html",
508      success: function(data) {
509        if($(data).find("ul.product-list").length > 0) {
510          let $item_list = $this.find("ul.product-list.railway-goods-recommend-list");
511          $(data).find("ul.product-list li.product-item").each(function(index) {
512            if(index < 8) {
513              $item_list.append($(this));
514            }
515          });
516        }
517      },
518      error: function(xhr, status, thrown) {
519      },
520    });
521  });
522  $("section.top-station-goods-feature .section-wrap").each(function() {
523    let $this = $(this);
524    $.ajax({
525      type: "GET",
526      url: station_feature_url,
527      cache: false,
528      dataType: "html",
529      success: function(data) {
530        if($(data).find("ul.product-list").length > 0) {
531          let $item_list = $this.find("ul.product-list.station-goods-feature-list");
532          $(data).find("ul.product-list li.product-item").each(function(index) {
533            if(index < 8) {
534              $item_list.append($(this));
535            }
536          });
537        }
538      },
539      error: function(xhr, status, thrown) {
540      },
541    });
542  });
543  $("section.top-station-goods-newarrival .section-wrap").each(function() {
544    let $this = $(this);
545    $.ajax({
546      type: "GET",
547      url: goods_list_url,
548      data: {
549        "category_code": "ekinakagoodstop",
550        "sort": "order",
551      },
552      cache: false,
553      dataType: "html",
554      success: function(data) {
555        if($(data).find("ul.product-list").length > 0) {
556          let $item_list = $this.find("ul.product-list.station-goods-newarrival-list");
557          $(data).find("ul.product-list li.product-item").each(function(index) {
558            if(index < 8) {
559              $item_list.append($(this));
560            }
561          });
562        }
563      },
564      error: function(xhr, status, thrown) {
565      },
566    });
567  });
568  $("section.top-station-goods-recommend .section-wrap").each(function() {
569    let $this = $(this);
570    $.ajax({
571      type: "GET",
572      url: goods_list_url,
573      data: {
574        "category_code": "ekinakagoodstop",
575        "sort": "recommend",
576      },
577      cache: false,
578      dataType: "html",
579      success: function(data) {
580        if($(data).find("ul.product-list").length > 0) {
581          let $item_list = $this.find("ul.product-list.station-goods-recommend-list");
582          $(data).find("ul.product-list li.product-item").each(function(index) {
583            if(index < 8) {
584              $item_list.append($(this));
585            }
586          });
587        }
588      },
589      error: function(xhr, status, thrown) {
590      },
591    });
592  });
593
594  $("section.top-ranking-goods .product-list.ranking-ul").slick({
595    infinite: true,
596    arrows: true,
597    slidesToShow: 5,
598    responsive: [{
599      breakpoint: 769,
600      settings: {
601        slidesToShow: 2,
602        initialSlide: 1,
603        centerMode: true,
604        centerPadding: "4.2667%",
605      }
606    }],
607  });
608
609  $("section.top-history .product-list.history-goods-list").slick({
610    infinite: true,
611    arrows: true,
612    slidesToShow: 5,
613    responsive: [{
614      breakpoint: 769,
615      settings: {
616        slidesToShow: 2,
617        initialSlide: 1,
618        centerMode: true,
619        centerPadding: "4.2667%",
620      }
621    }],
622  });
623
624  $("section.top-category-nav .fixed-category-nav .fixed-category-nav-close").on("click", function() {
625    $(this).closest(".fixed-category-nav").hide();
626  });
627});
628
629function mv_thumbnail_slider() {
630  if(window.innerWidth > 768) {
631    $("ul.main-visual-thumbnail:not(.slick-initialized)").slick({
632      infinite: true,
633      arrows: false,
634      slidesToShow: 2,
635      centerMode: true,
636      centerPadding: "calc(50% - 167px)",
637      asNavFor: "ul.main-visual-slider",
638      focusOnSelect: true,
639    });
640  } else {
641    $("ul.main-visual-thumbnail.slick-initialized").slick('unslick');
642  }
643}

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.