PageSourceSearch

https://www.mouse-jp.co.jp/js/sys/goods_ajax_comparison.js

js mouse-jp.co.jp collected 2026-10-02 02:25:58 UTC 8,270 bytes, 173 lines download raw bytes

1jQuery(document).ready(function () {
2    //比較リスト更新(追加・削除)処理
3    var $btn_comparison = jQuery(".js_btn-comparison");
4    // styleタグ追加
5    jQuery('body').append('<style id="tooltip-comparison-added-style"></style>');
6    $btn_comparison.off("click");
7    jQuery(document).on("click", ".js_btn-comparison", function (e) {
8        var i = jQuery(this).hasClass("is_added") ? true : false;
9        var g = jQuery(this).data("comparison-goods");
10        var c = jQuery("#crsirefo_token").data("crsirefo_hidden");
11        var btnComparison = {
12            selectorBtn: '.js_btn-comparison',
13            classNameAdded: 'is_added',
14            toolTipAddLabel: '比較リストに追加しました',
15            toolTipDeleteLabel: '比較リストから削除しました',
16            toolTipHeight: 50,
17            toolTipWidth: 210,
18        }
19        var loadEnd = function (elem, id) {
20            if (id != null) {
21                setTimeout(function () {
22                    jQuery('#' + 'tooltip-comparison-added-' + id).fadeOut(500, function () {
23                        jQuery(this).remove();
24                    });
25                    jQuery(elem).removeAttr("data-comparison-click");
26                }, 3000);
27            } else {
28                jQuery(elem).removeAttr("data-comparison-click");
29            };
30        };
31        var addComparison = function (b, g, c) {
32            if (jQuery(b).attr("data-comparison-click") == "true") {
33                return false;
34            }
35            jQuery(b).attr("data-comparison-click", "true");
36            jQuery.ajax({
37                async: true,
38                type: "POST",
39                url: eclib.sys.wwwroot + "/store/customer/comparisonajax.aspx",
40                data: {
41                    "goods": g,
42                    "crsirefo_hidden": c
43                },
44                cache: false,
45                ifModified: false,
46                dataType: "json",
47                success: function (contents) {
48                    jQuery(b).addClass(btnComparison.classNameAdded);
49
50                    var winWidth = jQuery(window).width();
51                    var btnWidth = jQuery(b).width();
52                    var offsetLeft = jQuery(b).offset().left;
53                    var posTop = jQuery(b).offset().top - btnComparison.toolTipHeight;
54                    var posLeft;
55                    var id = Math.random().toString(32).substring(2);
56                    if (((btnWidth / 2) - offsetLeft) >= 0) { // ボタンが画面左端に近ければ
57                        posLeft = offsetLeft;
58                        jQuery('#tooltip-comparison-added-style').html('[id^="tooltip-comparison-added-"]::after{margin-left:-' + (jQuery(b).outerWidth() / 2) + 'px;}');
59                    } else {
60                        if (jQuery(b).outerWidth() >= 210) { // 比較リストボタンのwidthが210px以上の時
61                            posLeft = offsetLeft + Math.abs(btnWidth - 210);
62                        } else {
63                            posLeft = offsetLeft - (jQuery(b).outerWidth() / 2);
64                        }
65                        jQuery('#tooltip-comparison-added-style').html('[id^="tooltip-comparison-added-"]::after{margin-left:-5px;}');
66                    }
67                    jQuery('body').append('<div class="tooltip-comparison-added" id="tooltip-comparison-added-' + id + '" style="top:' + posTop + 'px;left:' + posLeft + 'px;">' + btnComparison.toolTipAddLabel + '</div>');
68                    loadEnd(b, id);
69                },
70                error: function (xhr, status, thrown) {
71                    alert(eclib.msg.goods_ajax_bookmark.SESSION_EXPIRED);
72                    loadEnd(b, null);
73                    return false;
74                }
75            });
76            return true;
77        };
78        var removeComparison = function (b, g, c) {
79            if (jQuery(b).attr("data-comparison-click") == "true") {
80                return false;
81            }
82            jQuery(b).attr("data-comparison-click", "true");
83            jQuery.ajax({
84                async: true,
85                type: "POST",
86                url: eclib.sys.wwwroot + "/store/customer/comparisonajax.aspx",
87                data: {
88                    "goods": g,
89                    "crsirefo_hidden": c,
90                    "remove_flg": "True"
91                },
92                cache: false,
93                ifModified: false,
94                dataType: "json",
95                success: function (contents) {
96                    jQuery(b).removeClass(btnComparison.classNameAdded);
97
98                    var winWidth = jQuery(window).width();
99                    var btnWidth = jQuery(b).width();
100                    var offsetLeft = jQuery(b).offset().left;
101                    var posTop = jQuery(b).offset().top - btnComparison.toolTipHeight;
102                    var posLeft;
103                    var id = Math.random().toString(32).substring(2);
104                    if (((btnWidth / 2) - offsetLeft) >= 0) { // ボタンが画面左端に近ければ
105                        posLeft = offsetLeft;
106                        jQuery('#tooltip-comparison-added-style').html('[id^="tooltip-comparison-added-"]::after{margin-left:-' + (jQuery(b).outerWidth() / 2) + 'px;}');
107                    } else {
108                        if (jQuery(b).outerWidth() >= 210) { // 比較リストボタンのwidthが210px以上の時
109                            posLeft = offsetLeft + Math.abs(btnWidth - 210);
110                        } else {
111                            posLeft = offsetLeft - (jQuery(b).outerWidth() / 2);
112                        }
113                        jQuery('#tooltip-comparison-added-style').html('[id^="tooltip-comparison-added-"]::after{margin-left:-5px;}');
114                    }
115                    if (!(jQuery(b).hasClass("block-fixed-sidearea--comparison-table--item-delete-btn"))){
116                        jQuery('body').append('<div class="tooltip-comparison-added" id="tooltip-comparison-added-' + id + '" style="top:' 
116+ posTop + 'px;left:' + posLeft + 'px;">' + btnComparison.toolTipDeleteLabel + '</div>');
117                    }
118                    loadEnd(b, id);
119                    // jQuery('.block-fixed-sidearea--overlay').trigger('click');
120                    loadComparison();
121                    jQuery('[data-comparison-goods="' + g + '"]').removeClass('is_added');
122                },
123                error: function (xhr, status, thrown) {
124                    alert(eclib.msg.goods_ajax_bookmark.SESSION_EXPIRED);
125                    loadEnd(b, null);
126                    return false;
127                }
128            });
129            return true;
130        };
131        if (!i) {
132            addComparison(this, g, c);
133        } else {
134            removeComparison(this, g, c);
135        }
136        return false;
137    });
138    
139    //比較リスト全削除
140    jQuery(document).on("click", "#js_btn-comparison_del-all", function (e) {
141        jQuery.ajax({
142            async: true,
143            type: "POST",
144            url: eclib.sys.wwwroot + "/store/customer/comparisonajax.aspx",
145            data: {
146                "goods": "",
147                "crsirefo_hidden": jQuery("#crsirefo_token").data("crsirefo_hidden"),
148                "remove_flg": "All"
149            },
150            cache: false,
151            ifModified: false,
152            dataType: "json",
153            success: function (contents) {
154                jQuery('.js_btn-comparison').removeClass('is_added');
155                loadComparison();
156            },
157            error: function (xhr, status, thrown) {
158                alert(eclib.msg.goods_ajax_bookmark.SESSION_EXPIRED);
159            }
160        });
161        return false;
162    });
163
164    //比較リスト取得
165    jQuery("#js-comparison-list").on("click", function () {
166        loadComparison();
167    });
168    var loadComparison = function(){
169        jQuery("#block_of_itemcomparison").load(eclib.sys.wwwroot + '/store/customer/comparisonlistajax.aspx', function(){
170            fixedSideArea.dragScroll.ini();
171        });
172    }
173});

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.