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