PageSourceSearch

https://shop.megalos.co.jp/js/sys/goods_ajax_cart.js

js megalos.co.jp collected 2026-10-02 04:27:56 UTC 6,374 bytes, 147 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(ecblib.ui.loadingImageMin() + '<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.wwwroot + "/shop/js/addcart.aspx",
38                data: {
39                    "goods": goods,
40                    "qty":qty,
41                    "crsirefo_hidden": crsirefo_jscart
42                },
43                cache: false,
44                ifModified: false,
45                dataType: "json",
46                success: function (msg) {
47                    if ('ecblib' in window && 'abtest' in ecblib && 'loadABtest' in ecblib.abtest) {
48                        ecblib.abtest.saveBlockClickLog("jscart");
49                    }
50                    if (typeof gtag == "function") {
51                        var gatrackingcode = jQuery("meta[property='ecb:GATrackingCode']").attr('content');
52                        gtag('config', gatrackingcode, { 'page_title': 'AddCart', 'page_location': ecblib.sys.wwwroot + '/shop/cart/addcart.aspx?goods=' + goods });
53                    }
54                    if (msg && msg.length > 0) {
55                        alert(msg.join("\r\n").replace(/<\/?[^>]+>/gi, ""));
56                        loadEnd(o, true);
57                        return false;
58                    }
59                    if (jQuery("#jscart_replace_").length > 0) {
60                        var self = function (isDelete) {
61                            jQuery("#jscart_replace_").load(ecblib.sys.wwwroot + "/shop/js/cart.aspx", function () {
62                                jQuery(".js-jscart-delete-btn").each(function () {
63                                    var cart = jQuery(this).attr("data-cart");
64                                    jQuery(this).bind("click", function () {
65                                        jQuery("#js_jscart_items_" + cart).slideUp("normal", function () {
66                                            jQuery(this).remove();
67                                            jQuery.ajax({
68                                                type: "POST",
69                                                url: ecblib.sys.wwwroot + "/shop/js/delcart.aspx",
70                                                data: {
71                                                    "cart": cart,
72                                                    "crsirefo_hidden": crsirefo_jscart
73                                                },
74                                                cache: false,
75                                                success: function () {
76                                                    self(true);
77                                                }
78                                            });
79                                        });
80                                    });
81                                });
82                                if (!isDelete) {
83                                    setTimeout(function () {
84                                        loadEnd(o, false);
85                                    }, 400);
86                                }
87                                ecblib.ui.showCartCount();
88                            });
89                        };
90                        self(false);
91                    } else {
92                        setTimeout(function () {
93                            loadEnd(o, false);
94                        }, 400);
95                        ecblib.ui.showCartCount();
96                    }
97                },
98                error: function (xhr, status, thrown) {
99                    loadEnd(o, true);
100                    alert(ecblib.msg.goods_ajax_cart.SESSION_EXPIRED);
101                    return false;
102                }
103            });
104            return true;
105        };
106        if (jQuery(this).hasClass("js-animation-add-cart-in-progress")) {
107            return false;
108        }
109        var href = jQuery(this).attr("href");
110        var re = new RegExp("goods=([0-9A-Za-z_\-]+)");
111        var matches = href.match(re);
112        var goods = "";
113        if (matches && matches.length == 2) {
114            goods = matches[1];
115        } else {
116            return true;
117        }
118        var qty_re = new RegExp("qty=([0-9A-Za-z_\-]+)");
119        var matches = href.match(qty_re);
120        var qty = "";
121        if (matches && matches.length == 2) {
122            qty = matches[1];
123        } else {
124            qty = 1
125        }
126        if (jQuery("#agree_" + goods).length > 0) {
127            var btn = this;
128            ecblib.ui.dialog('agree_' + goods, {
129                width: '400px',
130                buttons: {
131                    'btnAgree': function (action) {
132                        addCart(btn, goods);
133                        action.close();
134                    }
135                    , 'btnNotAgree': function (action) {
136                        action.close();
137                    }
138                }
139            });
140
141        } else {
142            addCart(this, goods);
143            return false;
144        }
145        return false;
146    });
147});

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.