fd-gulp-convert-encoding
Version:
convert file to assigned charset
137 lines (120 loc) • 5.12 kB
JavaScript
// Generated by CoffeeScript 1.6.2
/*
The last 20 offers in maindata area asyn load
AsynOfferShopwindowChild extends from base class AsynOffer
@author dongming.jidm
@date 2012-12-26
*/
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
(function($) {
var AsynShopWindowOffer, defConfig, requestURL, self;
self = null;
requestURL = "http://www.1688.com/chanpin/rpc/queryWindow.jsonp?_input_charset=utf-8";
defConfig = {
url: requestURL,
showStyle: "shopwindow"
};
AsynShopWindowOffer = function() {
return AsynShopWindowOffer;
};
$.extend(AsynShopWindowOffer, {
init: function() {
var AsynOfferShopwindowChild, asynOffer;
self = this;
AsynOfferShopwindowChild = (function(_super) {
__extends(AsynOfferShopwindowChild, _super);
function AsynOfferShopwindowChild() {
this.renderData = __bind(this.renderData, this); AsynOfferShopwindowChild.__super__.constructor.call(this, defConfig);
}
AsynOfferShopwindowChild.prototype.renderData = function(data) {
self.renderHtml(data);
};
return AsynOfferShopwindowChild;
})(Qingguo.Business.AsynOffer);
asynOffer = new AsynOfferShopwindowChild(defConfig);
asynOffer.run();
},
renderHtml: function(data) {
var templateHtml;
// ���
Qingguo.Utility.aliclick(this, "?searchtrace=" + 'w_sale_s_asyn_load');
if (typeof data === 'undefined' || data.length < 1) {
return 0;
}
if( typeof offerUrls === 'undefined' ){
offerUrls = {};
}
app = {
setUrl: function( oid, p4pClickUrl ) {
offerUrls[0][oid] = p4pClickUrl;
}
};
templateHtml = '<% for ( var i = 0; i < $data.length; i++ ) { %>\
<% if ( $data[i].isP4P ) { %>\
<%= this.setUrl($data[i].oid, $data[i].p4pClickUrl) %>\
<% } %>\
<li class="sw-mod-offerShopwindow sw-mod-checkbox-id paGetId">\
<div class="sw-ui-photo-text-220">\
<a class="sw-ui-photo220-box" target="_blank" href="<%= $data[i].detailUrl %>">\
<img data-lazyload-src="<%= $data[i].imgUrl %>" border="0" alt="<%= $data[i].simpleSubject %>"/>\
<% if($data[i].lockPicture) { %>\
<i class="sw-mod-offerShopwindow-photolocked"></i>\
<% } %>\
</a>\
<div class="sw-ui-photo-text">\
<% if($data[i].showSaleQuantity) {%> \
<p class="sw-ui-photo-text-count">�ɽ�<span class="count-number"><%=$data[i].saleQuantity%></span><%=$data[i].quantityUnit%></p>\
<% } else if($data[i].showBookedCount) {%>\
<p class="sw-ui-photo-text-count">�ɽ�<span class="count-number"><%=$data[i].bookedCount%></span>��</p>\
<% } %>\
<% if($data[i].showPrice) { %>\
<% if($data[i].lockPrice) { %>\
<p>����Ȩ�ɼ�</p>\
<%} else {%>\
<p>\
<span class="sw-ui-font-priceIcon"><%= $data[i].price %></span> \
</p>\
<% }%>\
<% }%>\
</div>\
</div>\
<div class="sw-mod-offerShopwindow-shadowbottom"></div> \
<div class="sw-mod-offerShopwindow-title">\
<h2>\
<a class="sm-offerShopwindow-titleLink sw-ui-font-title12" gotoDetail="1" href="<%= $data[i].detailUrl%>" target="_blank" offer-stat="title" <% if($data[i].isP4p) { %> rel="nofollow" <%}%> >\
<%= $data[i].subject %>\
</a>\
</h2>\
</div>\
<div class="sw-mod-offerShopwindow-company">\
<a class=" \
<% if(typeof $data[i].trustCreditUrl !== "undefined" && $data[i].trustCreditUrl != null) {%>\
sw-ui-icon-cxt16x16 \
<%}%>\
sw-mod-previewCompanyInfo " href="<%= $data[i].memberUrl%>" target="_blank"><%= $data[i].companyName%></a>\
</div>\
</li>\
<% if(i % 4 == 3) { %>\
<li class="sw-mod-offerShopwindow-line \
<% if (i == $data.length -1) { %> \
sw-mod-offerShopwindow-line-last \
<% } %>\
"></li>\
<% } %>\
<% } %>\
';
$.use('web-sweet', function() {
var offers;
offers = FE.util.sweet(templateHtml).applyData(data, app);
$("ul.offers", "#content").append(offers);
$("#offers_asyn").remove();
});
}
});
Qingguo.Business.AsynShopWindowOffer = AsynShopWindowOffer;
AppCore.lazyRegister("qingguo_mod_asynshopwindowoffer", "Qingguo.Business.AsynShopWindowOffer", "#offers_asyn", "exposure");
})(jQuery);
}).call(this);