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 if (ajaxcart_jscart === 'false'){ 17 return elem; 18 } 19 jQuery(elem).addClass("js-animation-add-cart-in-progress"); 20 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>'); 21 return elem; 22 }; 23 var loadEnd = function (elem, iserror) { 24 if (ajaxcart_jscart === 'false'){ 25 return; 26 } 27 if (!iserror) { 28 ecblib.ui.showToolTip(jQuery(elem), { tooltip: ecblib.msg.goods_ajax_cart.TO_SHOPPING_CART, diptimeSec: 1 }); 29 setTimeout(function () { 30 jQuery(elem).removeClass("js-animation-add-cart-in-progress"); 31 jQuery(elem).html(ecblib.msg.goods_ajax_cart.PUT_IN_SHOPPING_CART); 32 }, 1400); 33 } else { 34 jQuery(elem).removeClass("js-animation-add-cart-in-progress"); 35 jQuery(elem).html(ecblib.msg.goods_ajax_cart.PUT_IN_SHOPPING_CART); 36 } 37 }; 38 39 var showFloatCart = function (goods) { 40 jQuery('body').css({ 'overflow': 'hidden' }); 41 jQuery('body').append('<div class="block_cart--modal_bg"> </div>'); 42 jQuery('body').append('<input type="hidden" id="modal_goods" value="' + goods + '">'); 43 jQuery('.block_cart--modal_bg, .block_cart--modal_close, .continue-shopping').bind('click', function () { 44 hideFloatCart(goods); 45 }); 46 jQuery('.block_cart--modal').fadeIn(200); 47 jQuery('.block_cart--modal_close').fadeIn(200); 48 }; 49 50 var hideFloatCart = function (goods){ 51 jQuery('body').css({ 'overflow': 'auto' }); 52 jQuery('.block_cart--modal_bg').remove(); 53 jQuery('.block_cart--modal').hide(); 54 jQuery('.block_cart--modal').hide(); 55 }; 56 57 var showFloatCartBtnModal = function () { 58 jQuery('body').css({ 'overflow': 'hidden' }); 59 jQuery('body').append('<div class="block_cartbtn--modal_bg"> </div>'); 60 jQuery('body').append('<input type="hidden" id="modal_goods" value="' + goods + '">'); 61 jQuery('.block_cartbtn--modal_bg, .block_cartbtn--modal_close, .continue-shopping').bind('click', function () { 62 hideFloatCartBtnModal(); 63 }); 64 jQuery('.block_cartbtn--modal').fadeIn(200); 65 jQuery('.block_cartbtn--modal_close').fadeIn(200); 66 }; 67 68 var hideFloatCartBtnModal = function (){ 69 jQuery('body').css({ 'overflow': 'auto' }); 70 jQuery('.block_cartbtn--modal_bg').remove(); 71 jQuery('.block_cartbtn--modal').hide(); 72 jQuery('.block_cartbtn--modal').hide(); 73 }; 74 75 var addCart = function (b, g) { 76 var o = loadStart(b); 77 var qty = jQuery('input[name=' + 'qty' + ']').val(); 78 if (typeof qty == "undefined") { 79 qty = 1; 80 } 81 jQuery.ajax({ 82 async: false, 83 type: "POST", 84 url: ecblib.sys.wwwroot + "/shop/js/addcart.aspx", 85 data: { 86 "goods": g, 87 "crsirefo_hidden": crsirefo_jscart, 88 "qty": qty 89 }, 90 cache: false, 91 ifModified: false, 92 dataType: "json", 93 success: function (result) { 94 result = result || {}; 95 if ('ecblib' in window && 'abtest' in ecblib && 'loadABtest' in ecblib.abtest) { 96 ecblib.abtest.saveBlockClickLog("jscart"); 97 } 98 if (result.IsUseGtmGa === 'true') { 99 window.dataLayer = window.dataLayer || []; 100 dataLayer.push({ 101 'etm_ga_virtualurl_addcart': result.AjaxVirtualUrl_AddCart, 102 'event': 'etm_ga_cart_added' 103 }); 104 } else if (result.IsUseLegacyGa === 'true') { 105 if (typeof gtag == "function") { 106 var gatrackingcode = jQuery("meta[property='ecb:GATrackingCode']").attr('content'); 107 gtag('config', gatrackingcode, { 'page_title': 'AddCart', 'page_location': ecblib.sys.wwwroot + '/shop/cart/addcart.aspx?goods=' + g }); 108 } 109 } 110 if (result.ErrMessage && result.ErrMessage.length > 0) { 111 jQuery(".ttl_frame_ .ttl_").html("<img class='err_img' src='" + ecblib.sys.wwwroot + "/img/usr/icon/icon_alert.png' width='28px'>ã«ã¼ãã«ååã追å ã§ãã¾ããã§ãã"); 112 if (!result.UseCartErrorMessageArea) { 113 var errorItems = ""; 114 for (var errorIndex = 0; errorIndex < result.ErrMessage.length; errorIndex++) { 115 errorItems += "<li>" + result.ErrMessage[errorIndex] + "</li>"; 116 } 117 jQuery("#jscart_error_").html('<div class="block-common-alert-list"><ul class="block-common-alert-list--items">' + errorItems + "</ul></div>").show(); 118 } 119 if (jQuery("#jscart_replace_").length > 0) { 120 var self = function (isDelete) { 121 jQuery("#jscart_replace_").load(ecblib.sys.wwwroot + "/shop/js/cart.aspx?goods=" + g , function () { 122 jQuery(".js-jscart-delete-btn").each(function () { 123 var cart = jQuery(this).attr("data-cart"); 124 jQuery(this).bind("click", function () { 125 jQuery("#js_jscart_items_" + cart).slideUp("normal", function () { 126 jQuery(this).remove(); 127 jQuery.ajax({ 128 type: "POST", 129 url: ecblib.sys.wwwroot + "/shop/js/delcart.aspx", 130 data: { 131 "cart": cart, 132 "crsirefo_hidden": crsirefo_jscart 133 }, 134 cache: false, 135 success: function () { 136 self(true); 137 } 138 }); 139 }); 140 }); 141 }); 142 if (!isDelete) { 143 setTimeout(function () { 144 loadEnd(o, true); 145 }, 400); 146 } 147 }); 148 }; 149 self(false); 150 } else { 151 setTimeout(function () { 152 loadEnd(o, true); 153 }, 400); 154 } 155 showFloatCart(g); 156 157 loadEnd(o, true); 158 return false; 159 } 160 if (jQuery("#jscart_replace_").length > 0) { 161 jQuery(".ttl_frame_ .ttl_").html("ã«ã¼ãã«ååã追å ããã¾ãã"); 162 jQuery("#jscart_error_").empty().hide(); 163 var self = function (isDelete) { 164 jQuery("#jscart_replace_").load(ecblib.sys.wwwroot + "/shop/js/cart.aspx?goods=" + g , function () { 165 jQuery(".js-jscart-delete-btn").each(function () { 166 var cart = jQuery(this).attr("data-cart"); 167 jQuery(this).bind("click", function () { 168 jQuery("#js_jscart_items_" + cart).slideUp("normal", function () { 169 jQuery(this).remove(); 170 jQuery.ajax({ 171 type: "POST", 172 url: ecblib.sys.wwwroot + "/shop/js/delcart.aspx", 173 data: { 174 "cart": cart, 175 "crsirefo_hidden": crsirefo_jscart 176 }, 177 cache: false, 178 success: function () { 179 self(true); 180 } 181 }); 182 }); 183 }); 184 }); 185 if (!isDelete) { 186 setTimeout(function () { 187 loadEnd(o, false); 188 }, 400); 189 } 190 }); 191 }; 192 self(false); 193 } else { 194 setTimeout(function () { 195 loadEnd(o, false); 196 }, 400); 197 } 198 showFloatCart(g); 199 }, 200 error: function (xhr, status, thrown) { 201 loadEnd(o, true); 202 alert(ecblib.msg.goods_ajax_cart.SESSION_EXPIRED); 203 return false; 204 } 205 }); 206 return true; 207 }; 208 209 var cartBtnModal = function (b, goods, regular_goods) { 210 jQuery.ajax({ 211 url: ecblib.sys.wwwroot + "/shop/js/goods_cartbtn.aspx", 212 type: "POST", 213 data: { 214 "goods": goods, 215 "regular_goods": regular_goods 216 }, 217 dataType: "html", 218 success: function(response) { 219 jQuery("#jscartbtn_replace_").html(response); 220 showFloatCartBtnModal(); 221 222 jQuery('#jscartbtn_replace_ .js-animation-add-cart').off('click').on('click', function(e){
223 e.preventDefault(); 224 225 var href = jQuery(this).attr("href"); 226 var re = new RegExp("goods=([0-9A-Za-z_\-]+)"); 227 var matches = href.match(re); 228 var goods = ""; 229 if (matches && matches.length == 2) { 230 goods = matches[1]; 231 } 232 addCart(this, goods); 233 hideFloatCartBtnModal(); 234 }); 235 }, 236 error: function(xhr, status, error) { 237 jQuery("#jscartbtn_replace_").html("<div class='alert alert-danger'>ã«ã¼ãæ å ±ã®åå¾ã«å¤±æãã¾ããã</div>"); 238 return false; 239 } 240 }); 241 return true; 242 }; 243 244 if (jQuery(this).hasClass("js-animation-add-cart-in-progress")) { 245 return false; 246 } 247 var href = jQuery(this).attr("href"); 248 var re = new RegExp("goods=([0-9A-Za-z_\-]+)"); 249 var matches = href.match(re); 250 var goods = ""; 251 var regular_goods = ""; 252 if (matches && matches.length == 2) { 253 if (jQuery('select').hasClass("block-variation--item-dropdown")) { 254 goods = jQuery('select[name=' + 'goods' + ']').val(); 255 } 256 if (goods == "") { 257 goods = matches[1]; 258 } 259 var regularGoodsMatch = href.match(/regular_goods=([0-9A-Za-z_\-]+)/); 260 if (regularGoodsMatch && regularGoodsMatch.length == 2) { 261 regular_goods = regularGoodsMatch[1]; 262 } 263 } else { 264 return true; 265 } 266 if (jQuery("#agree_" + goods).length > 0) { 267 var btn = this; 268 ecblib.ui.dialog('agree_' + goods, { 269 width: '400px', 270 buttons: { 271 'btnAgree': function (action) { 272 addCart(btn, goods); 273 action.close(); 274 if (ajaxcart_jscart === 'false'){ 275 window.location.href = ecblib.sys.wwwroot + '/shop/cart/cart.aspx'; 276 } 277 } 278 , 'btnNotAgree': function (action) { 279 action.close(); 280 } 281 } 282 }); 283 284 } else { 285 if (String(regular_goods).length > 0) { 286 cartBtnModal(this, goods, regular_goods); 287 return false; 288 } 289 addCart(this, goods); 290 if (ajaxcart_jscart === 'false'){ 291 window.location.href = ecblib.sys.wwwroot + '/shop/cart/cart.aspx'; 292 } 293 return false; 294 } 295 return false; 296 }); 297});
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.