PageSourceSearch

https://www.ec-store.net/js/sws/sys/goods_ajax_cart.js

js ec-store.net collected 2026-09-25 18:38:44 UTC 6,835 bytes, 150 lines download raw bytes

1var ecblib = ecblib || {};
2ecblib.goods_ajax_cart = ecblib.goods_ajax_cart || {};
3
4jQuery(function () {
5    var _goods_ajax_cart = ecblib.goods_ajax_cart;
6
7    var s_width = 60;
8    var l_width = 200;
9    if (document.URL.match("cart.aspx")) {
10        return false;
11    }
12    var $btn_cart = jQuery(".js-animation-add-cart");
13    $btn_cart.off("click");
14    $btn_cart.on("click", function (e) {
15        var loadStart = function (elem) {
16            jQuery(elem).addClass("js-animation-add-cart-in-progress");
17            jQuery(elem).html('<i class="fa fa-spinner fa-pulse fa-fw"></i><span class="sr-only">' + ecblib.msg.goods_ajax_cart.PLEASE_WAIT + '</span>');
18            return elem;
19        };
20        var loadEnd = function (elem, iserror) {
21            if (!iserror) {
22                ecblib.ui.showToolTip(jQuery(elem), { tooltip: ecblib.msg.goods_ajax_cart.TO_SHOPPING_CART, diptimeSec: 1 });
23                setTimeout(function () {
24                    jQuery(elem).removeClass("js-animation-add-cart-in-progress");
25                    jQuery(elem).html(ecblib.msg.goods_ajax_cart.PUT_IN_SHOPPING_CART);
26                }, 1400);
27            } else {
28                jQuery(elem).removeClass("js-animation-add-cart-in-progress");
29                jQuery(elem).html(ecblib.msg.goods_ajax_cart.PUT_IN_SHOPPING_CART);
30            }
31        };
32        var addCart = function (b, g) {
33            var o = loadStart(b);
34            jQuery.ajax({
35                async: true,
36                type: "POST",
37                url: ecblib.sys.pathroot + "/js/addcart.aspx",
38                data: {
39                    "goods": goods,
40                    "crsirefo_hidden": crsirefo_jscart
41                },
42                cache: false,
43                ifModified: false,
44                dataType: "json",
45                success: function (result) {
46                    result = result || {};
47                    if ('ecblib' in window && 'abtest' in ecblib && 'loadABtest' in ecblib.abtest) {
48                        ecblib.abtest.saveBlockClickLog("jscart");
49                    }
50                    if (result.IsUseGtmGa === 'true') {
51                        window.dataLayer = window.dataLayer || [];
52                        dataLayer.push({
53                            'etm_ga_virtualurl_addcart': result.AjaxVirtualUrl_AddCart,
54                            'event': 'etm_ga_cart_added'
55                        });
56                    } else if (result.IsUseLegacyGa === 'true') {
57                        if (typeof gtag == "function") {
58                            var gatrackingcode = jQuery("meta[property='ecb:GATrackingCode']").attr('content');
59                            gtag('config', gatrackingcode, { 'page_title': 'AddCart', 'page_location': ecblib.sys.pathroot + '/cart/addcart.aspx?goods=' + goods });
60                        }
61                    }
62                    if (result.ErrMessage && result.ErrMessage.length > 0) {
63                        alert(result.ErrMessage.join("\r\n").replace(/<\/?[^>]+>/gi, ""));
64                        loadEnd(o, true);
65                        return false;
66                    }
67                    if (jQuery("#jscart_replace_").length > 0) {
68                        var self = function (isDelete) {
69                            jQuery("#jscart_replace_").load(ecblib.sys.pathroot + "/js/cart.aspx", function () {
70                                jQuery(".js-jscart-delete-btn").each(function () {
71                                    var cart = jQuery(this).attr("data-cart");
72                                    jQuery(this).bind("click", function () {
73                                        jQuery("#js_jscart_items_" + cart).slideUp("normal", function () {
74                                            jQuery(this).remove();
75                                            jQuery.ajax({
76                                                type: "POST",
77                                                url: ecblib.sys.pathroot + "/js/delcart.aspx",
78                                                data: {
79                                                    "cart": cart,
80                                                    "crsirefo_hidden": crsirefo_jscart
81                                                },
82                                                cache: false,
83                                                success: function () {
84                                                    self(true);
85                                                }
86                                            });
87                                        });
88                                    });
89                                });
90                                if (!isDelete) {
91                                    setTimeout(function () {
92                                        loadEnd(o, false);
93                                    }, 400);
94                                }
95                            });
96                        };
97                        self(false);
98                    } else {
99                        setTimeout(function () {
100                            loadEnd(o, false);
101                        }, 400);
102                    }
103                },
104                error: function (xhr, status, thrown) {
105                    loadEnd(o, true);
106                    alert(ecblib.msg.goods_ajax_cart.SESSION_EXPIRED);
107                    return false;
108                }
109            });
110            return true;
111        };
112        if (jQuery(this).hasClass("js-animation-add-cart-in-progress")) {
113            return false;
114        }
115        var href = jQuery(this).attr("href");
116        var re = new RegExp("goods=([0-9A-Za-z_\-]+)");
117        var matches = href.match(re);
118        var goods = "";
119        if (matches && matches.length == 2) {
120            goods = matches[1];
121        } else {
122            return true;
123        }
124        if (jQuery("#agree_" + goods).length > 0) {
125            var btn = this;
126            ecblib.ui.dialog('agree_' + goods, {
127                width: '400px',
128                buttons: {
129                    'btnAgree': function (action) {
130                        addCart(btn, goods);
131                        action.close();
132                    }
133                    , 'btnNotAgree': function (action) {
134                        action.close();
135                    }
136                }
137            });
138
139        } else {
140            addCart(this, goods);
141            return false;
142        }
143        return false;
144    });
145    //カート画面 数量変更
146    jQuery('.block-cart--table-line select').on('change', function() {
147        jQuery('.block-cart--wrapper form').submit();
148    });
149
150});

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.