PageSourceSearch

https://store.kai-group.com/js/usr/user.js

js kai-group.com collected 2026-09-24 17:55:18 UTC 13,097 bytes, 362 lines download raw bytes

1var ecblib = ecblib || {};
2ecblib.customize = ecblib.customize || {};
3ecblib.customize.user = ecblib.customize.user || {};
4
5jQuery(function () {
6  var _user = ecblib.customize.user;
7
8  //-- トップページへ戻る初期値
9  if (jQuery('#footer_pagetop').length > 0) {
10    jQuery('#footer_pagetop').hide();
11    jQuery('#footer_pagetop a').attr("href", "#");
12    if (jQuery('#searchGoodsPc').length > 0) {
13      jQuery('#footer_pagetop').append('<a href="#"></a>');
14    }
15  }
16
17  //--- スムーススクロール
18  jQuery('a[href^="#"]').click(function () {
19    const headerH = jQuery('#header').outerHeight();
20    let speed = 500;
21    let href = jQuery(this).attr("href");
22    let target = jQuery(href == "#" || href == "" ? 'html' : href);
23    let position = target.offset().top - headerH;
24    jQuery('body,html').animate({ scrollTop: position }, speed, 'swing');
25    return false;
26  });
27
28  //--- 別ページからのアンカーリンク
29  if (location.hash) {
30    const target = jQuery(location.hash);
31    if (target.length) {
32      const headerH = jQuery('#header').outerHeight();
33      setTimeout(function () {
34        const position = target.offset().top - headerH;
35        jQuery('body, html').animate({ scrollTop: position }, 500, 'swing');
36      }, 100);
37    }
38  }
39
40  // アコーディオン
41  jQuery(document).on('click', '.js-accordion', function () {
42    jQuery(this).toggleClass('active');
43    jQuery(this).next().slideToggle();
44  });
45
46  // タブ切り替え
47  jQuery(document).on('click', '.js-event-tab li', function () {
48    const index = jQuery(this).parent('.js-event-tab').find('li').index(this);
49    const frame = jQuery(this).parent('.js-event-tab').next('.block-top-event--container').find('.block-top-event--frame');
50    jQuery(this).addClass('active').siblings('li').removeClass('active');
51    frame.removeClass('active');
52    frame.eq(index).addClass('active');
53  });
54
55  // header
56  if (jQuery('#header').length > 0) {
57    const header = jQuery('#header');
58    const headerMain = jQuery('.header-main');
59    let headerMainOffsetTop = headerMain.offset().top;
60    const headerMainH = headerMain.outerHeight();
61
62    jQuery(window).on('scroll', function () {
63      const scrollTop = jQuery(window).scrollTop();
64      if (scrollTop >= headerMainOffsetTop) {
65        header.addClass('fixed');
66        jQuery('.wrapper').css('padding-top', headerMainH);
67      } else {
68        header.removeClass('fixed');
69        jQuery('.wrapper').css('padding-top', '');
70      }
71    });
72  }
73
74  // header menu
75  jQuery(document).on('click', '.js-header-btn', function () {
76    const btn = jQuery(this);
77    const contents = btn.next('.header-contents');
78    const bg = btn.siblings('.header-contents-bg');
79
80    jQuery('.js-header-btn').not(btn).removeClass('active');
81    jQuery('.header-contents').not(contents).fadeOut();
82    jQuery('.header-contents-bg').not(bg).fadeOut();
83
84    if (btn.hasClass('active')) {
85      btn.removeClass('active');
86      contents.fadeOut();
87      bg.fadeOut();
88    } else {
89      btn.addClass('active');
90      contents.fadeIn();
91      bg.fadeIn();
92    }
93  });
94  jQuery(document).on('click', '.header-contents-bg', function () {
95    jQuery('.js-header-btn').removeClass('active');
96    jQuery('.header-contents').fadeOut();
97    jQuery('.header-contents-bg').fadeOut();
98  });
99
100  // マウスでドラッグできるように
101  jQuery.prototype.draggable = function () {
102    var t;
103    jQuery(this).each(function (i, e) {
104      jQuery(e).mousedown(function (e2) {
105        e2.preventDefault();
106        t = jQuery(e);
107        jQuery(e).data({
108          down: true,
109          x: e2.clientX,
110          y: e2.clientY,
111          left: jQuery(e).scrollLeft(),
112          top: jQuery(e).scrollTop()
113        });
114      });
115    });
116    jQuery(document).mousemove(function (e) {
117      if (jQuery(t).data('down')) {
118        e.preventDefault();
119        jQuery(t).scrollLeft(jQuery(t).data('x') + jQuery(t).data('left') - e.clientX);
120        jQuery(t).scrollTop(jQuery(t).data('y') + jQuery(t).data('top') - e.clientY);
121      }
122    }).mouseup(function (e) {
123      jQuery(t).data('down', false);
124    });
125  };
126
127  // 左メニュー子要素なしの場合は非表示
128  if ((jQuery('.pane-left-menu').length > 0) && (jQuery('.pane-left-menu').find('#block_of_filter').length === 0)) {
129    function isEmpty(element) {
130      return jQuery.trim(element.html()) === '';
131    }
132
133    const leftMenu = jQuery('.pane-left-menu');
134    const leftTop = isEmpty(leftMenu.find('.block-left-menu-top'));
135    const leftMiddle = isEmpty(leftMenu.find('.block-left-menu-middle'));
136    const leftBottom = isEmpty(leftMenu.find('.block-left-menu-bottom'));
137
138    if (leftTop && leftMiddle && leftBottom) {
139      leftMenu.hide();
140    }
141  }
142
143  // カテゴリページ・ジャンルページ
144  if ((jQuery('.block-category-list').length > 0) || (jQuery('.block-genre-page').length > 0)) {
145
146    if (jQuery('.block-category-list').length > 0) {
147      // タイトル、子カテゴリを上に移動
148      jQuery('.pane-contents>.container').prepend(jQuery('.block-category-list--sub')).prepend(jQuery('[class*="block-category-list--header"]'));
149
150      // 子カテゴリをアコーディオンに変更
151      const categoryList = jQuery('.block-category-list--sub');
152      const categoryContents = categoryList.children();
153
154      if (categoryContents.length > 0) {
155        categoryContents.wrapAll('<div class="block-category-list--container"></div>');
156        categoryList.prepend('<button class="block-category-list--button 
156js-accordion" type="button">カテゴリ一覧</button>');
157        categoryList.find('.block-category-list--container').hide();
158      }
159    }
160
161    if (jQuery('.block-genre-page').length > 0) {
162      // タイトル、子ジャンルを上に移動
163      jQuery('.pane-contents>.container').prepend(jQuery('.block-genre-style')).prepend(jQuery('[class*="block-genre-page--header"]'));
164
165      // 子ジャンルをアコーディオンに変更
166      const genreList = jQuery('.block-genre-style');
167      const genreItem = genreList.children('.block-genre-style--item');
168
169      if (genreItem.length > 0) {
170        genreItem.wrapAll('<div class="block-genre-style--container"><div class="block-genre-style--items"></div></div>');
171        genreList.prepend('<button class="block-genre-style--button js-accordion" type="button">ジャンル一覧</button>');
172        genreList.find('.block-genre-style--container').hide();
173      }
174    }
175
176    jQuery('.pane-contents').addClass('is-show');
177  }
178
179  // 絞り込み名変更
180  if (jQuery('.block-filter--header').length > 0) {
181    jQuery('.block-filter--header').text('絞り込み');
182  }
183
184  // 並び替え・表示方法
185  const sort = jQuery('.block-goods-list--sort-order-items');
186  const display = jQuery('.block-goods-list--display-style-items');
187  if ((sort.length > 0) || (display.length > 0)) {
188    // 並び替え・表示方法をまとめる
189    if (!jQuery(".block-goods-list--frame").length > 0) {
190      const frame = jQuery('<div class="block-goods-list--frame"></div>');
191      if (display.length > 0) {
192        display.before(frame);
193      } else if (sort.length > 0) {
194        sort.before(frame);
195      } else if (jQuery(".block-goods-list--pager-top").length > 0) {
196        jQuery(".block-goods-list--pager-top").before(frame);
197      }
198      frame.append(sort).append(jQuery('.block-goods-list--pager-top')).append(display);
199    }
200
201    // 並び替え
202    if (sort.length > 0) {
203      jQuery('.block-goods-list--sort-order-items dt').html('<span>並び替え</span>');
204    }
205    jQuery(document).on('click', '.block-goods-list--sort-order-items dt', function () {
206      jQuery(this).closest('.block-goods-list--sort-order-items').toggleClass('active');
207    });
208
209    // 表示方法にクラス付与
210    display.find('dd').each(function () {
211      var text = jQuery(this).text();
212      if (text == '商品詳細') { jQuery(this).addClass('is-thumbnail'); }
213      if (text == 'ピックアップ(1列)') { jQuery(this).addClass('is-pickup'); }
214    });
215  }
216
217  // 最近チェックした商品
218  if (jQuery('#block_of_itemhistory').length > 0) {
219    const target = jQuery('#block_of_itemhistory');
220    const observer = new MutationObserver(() => {
221      setTimeout(() => {
222        observer.disconnect();
223
224        if (target.find('.block-recent-item--header').length > 0) {
225          target.find('.block-recent-item--header').text('最近チェックした商品');
226        }
227        if (target.find('.block-recent-item--items ul li').length > 8) {
228          const slider = target.find('.block-recent-item--items');
229          if (slider.siblings('.swiper-button-prev').length === 0 && slider.siblings('.swiper-button-next').length === 0) {
230            slider.after('<div class="swiper-button-prev"></div><div class="swiper-button-next"></div>');
231          }
232          slider.addClass('swiper');
233          slider.find('ul').addClass('swiper-wrapper');
234          slider.find('li').addClass('swiper-slide');
235          new Swiper(slider[0], {
236            loop: false,
237            speed: 600,
238            slidesPerView: 8,
239            spaceBetween: 30,
240            navigation: {
241              nextEl: slider.siblings('.swiper-button-next')[0],
242              prevEl: slider.siblings('.swiper-button-prev')[0],
243            },
244          });
245        }
246      }, 100);
247    });
248    observer.observe(target[0], {
249      childList: true,
250      subtree: true
251    });
252  }
253
254  // Aireco slider 6商品
255  if (jQuery('.js-recommend-slider-06').length > 0) {
256    const target = jQuery('.js-recommend-slider-06');
257    const observer = new MutationObserver(() => {
258      observer.disconnect();
259      const slider = target.find('.block-thumbnail-t');
260      if (target.find('.block-thumbnail-t li dl').length <= 6) {
261        slider.addClass('swiper-disabled');
262      } else {
263        slider.after('<div class="swiper-button-prev"></div><div class="swiper-button-next"></div>');
264        new Swiper(slider[0], {
265          loop: false,
266          speed: 600,
267          slidesPerView: 6,
268          spaceBetween: 30,
269          navigation: {
270            nextEl: slider.siblings('.swiper-button-next')[0],
271            prevEl: slider.siblings('.swiper-button-prev')[0],
272          },
273        });
274      }
275    })
276    observer.observe(target[0], {
277      childList: true,
278    })
279  }
280
281  // AiReco slider 3商品
282  if (jQuery('.js-recommend-slider-03').length > 0) {
283    const target = jQuery('.js-recommend-slider-03');
284    const observer = new MutationObserver(() => {
285      observer.disconnect();
286      const slider = target.find('.block-thumbnail-t');
287      if (target.find('.block-thumbnail-t li dl').length <= 3) {
288        slider.addClass('swiper-disabled');
289      } else {
290        slider.after('<div class="swiper-button-prev"></div><div class="swiper-button-next"></div>');
291        new Swiper(slider[0], {
292          loop: false,
293          speed: 600,
294          slidesPerView: 3,
295          spaceBetween: 30,
296          navigation: {
297            nextEl: slider.siblings('.swiper-button-next')[0],
298            prevEl: slider.siblings('.swiper-button-prev')[0],
299          },
300        });
301      }
302    })
303    observer.observe(target[0], {
304      childList: true,
305    })
306  }
307
308  // 電話で注文
309  if (jQuery('.js-tel-link').length > 0) {
310    const phoneNumber = '0120-587-911';
311    jQuery('.js-tel-link').attr('href', 'tel:' + phoneNumber.replace(/-/g, ''));
312    jQuery('.js-tel-link').find('.number').text(phoneNumber);
313  }
314
315  // カート
316  if (jQuery('.block-cart').length > 0) {
317    // レイアウト変更
318    jQuery('.block-cart--goods-list li').each(function () {
319      const item = jQuery(this);
320      const frame = jQuery('<div class="block-cart--goods-list-container"></div>');
321      const icon = item.children('.block-icon');
322      const name = item.children('.block-cart--goods-list-item');
323      const price = item.children('.block-cart--goods-list-item-price-info');
324      const input = item.children('.block-cart--goods-list-item-input');
325      jQuery(this).children('a').after(frame);
326      frame.append(name).append(price).append(icon).append(input);
327
328      // 商品コード追加
329      // const code = item.find('input[name^="rowgoods"]').val();
330      // const codeHtml = `
331      //   <dl class="block-cart--goods-list-item-code">
332      //     <dt>商品コード</dt>
333      //     <dd>${code}</dd>
334      //   </dl>
335      // `;
336      // price.after(codeHtml);
337    });
338
339    // 最近チェックした商品
340    if (jQuery('#cart_itemhistory').length > 0) {
341      const target = jQuery('#cart_itemhistory');
342      const observer = new MutationObserver(() => {
343        setTimeout(() => {
344          observer.disconnect();
345          jQuery('.block-cart .block-goods-list-c ul').draggable();
346        }, 100);
347      });
348      observer.observe(target[0], {
349        childList: true,
350        subtree: true
351      });
352    }
353  }
354});
355
356jQuery(window).on('scroll resize', function () {
357  if (jQuery(this).scrollTop() > 120) {
358    jQuery('#footer_pagetop').show();
359  } else if (jQuery(this).scrollTop() < 80) {
360    jQuery('#footer_pagetop').hide();
361  }
362});

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.