PageSourceSearch

https://www.bcl-brand.jp/js/usr/goods.js?v=260319

js bcl-brand.jp collected 2026-10-02 16:29:50 UTC 5,117 bytes, 163 lines download raw bytes

1var ecblib = ecblib || {};
2ecblib.customize = ecblib.customize || {};
3ecblib.customize.goods = ecblib.customize.goods || {};
4
5(function () {
6  'use strict';
7
8  var _goods = ecblib.customize.goods;
9
10}());
11
12
13// 最近見た商品などを移動
14jQuery(function () {
15  const brandFooter = jQuery('.goods_brand_contents');
16  const topicFooter = jQuery('.goods_topic_contents');
17  const goodsAnnotations = jQuery('.block-goods-detail .postage');
18  const goodsFooter = jQuery('.pane-main .pane-goods-footer');
19  const itemHistory = jQuery('.pane-contents #goodsdetail_itemhistory');
20
21  if (goodsAnnotations.length) {
22    // .pane-contents の後ろに挿入
23    goodsAnnotations.appendTo('.pane-goods-right-side form');
24  }
25  // どちらか存在する場合のみ処理
26  if (itemHistory.length) {
27    const goodsWrap = jQuery('<div class="goods-footer-contents"></div>');
28
29    // 存在する要素をラップに追加
30    brandFooter.length && goodsWrap.append(brandFooter);
31    goodsFooter.length && goodsWrap.append(goodsFooter);
32    topicFooter.length && goodsWrap.append(topicFooter);
33    itemHistory.length && goodsWrap.append(itemHistory);
34
35    // .pane-contents の後ろに挿入
36    goodsWrap.insertAfter('.pane-contents');
37  }
38
39  jQuery(".goods_information_block .tab").on("click", function () {
40    jQuery(".active").removeClass("active");
41    jQuery(this).addClass("active");
42    const index = jQuery(".goods_information_block .tab").index(this);
43    jQuery(".goods_information_block .content").removeClass("show").eq(index).addClass("show");
44  });
45
46  jQuery(".goods_comment_faq .faq_ttl").on("click", function () {
47    jQuery(this).next().slideToggle();
48    jQuery(this).toggleClass("open");
49  });
50});
51
52jQuery(function () {
53  function addIcon(target) {
54    const $desc = jQuery(target);
55    if ($desc.find('.block-icon').length === 0) {
56      $desc.prepend('<div class="block-icon"><span class="block-icon--src1"></span></div>');
57    }
58  }
59
60  // 既存要素に適用
61  jQuery('.block-thumbnail-t--goods-description').each(function () {
62    addIcon(this);
63  });
64
65  // 動的追加を監視
66  const observer = new MutationObserver(function (mutations) {
67    mutations.forEach(function (mutation) {
68      jQuery(mutation.addedNodes).each(function () {
69        if (jQuery(this).hasClass('block-thumbnail-t--goods-description')) {
70          addIcon(this);
71        }
72        // 子要素の中に含まれる場合も対応
73        jQuery(this).find('.block-thumbnail-t--goods-description').each(function () {
74          addIcon(this);
75        });
76      });
77    });
78  });
79  observer.observe(document.body, {
80    childList: true,
81    subtree: true
82  });
83});
84
85jQuery(function () {
86  function setMatchHeight() {
87    jQuery('.block-thumbnail-t--goods-name').matchHeight('destroy');
88    jQuery('.block-thumbnail-t--price-infos').matchHeight('destroy');
89
90    jQuery('.block-thumbnail-t--goods-name').matchHeight();
91    jQuery('.block-thumbnail-t--price-infos').matchHeight();
92  }
93
94  setMatchHeight();
95
96  const observer = new MutationObserver(function (mutations) {
97    mutations.forEach(function (mutation) {
98      if (mutation.addedNodes.length) {
99        setMatchHeight();
100      }
101    });
102  });
103  observer.observe(document.body, {
104    childList: true,
105    subtree: true
106  });
107});
108
109jQuery(function () {
110  // 要素の数合わせ variation-nameとblock-iconの枠を追加
111  jQuery('.block-accessory-list').each(function () {
112    // `.block-icon` が存在するか確認
113    if (jQuery('.block-icon').length === 0) {
114      return; // 1つもなければ何もしない
115    }
116    jQuery('.block-pickup-list-p--item-description').each(function () {
117      const $desc = jQuery(this);
118      // この要素内に .block-icon がない場合のみ追加
119      if ($desc.find('.block-icon').length === 0) {
120        $desc.prepend('<div class="block-icon"><span class="block-icon--src1"></span></div>');
121      }
122    });
123  });
124  jQuery(function () {
125    jQuery('.block-pickup-list-p--goods-name').matchHeight();
126    jQuery('.block-pickup-list-p--price-infos').matchHeight();
127    jQuery('.block-pickup-list-p--comment').matchHeight();
128  });
129});
130
131// アイコン確認
132jQuery(function () {
133  if (!jQuery('body').hasClass('page-search')) return;
134  
135  const items = jQuery('.block-pickup-list-p--items > li');
136
137  // 4つずつ処理
138  for (let i = 0; i < items.length; i += 4) {
139    const group = items.slice(i, i + 4);
140
141    // グループ内にiconがあるか
142    const hasIcon = group.find('.block-icon').length > 0;
143
144    // 1つでもあれば全てに追加
145    if (hasIcon) {
146      group.each(function () {
147        const icon = jQuery(this).find('.block-icon');
148
149        // すでにある場合は何もしない(重複防止)
150        if (icon.length === 0) {
151          jQuery(this)
152            .find('.block-pickup-list-p--item-description')
153            .prepend('<div class="block-icon"></div>');
154        }
155      });
156    }
157  }
158
159  // 高さソロえ
160  jQuery('.block-pickup-list-p--goods-name').matchHeight();
161  jQuery('.block-pickup-list-p--price-infos').matchHeight();
162  jQuery('.block-icon').matchHeight();
163});

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.