1// jQuery.noConflict(); 2(function ($) { 3 var baseUrl = 'https://ac-web-develop.api.everforth.com/capi'; 4 var defaultQuery = { 5 limit: '2' 6 }; 7 var attrs = ['apikey', 'limit', 'start', 'brands', 'tags', 'used_by', 'using_to_product_number']; 8 var templateAttrs = ['src', 'href', 'alt', 'title']; 9 var prefix = 'ef-'; 10 11 $.ef_ajax = function (path, options) { 12 options['url'] = baseUrl + '/' + path; 13 options['dataType'] = 'jsonp'; 14 $.ajax(options); 15 }; 16 17 $.fn.ef = function (path, params) { 18 if (this.length) { 19 var target = jQuery(this); 20 var query = jQuery.extend(true, {}, defaultQuery); 21 for (a in params) { 22 query[a] = params[a] 23 } 24 attrs.forEach(function (attr) { 25 var value = target.attr(prefix + attr); 26 if (value) query[attr] = value; 27 }); 28 var item = $('.' + prefix + 'item', target); 29 if (item) ef_jsonp(path, query, item); 30 } 31 return this; 32 }; 33 34 function ef_jsonp(path, query, item) { 35 item.hide(); 36 $.ajax({
37 url: baseUrl + '/' + path, 38 data: query, 39 dataType: 'jsonp', 40 success: function (json) { 41 var datas = json['data']; 42 datas.forEach(function (data,index) { 43 var clone = item.clone(true); 44 clone.show(); 45 46 for (attr in data) { 47 if (clone.hasClass(prefix + attr)) { 48 clone.text(data[attr]) 49 } 50 templateAttrs.forEach(function (viewAttr) { 51 if (clone.hasClass(prefix + attr + "-" + viewAttr)) { 52 clone.attr(viewAttr, data[attr]) 53 } 54 }); 55 $('.' + prefix + attr, clone).text(data[attr]); 56 templateAttrs.forEach(function (viewAttr) { 57 $('.' + prefix + attr + "-" + viewAttr, clone).attr(viewAttr, data[attr]); 58 }) 59 } 60 61 //template 62 var processTemplate = function (text) { 63 if (text) for (attr in data) { 64 if (data[attr]) text = text.split('{{' + attr + '}}').join(data[attr]) 65 } 66 return text; 67 } 68 69// if (clone.hasClass(prefix + 'template')) { 70// clone.text(function(index, text) { 71// return processTemplate(text); 72// }) 73// } 74 if (clone.hasClass(prefix + 'template')) { 75 clone.html(function (index, html) { 76 return processTemplate(html); 77 }) 78 } 79 templateAttrs.forEach(function (viewAttr) { 80 if (clone.hasClass(prefix + 'template' + "-" + viewAttr)) { 81 clone.attr(viewAttr, processTemplate(clone.attr(viewAttr))) 82 } 83 }); 84// $('.' + prefix + 'template', clone).text(function(index, text) { 85// return processTemplate(text); 86// }); 87 $('.' + prefix + 'template', clone).html(function (index, html) { 88 return processTemplate(html); 89 }); 90 templateAttrs.forEach(function (viewAttr) { 91 92 $('.' + prefix + 'template' + "-" + viewAttr, clone).each(function () { 93 $(this).attr(viewAttr, processTemplate($(this).attr(viewAttr))); 94 }); 95 96 }); 97 //ã¢ã¼ãã«è¡¨ç¤ºãè¨å® 98 if(item.parents().hasClass("ef-update-modal")){ 99 (function() { 100 //cloneããitemã«ã¤ãã³ããè¨å® 101 clone.click(function() { 102 update_coordinate_box(datas, index); 103 }); 104 })(); 105 } 106 //ã»ã¼ã«ä¾¡æ ¼ã®è¡¨ç¤ºãè¨å® 107 var price = clone.find(".ef-price").text(); 108 var sell_price = clone.find(".ef-sell_price").text(); 109 var diff_price = price - sell_price; 110 111 if(price == 'null' || price == '' || diff_price >= 0){ 112 // ã»ã¼ã«ä¾¡æ ¼ã表示 113 clone.find(".ef-price").hide(); 114 clone.find(".ef-sell_price").text(sell_price.toString().replace(/(\d)(?=(\d{3})+$)/g , '$1,')).prepend('¥'); 115 } 116 if(sell_price == 'null' || sell_price == '' || diff_price > 0){ 117 // éå¸¸ä¾¡æ ¼ã表示 118 clone.find(".ef-price").text(price.toString().replace(/(\d)(?=(\d{3})+$)/g , '$1,')).prepend('¥'); 119 clone.find(".ef-sell_price").hide(); 120 } 121 clone.insertBefore(item); 122 }); 123 124 //ååã®ãªã³ã¯ã«ãã©ã³ãidãè¨å® 125 if(item.parents().hasClass("ef-productclasses")){ 126 //ååæ å ±ã0ä»¶ã®å ´åã¯STYLING ITEMãé表示ã«ãã 127 if(datas.length == 0){ 128 $('.cont-title').hide(); 129 }else{ 130 $('.cont-title').show(); 131 } 132 add_brandid_to_product_link(); 133 } 134 135 if(datas.length > 0){ 136 item.remove(); 137 } 138 139 //bxsliderãè¨å® 140 if(! $('.bxslider').hasClass('on_bxslider')){
141 coordinate_bxslider(datas); 142 } 143 } 144 }); 145 } 146})(jQuery); 147 148// jQuery(function () { 149// jQuery('.ef-productclasses').ef('productclass'); 150// jQuery('.ef-shops').ef('shop'); 151// jQuery('.ef-snaps').ef('snap'); 152// jQuery('.ef-blogs').ef('blog'); 153// jQuery('.ef-news').ef('news'); 154// });
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.