PageSourceSearch

https://www.regal.co.jp/js/sys/goods_compare.js

js regal.co.jp collected 2026-10-02 02:27:24 UTC 5,270 bytes, 117 lines download raw bytes

1var eclib = eclib || {};
2eclib.compgoods = eclib.compgoods || {};
3
4function _goodsCompUtil(){
5    //比較商品の選択数を取得
6    this.getAmountOfCompGoods = function(){
7        let cookieGoods = jQuery.cookie('RegalOnline_CompGoods');
8        let cookieGoodsList = [];
9        if(cookieGoods !== undefined){
10            cookieGoodsList = cookieGoods.split(',').filter(function(v){ return v });
11        }
12        return cookieGoodsList;
13    }
14
15    //比較商品のカウント、スライダー表示、比較リスト採番のリセット
16    this.compCheckCountProcNum = function(){
17
18        jQuery(".block-product-comparison-follow-item").each(function(index, element){
19            jQuery(element).attr("data-compgoods-number", index + 1);
20        });
21
22        let compGoodsCountElem = jQuery('.block-product-comparison-follow-count-btn span');
23        let visibleElementsCount = this.getAmountOfCompGoods().length;
24        compGoodsCountElem.text(visibleElementsCount);
25
26        if(visibleElementsCount == 0){
27            jQuery('.block-product-comparison-follow-count-btn').hide();
28        }else{
29            if(!jQuery('.block-product-comparison-follow-bk').hasClass('follow-open')){
30                jQuery('.block-product-comparison-follow-count-btn').show();
31            }else{
32                jQuery('.block-product-comparison-follow-count-btn').hide();
33            }
34        }
35
36        let compGoodsNextSliderArrow = jQuery('.block-product-comparison-follow-list > button.slide-next');
37        let compGoodsPrevSliderArrow = jQuery('.block-product-comparison-follow-list > button.slide-prev');
38        let pageCount = Number(jQuery("#compGoods_PageCount").val());
39
40        if(pageCount <= 1){
41            compGoodsPrevSliderArrow.addClass('no-more');
42        }else{
43            compGoodsPrevSliderArrow.removeClass('no-more');
44        }
45
46        if(visibleElementsCount - pageCount >= 3){
47            compGoodsNextSliderArrow.removeClass('no-more');
48        }else{
49            compGoodsNextSliderArrow.addClass('no-more');
50        }
51    }
52
53    //比較商品の追加
54    this.addSelectedGoods = function(goods){
55        let cookieGoodsList = this.getAmountOfCompGoods();
56        if(cookieGoodsList.indexOf(goods) != -1) {
57            return;
58        }
59
60        cookieGoodsList.push(goods);
61        jQuery.cookie('RegalOnline_CompGoods', cookieGoodsList.join(), { expires: 365, path: '/', secure: true });
62        this.addGoodsInfoToCompList(goods);
63    }
64
65    //商品の情報を比較リストに追加
66    this.addGoodsInfoToCompList = function(goods){
67        jQuery.ajax({
68            url: EC_WWW_ROOT + "/api/goodslistapi.aspx",
69            type: 'GET',
70            data: {
71                goods: goods,
72                type: 'json'
73            },
74            dataType: 'json'
75        })
76        .done((goodsData) => {
77            if(goodsData.length == 0){
78                this.removeSelectedGoods(goods);
79                alert("商品情報の取得に失敗しました。");
80                return;
81            }
82            let goodsCompTmpl = jQuery(jQuery('template#GoodsCompTemp').html());
83            goodsCompTmpl.attr('data-goods-code', goodsData[0]['goods']);
84            goodsCompTmpl.attr('data-compgoods-number', (this.getAmountOfCompGoods().length - this.getAmountOfCompGoods().indexOf(goods)));
85            goodsCompTmpl.find('.block-product-comparison-follow-img figure img').attr({'src': goodsData[0]['src_s'], 'alt': goodsData[0]['name']});
86            goodsCompTmpl.find('.block-product-comparison-follow-brand').text(goodsData[0]['brand_name']);
87            goodsCompTmpl.find('.block-product-comparison-follow-size').text(goodsData[0]['all_color_comment'] + ' ' + goodsData[0]['all_size_comment']);
88            goodsCompTmpl.find('.block-product-comparison-follow-price').html(goodsData[0]['format_price']);
89            jQuery('.block-product-comparison-follow-item-list').prepend(goodsCompTmpl);
90            this.compCheckCountProcNum();
91        })
92        .fail((jqXHR, textStatus, errorThrown) =>{
93            alert("商品情報の取得に失敗しました。");
94            this.removeSelectedGoods(goods);
95        });
96    }
97
98    //比較商品の削除
99    this.removeSelectedGoods = function(goods){
100        let cookieGoodsList = this.getAmountOfCompGoods();
101        if(cookieGoodsList.indexOf(goods) > -1) {
102            cookieGoodsList = cookieGoodsList.filter(function(v){ return goods != v});
103            jQuery.cookie('RegalOnline_CompGoods', cookieGoodsList.join(), { expires: 365, path: '/', secure: true });
104        }
105        jQuery(".block-product-comparison-follow-item[data-goods-code='" + goods + "']").remove();
106        jQuery(".js-goodslist-compcheck[data-goodscheck='" + goods + "']").prop("checked", false);
107
108        let pageCount = Number(jQuery("#compGoods_PageCount").val());
109        if(cookieGoodsList.length == 4 && (pageCount == 3 || pageCount == 2)){
110            jQuery("#compGoods_PageCount").val("2");
111        }else{
112            jQuery("#compGoods_PageCount").val("1");
113        }
114        this.compCheckCountProcNum();
115    }
116}
117var goodsCompUtil = new _goodsCompUtil();

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.