1var eclib = eclib || {}; 2eclib.goods_ajax_bookmark = eclib.goods_ajax_bookmark || {}; 3 4jQuery(document).ready(function () { 5 6 var $btn_bookmark = jQuery(".js-animation-bookmark"); 7 $btn_bookmark.off("click"); 8 function BookmarkChange(target) { 9 if (jQuery(target).attr("data-bookmark-click") == "true") { 10 return false; 11 } 12 var isRegisted = jQuery(target).attr("class").indexOf("cancel") != -1 ? true : false; 13 var originalText; 14 var goodsKind = ""; 15 var attachTarget = ""; 16 var attachElement = ""; 17 var goodsCode = ""; 18 var removeFlg = false; 19 var loadStart = function (elem) { 20 goodsCode = jQuery(elem).data("goods"); 21 goodsKind = jQuery(elem).attr("class").indexOf("variation") != -1 ? "variation" : "goods"; 22 if (jQuery(elem).attr("class").indexOf("cancel") != -1) { 23 removeFlg = true; 24 } 25 jQuery(elem).attr("data-bookmark-click", "true"); 26 originalText = jQuery(elem).html(); 27 attachTarget = jQuery(elem).closest('[class^="pane-goods"]').attr("class").indexOf("footer") != -1 ? ".pane-goods-right-side" : ".pane-goods-footer"; 28 attachElement = removeFlg ? jQuery(attachTarget).find(".block-goods-favorite-registed--btn") : jQuery(attachTarget).find(".block-goods-favorite--btn"); 29 jQuery(elem).html('<i class="js-animation-bookmark-in-progress fa fa-spinner fa-pulse fa-fw"></i><span class="sr-only">ãå¾ ã¡ãã ãã...</span></a>'); 30 return elem; 31 }; 32 var loadEnd = function (elem, iserror, msg) { 33 if (!iserror) { 34 eclib.ui.showToolTip(jQuery(".js-animation-bookmark-in-progress"), { tooltip: msg, diptimeSec: 2 }); 35 setTimeout(function () { 36 if (msg == "ãã°ã¤ã³å¾ã«ãå©ç¨ãã ããã") { 37 jQuery(elem).html(originalText); 38 } else if (!removeFlg) { 39 jQuery(elem).removeClass("block-" + goodsKind + "-favorite--btn"); 40 jQuery(elem).addClass("block-" + goodsKind + "-favorite-registed--btn"); 41 jQuery(elem).attr("data-goods", goodsCode); 42 if (goodsKind != "variation") { 43 jQuery(elem).html(btntxt); 44 attachElement.html(btntxt); 45 attachElement.removeClass("block-goods-favorite--btn"); 46 attachElement.addClass("block-goods-favorite-registed--btn js-bookmark-cancel"); 47 attachElement.attr("data-goods", goodsCode); 48 } else { 49 jQuery(elem).html(originalText.replace("favorite_icon.png", "favorite_icon_check.png")); 50 jQuery(elem).addClass("js-bookmark-cancel"); 51 } 52 } else { 53 jQuery(elem).addClass("block-" + goodsKind + "-favorite--btn"); 54 jQuery(elem).removeClass("block-" + goodsKind + "-favorite-registed--btn"); 55 if (goodsKind != "variation") { 56 jQuery(elem).html(btntxt); 57 attachElement.html(btntxt); 58 attachElement.addClass("block-goods-favorite--btn"); 59 attachElement.removeClass("block-goods-favorite-registed--btn js-bookmark-cancel"); 60 } else { 61 jQuery(elem).html(originalText.replace("favorite_icon_check.png", "favorite_icon.png")); 62 jQuery(elem).removeClass("js-bookmark-cancel"); 63 } 64 } 65 jQuery(elem).removeAttr("data-bookmark-click"); 66 }, 2400); 67 } else { 68 jQuery(elem).html(originalText); 69 } 70 }; 71 var addBookmark = function (b, g) { 72 var o = loadStart(b); 73 jQuery.ajax({ 74 async: true, 75 type: "POST", 76 url: EC_WWW_ROOT + "/shop/customer/bookmarkajax.aspx", 77 data: { 78 "goods": g, 79 "crsirefo_hidden": jQuery('#js_crsirefo_hidden').val() 80 }, 81 cache: false, 82 ifModified: false, 83 dataType: "json", 84 success: function (msg) { 85 setTimeout(function () { 86 loadEnd(o, false, msg); 87 }, 400); 88 }, 89 error: function (xhr, status, thrown) { 90 loadEnd(o, true); 91 alert('ã»ãã·ã§ã³ã®æå¹æéãããã¾ããã\nèª ã«æãå ¥ãã¾ããå度ããããã¼ã¸ããã®ã¢ã¯ã»ã¹ããé¡ããããã¾ãã\n\nâ»å½ãµã¤ãã§ã¯ã客æ§ã®æ å ±ä¿è·ã®ãããä¸å®æéçµéå¾ã«æ¥ç¶æ å ±ãè§£é¤ããã¦ããã ãã¦ããã¾ãã'); 92 return false; 93 } 94 }); 95 return true; 96 }; 97 var removeBookmark = function (b, g) { 98 var o = loadStart(b); 99 jQuery.ajax({ 100 async: true, 101 type: "POST", 102 url: EC_WWW_ROOT + "/shop/customer/bookmarkajax.aspx", 103 data: { 104 "goods": g, 105 "crsirefo_hidden": jQuery('#js_crsirefo_hidden').val(), 106 "remove_flg": "True" 107 }, 108 cache: false, 109 ifModified: false, 110 dataType: "json", 111 success: function (msg) { 112 setTimeout(function () { 113 loadEnd(o, false, msg); 114 }, 400); 115 }, 116 error: function (xhr, status, thrown) { 117 loadEnd(o, true); 118 alert('ã»ãã·ã§ã³ã®æå¹æéãããã¾ããã\nèª ã«æãå ¥ãã¾ããå度ããããã¼ã¸ããã®ã¢ã¯ã»ã¹ããé¡ããããã¾ãã\n\nâ»å½ãµã¤ãã§ã¯ã客æ§ã®æ å ±ä¿è·ã®ãããä¸å®æéçµéå¾ã«æ¥ç¶æ å ±ãè§£é¤ããã¦ããã ãã¦ããã¾ãã'); 119 return false; 120 } 121 }); 122 return true; 123 }; 124 if (!jQuery(target).length) { 125 return false; 126 } 127 var goods = jQuery(target).data("goods"); 128 if (goods == undefined) { 129 return true; 130 } 131 if (!isRegisted) { 132 addBookmark(target, goods); 133 } else { 134 removeBookmark(target, goods); 135 } 136 return false; 137 } 138 jQuery(".js-animation-bookmark").on("click", function (e) { 139 BookmarkChange(e.currentTarget); 140 });
vendor: 3 bytes, line 141
141});
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.