1var memberAPI = (function(memberAPI, $, undefined) { 2 if( !$.isEmptyObject(memberAPI) ){ 3 return memberAPI; 4 } 5 var _reqURL = '__CARTURL__/__API__'; 6 7 function call_api(options) { 8 var is_ie=/*@cc_on@if(@_jscript_version<=9)!@end@*/false; 9 if (is_ie) { 10 return false; 11 } 12 13 var cartUrl = ''; 14 if (typeof cartUrlDomain == 'undefined') { 15 cartUrl = options.storeData.cartUrlDomain 16 } else { 17 cartUrl = cartUrlDomain; 18 } 19 reqUrl = _reqURL.replace('__CARTURL__', cartUrl) 20 .replace('__API__', "member-api.php"); 21 22 // ajax 23 $.ajax({ 24 url: reqUrl, 25 type: "POST", 26 dataType: 'json', 27 data: options.data || '', 28 xhrFields: { 29 withCredentials : true 30 }, 31 cache: true, 32 crossDomain: true 33 }).done(function(data){ 34 options.callback(data); 35 }).fail(function(jqXHR, textStatus, thrownError) { 36 //console.log(thrownError); 37 }); 38 } 39 function goLoginPage(data) { 40 loginform = document.createElement('FORM'); 41 loginform.name='loginform'; 42 loginform.method='POST'; 43 loginform.action= data.loginUrl; 44 45 if (data.status === 'not_login') { 46 notLogionHidden = document.createElement('INPUT'); 47 notLogionHidden.type = 'HIDDEN'; 48 notLogionHidden.name = 'ACTION'; 49 notLogionHidden.value = 'WISH_LIST_LOGIN_FAILED'; 50 loginform.appendChild(notLogionHidden); 51 } 52 53 if (data.itemNo) { 54 wishitem =document.createElement('INPUT'); 55 wishitem.type='HIDDEN'; 56 wishitem.name='wish_item'; 57 wishitem.value= data.itemNo; 58 loginform.appendChild(wishitem); 59 } 60 document.body.appendChild(loginform); 61 if (data.analysis == 'uAnalysis') { 62 var piece = data.loginUrl.split('?'); 63 var paramTag = (piece.length>1)?'&':'?'; 64 ga(function(tracker) { 65 var linkerParam = tracker.get('linkerParam'); 66 loginform.action += paramTag + linkerParam; 67 }); 68 } 69 if (data.analysis == 'gAnalysis') { 70 var _gaq = _gaq || window._gaq; 71 _gaq.push(['_linkByPost', document.loginform ]); 72 } 73 loginform.submit(); 74 } 75 function addWishItem(options){ 76 options.data.CMD = 'addWishItem'; 77 var defaults = { 78 callback: function(data) { 79 var status = data.status; 80 if (status === 'success') { 81 if (typeof options.success === 'function') { 82 options.success(); 83 } 84 } else if (status === 'not_login') { 85 goLoginPage(data); 86 } else if (status === 'limit_over') { 87 alert(data.message); 88 } 89 } 90 } 91 var setting = $.extend({}, defaults, options); 92 call_api(setting); 93 } 94 function delWishItem(options){ 95 options.data.CMD = 'delWishItem'; 96 var defaults = { 97 callback: function(data){ 98 var result = data['status']; 99 if (result === 'success') { 100 if (typeof options.success === 'function') { 101 options.success(); 102 } 103 } else if (result === 'not_login') { 104 goLoginPage(data); 105 } 106 } 107 } 108 var setting = $.extend({}, defaults, options); 109 call_api(setting); 110 } 111 function allDelWishItem(options){ 112 options.data.CMD = 'allDelWishItem'; 113 var defaults = { 114 callback: function(data){ 115 var result = data['status']; 116 if (result === 'success') { 117 if (typeof options.success === 'function') { 118 options.success(); 119 } 120 } else if (result === 'not_login') { 121 goLoginPage(data); 122 } 123 } 124 } 125 var setting = $.extend({}, defaults, options); 126 call_api(setting); 127 } 128 function getWishList(options){ 129 options.data.CMD = 'getWish'; 130 var defaults = { 131 callback: function(data){ 132 var result = data['status']; 133 if (result === 'success') { 134 if (typeof options.success === 'function') { 135 options.success(data); 136 } 137 } else if (result === 'not_login') { 138 goLoginPage(data); 139 } 140 } 141 } 142 var setting = $.extend({}, defaults, options); 143 call_api(setting); 144 } 145 function getSmartPhoneTopList(options){ 146 options.data.CMD = 'getWish'; 147 var defaults = { 148 callback: function(data){ 149 var result = data['status']; 150 if (result === 'success') { 151 if (typeof options.success === 'function') { 152 options.success(data); 153 } 154 } else if (result === 'not_login') { 155 if (typeof options.success === 'function') { 156 options.success(data); 157 } 158 } 159 } 160 } 161 var setting = $.extend({}, defaults, options); 162 call_api(setting); 163 } 164 function checkWishItem(options){ 165 options.data.CMD = 'getWishItemNoList'; 166 var defaults = { 167 callback: function(data){ 168 var result = data['status']; 169 if (result === 'success') { 170 if (typeof options.success === 'function') { 171 options.success(data['list']); 172 } 173 } 174 } 175 } 176 var setting = $.extend({}, defaults, options); 177 call_api(setting); 178 } 179 function getMemberId(options){ 180 options.data.CMD = 'getMemberId'; 181 var defaults = { 182 callback: function(data) { 183 var result = data['status']; 184 if (result === 'success') { 185 if (typeof options.success === 'function') { 186 options.success(data); 187 } 188 } 189 } 190 } 191 var setting = $.extend({}, defaults, options); 192 call_api(setting); 193 } 194 memberAPI.addWishItem = addWishItem; 195 memberAPI.delWishItem = delWishItem; 196 memberAPI.allDelWishItem = allDelWishItem; 197 memberAPI.getWishList = getWishList; 198 memberAPI.checkWishItem = checkWishItem; 199 memberAPI.getSmartPhoneTopList = getSmartPhoneTopList; 200 memberAPI.getMemberId = getMemberId; 201 202 return memberAPI; 203})(window.memberAPI || {},jQuery);
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.