UNPKG

fd-gulp-convert-encoding

Version:

convert file to assigned charset

162 lines (145 loc) 6.3 kB
// Generated by CoffeeScript 1.6.2 /* The last 20 offers in maindata area asyn load AsynOfferImgChild 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 AsynImgOffer,Sandbox, defConfig, requestURL, self; self = null; requestURL = "http://www.1688.com/chanpin/rpc/query.jsonp?_input_charset=utf-8"; Sandbox = null; defConfig = { url: requestURL, showStyle: "img" }; AsynImgOffer = function(sb) { Sandbox = sb; return AsynImgOffer; }; $.extend(AsynImgOffer, { init: function() { var AsynOfferImgChild, asynOffer; self = this; AsynOfferImgChild = (function(_super) { __extends(AsynOfferImgChild, _super); function AsynOfferImgChild() { this.renderData = __bind(this.renderData, this); AsynOfferImgChild.__super__.constructor.call(this, defConfig); } AsynOfferImgChild.prototype.renderData = function(data) { self.renderHtml(data); }; return AsynOfferImgChild; })(Qingguo.Business.AsynOffer); asynOffer = new AsynOfferImgChild(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++ ) { %>\ <li class="sw-mod-offerImg sw-mod-checkbox-id paGetId" >\ <ul class="fd-clr">\ <li class="sw-mod-offer-block sw-block-photo">\ <div class="sw-ui-photo100 sw-mod-checkbox-photo sw-mod-previewBigPhoto">\ <a class="sw-ui-photo100-box" offer-stat="pic" href="<%= $data[i].detailUrl %>" target="_blank">\ <img data-lazyload-src="<%= $data[i].imgUrl%>" border="0" >\ <% if($data[i].lockPicture) { %>\ <i class="sw-mod-offerShopwindow-photolocked"></i>\ <% } %>\ </img>\ </a>\ </div>\ </li>\ <li class="sw-mod-offer-block sw-block-description">\ <h2 class="sw-mod-offerImg-title">\ <a class="sw-ui-font-title14" gotoDetail="1" offer-stat="title" href="<%= $data[i].detailUrl %>" target="_blank" title="<%= $data[i].subject %>">\ <%= $data[i].subject %>\ </a>\ </h2>\ <p class="sw-mod-offerImg-attribute">\ <% for ( var j = 0; j < $data[i].briefList.length; j++ ) { %>\ <span \ <%if(j==($data[i].briefList.length - 1)) {%> \ class="last" \ <% } %>\ ><%=$data[i].briefList[j].name%>:<%=$data[i].briefList[j].value4Asyn%></span>\ <% }%>\ </p>\ <p class="sw-mod-offerImg-relatedProduct">\ <% if(typeof $data[i].relateWordList !== "undefined" && $data[i].relateWordList != null) {%>\ <span>��ز�Ʒ��</span>\ <% for ( var j = 0; j < $data[i].relateWordList.length; j++ ) { %>\ <a href="<%=$data[i].relateWordList[j].url%>" ><%=$data[i].relateWordList[j].word%></a>\ <% }%>\ <% }%>\ </p>\ </li>\ <li class="sw-mod-offer-block sw-block-price">\ <% if($data[i].showPrice) { %>\ <p class="sw-block-textP">\ <% if($data[i].lockPrice) { %>\ <span class="sw-ui-font-priceIcon"><em>��Ȩ�ɼ�</em></span>\ <%} else {%>\ <span class="sw-ui-font-priceIcon"><%= $data[i].price %></span>\ <% }%>\ </p>\ <% }%>\ <% if($data[i].showSaleQuantity) {%> \ <p class="sw-block-textP sw-mod-offerImg-attribute-p2"> �ɽ�<strong><%=$data[i].saleQuantity%></strong><%=$data[i].quantityUnit%></p>\ <% } else if($data[i].showBookedCount) {%>\ <p class="sw-block-textP sw-mod-offerImg-attribute-p2"> �ɽ�<strong><%=$data[i].bookedCount%></strong> ��</p>\ <% } %>\ </li>\ <li class="sw-mod-offer-block sw-block-company">\ <p class="sw-block-textP">\ <a href="<%= $data[i].memberUrl%>" class=" sw-mod-previewCompanyInfo" target="_blank" ><%= $data[i].companyName%></a>\ </p>\ <p class="sw-block-textP sw-mod-offerImg-attribute-p2">\ <span class="sw-mod-offerImg-company-place">\ [<%= $data[i].provinceName%> <%= $data[i].cityName%>]\ </span>\ </p> \ <p class="chengxintong">\ <% if(typeof $data[i].trustCreditUrl !== "undefined" && $data[i].trustCreditUrl != null) { %>\ <a rel="nofollow" class="sw-ui-icon-cxt16x16" href="<%= $data[i].memberUrl%>" target="_blank">\ <% if($data[i].tpServiceYear > 0) {%> \ ��<span class="CreditYear"><%= $data[i].tpServiceYear %></span>�� \ <% } %>\ </a>\ <% } %>\ </p>\ </li>\ </ul>\ </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.AsynImgOffer = AsynImgOffer; AppCore.lazyRegister("qingguo_mod_asynimgoffer", "Qingguo.Business.AsynImgOffer", "#offers_asyn", "exposure"); })(jQuery); }).call(this);