1var ecblib = ecblib || {}; 2ecblib.goods_ajax_bookmark = ecblib.goods_ajax_bookmark || {}; 3 4jQuery(document).ready(function() { 5 jQuery(function () { 6 var _goods_ajax_bookmark = ecblib.goods_ajax_bookmark; 7 jQuery(document).on("click", ".js-cancel-modal", function() { 8 var id = jQuery(this).attr("data-target-modal"); 9 var attrUrl = ecblib.sys.pathroot + "/customer/bookmark.aspx?goods=" + jQuery(this).attr("data-goods") + "&crsirefo_hidden=" + jQuery('#js_crsirefo_hidden').val(); 10 jQuery('[class*="favorite-cancel--btn"]').attr("href", attrUrl); 11 if (jQuery(this).attr("class").indexOf("variation") == -1) { 12 if(jQuery(this).closest('[class^="pane-goods"]').length > 0) { 13 var attrArea = jQuery(this).closest('[class^="pane-goods"]').attr("class").indexOf("footer") != -1 ? ".pane-goods-footer" : ".pane-goods-right-side"; 14 } 15 jQuery('[class*="favorite-cancel--btn"]').attr("data-area", attrArea); 16 } else { 17 jQuery("#bookmarkmodal_goods_name").text(jQuery(this).attr("data-goods-name")); 18 } 19 ecblib.ui.dialog(id, { 20 quit : function(action) { 21 action.close(); 22 }, 23 buttons : { 24 'btncancel' : function(action) { 25 action.close(); 26 } 27 } 28 }); 29 }); 30 }); 31 32 var $btn_bookmark = jQuery(".js-animation-bookmark"); 33 $btn_bookmark.off("click"); 34 jQuery(document).on("click", ".js-animation-bookmark", function(e) { 35 var isRegisted = jQuery(this).attr("class").indexOf("cancel") != -1 ? true : false; 36 var originalText; 37 var goodsKind = ""; 38 var attachTarget = ""; 39 var attachElement = ""; 40 var goodsCode = ""; 41 var removeFlg = false; 42 var attachUrl = "javascript:void(0)"; 43 var loadStart = function(elem) { 44 goodsCode = jQuery(elem).attr("href").substring(jQuery(elem).attr("href").indexOf("goods="), jQuery(elem).attr("href").indexOf("&crsirefo")).replace("goods=", ""); 45 goodsKind = jQuery(elem).attr("class").indexOf("variation") != -1 ? "variation" : "goods"; 46 if (jQuery(elem).attr("class").indexOf("cancel") != -1) { 47 if (goodsKind != "variation") { 48 elem = jQuery(jQuery(elem).attr("data-area")).find('[class*="registed"]'); 49 } else { 50 elem = jQuery("[data-goods="+goodsCode+"]"); 51 } 52 removeFlg = true; 53 attachUrl = ecblib.sys.pathroot + "/customer/bookmark.aspx?goods=" + goodsCode + "&crsirefo_hidden=" + jQuery('#js_crsirefo_hidden').val(); 54 } 55 jQuery(elem).attr("data-bookmark-click","true"); 56 originalText = jQuery(elem).html(); 57 if(jQuery(elem).closest('[class^="pane-goods"]').length > 0) { 58 attachTarget = jQuery(elem).closest('[class^="pane-goods"]').attr("class").indexOf("footer") != -1 ? ".pane-goods-right-side" : ".pane-goods-footer"; 59 } 60 attachElement = removeFlg ? jQuery(attachTarget).find(".block-goods-favorite-registed--btn") : jQuery(attachTarget).find(".block-goods-favorite--btn"); 61 jQuery(elem).html('<i class="js-animation-bookmark-in-progress fa fa-spinner fa-pulse fa-fw"></i><span class="sr-only">ãå¾ ã¡ãã ãã...</span></a>'); 62 return elem; 63 }; 64 var loadEnd = function(elem, iserror, msg, btntxt) { 65 if (!iserror) { 66 ecblib.ui.showToolTip(jQuery(".js-animation-bookmark-in-progress"), { tooltip : msg, diptimeSec : 2 }); 67 setTimeout(function() { 68 if (!jQuery(elem).hasClass("invalid-guest-bookmark")) { 69 jQuery(elem).attr("href", attachUrl); 70 if (!removeFlg) { 71 jQuery(elem).removeClass("js-animation-bookmark block-"
71+goodsKind+"-favorite--btn"); 72 jQuery(elem).addClass("block-"+goodsKind+"-favorite-registed--btn js-cancel-modal"); 73 jQuery(elem).attr("data-goods", goodsCode); 74 jQuery(elem).attr("data-target-modal", "cancel-modal"); 75 if (goodsKind != "variation") { 76 jQuery(elem).html(btntxt); 77 attachElement.attr("href", attachUrl); 78 attachElement.html(btntxt); 79 attachElement.removeClass("js-animation-bookmark block-goods-favorite--btn"); 80 attachElement.addClass("block-goods-favorite-registed--btn js-cancel-modal"); 81 attachElement.attr("data-goods", goodsCode); 82 attachElement.attr("data-target-modal", "cancel-modal"); 83 } else { 84 jQuery(elem).html(originalText); 85 } 86 } else { 87 var jsAnimationClass = "" 88 if (document.getElementById("isCustomerLogin").value == "true") { 89 jsAnimationClass = "js-animation-bookmark" 90 } 91 jQuery(elem).addClass(jsAnimationClass+" block-"+goodsKind+"-favorite--btn"); 92 jQuery(elem).removeClass("block-"+goodsKind+"-favorite-registed--btn js-cancel-modal"); 93 jQuery(elem).removeAttr("data-goods data-target-modal"); 94 if (goodsKind != "variation") { 95 jQuery(elem).html(btntxt); 96 attachElement.attr("href", attachUrl); 97 attachElement.html(btntxt); 98 attachElement.addClass(jsAnimationClass+" block-goods-favorite--btn"); 99 attachElement.removeClass("block-goods-favorite-registed--btn js-cancel-modal"); 100 attachElement.removeAttr("data-goods data-target-modal"); 101 } else { 102 jQuery(elem).html(originalText); 103 } 104 } 105 } else { 106 jQuery(elem).html(originalText); 107 } 108 }, 2400); 109 } else { 110 jQuery(elem).html(originalText); 111 } 112 113 jQuery(elem).removeAttr("data-bookmark-click"); 114 }; 115 var addBookmark = function(b, g) { 116 // ãæ°ã«å ¥ããã¿ã³ã®Ajaxå¦çãå®äºãã¦ããªããã°å¦çãçµäºãã 117 if (jQuery(b).attr("data-bookmark-click") == "true") { 118 return false; 119 } 120 121 var o = loadStart(b); 122 jQuery.ajax({ 123 async: true, 124 type: "POST", 125 url: ecblib.sys.pathroot + "/customer/bookmarkajax.aspx", 126 data: { 127 "goods": g, 128 "crsirefo_hidden": jQuery('#js_crsirefo_hidden').val() 129 }, 130 cache: false, 131 ifModified: false, 132 dataType: "json", 133 success: function(contents) { 134 setTimeout(function() { 135 loadEnd(o, false, contents.msg, contents.btntxt); 136 }, 400); 137 if (contents.isGuestBookmarkRedirect) { 138 location.href = ecblib.sys.pathroot + "/customer/bookmark_guest.aspx"; 139 } 140 if (contents.isBookmarkRedirect) { 141 location.href = ecblib.sys.pathroot + "/customer/bookmark.aspx"; 142 } 143 }, 144 error: function(xhr, status, thrown) { 145 loadEnd(o, true); 146 alert(ecblib.msg.goods_ajax_bookmark.SESSION_EXPIRED); 147 return false; 148 } 149 }); 150 return true; 151 }; 152 var removeBookmark = function(b, g) { 153 // ãæ°ã«å ¥ããã¿ã³ã®Ajaxå¦çãå®äºãã¦ããªããã°å¦çãçµäºãã 154 if (jQuery(b).attr("data-bookmark-click") == "true") { 155 return false; 156 } 157 158 var o = loadStart(b); 159 jQuery.ajax({ 160 async: true, 161 type: "POST", 162 url: ecblib.sys.pathroot + "/customer/bookmarkajax.aspx", 163 data: { 164 "goods": g, 165 "crsirefo_hidden": jQuery('#js_crsirefo_hidden').val(), 166 "remove_flg": "True" 167 }, 168 cache: false, 169 ifModified: false, 170 dataType: "json", 171 success: function(contents) { 172 setTimeout(function() { 173 loadEnd(o, false, contents.msg, contents.bt
173ntxt); 174 }, 400); 175 }, 176 error: function(xhr, status, thrown) { 177 loadEnd(o, true); 178 alert(ecblib.msg.goods_ajax_bookmark.SESSION_EXPIRED); 179 return false; 180 } 181 }); 182 return true; 183 }; 184 if (!jQuery(this).length) { 185 return false; 186 } 187 var href = jQuery(this).attr("href"); 188 var re = new RegExp("goods=([0-9A-Za-z_\-]+)"); 189 var matches = href.match(re); 190 var goods = ""; 191 if (matches && matches.length == 2) { 192 goods = matches[1]; 193 } else { 194 return true; 195 } 196 if (!isRegisted) { 197 addBookmark(this, goods); 198 } else { 199 removeBookmark(this, goods); 200 } 201 return false; 202 }); 203});
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.