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