jssdk.js
24.8 KB
!function(e){"use strict";function t(e,t){if("undefined"==typeof document)return t;e=e||"";var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");return o.type="text/css",i.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e)),t}function i(){}function o(e){s=[e]}function n(e,t,i){return e&&e.apply&&e.apply(t.context||t,i)}function r(e){return/\?/.test(e)?"&":"?"}function a(t){function a(e){$++||(X(),J&&(I[G]={s:[e]}),z&&(e=z.apply(t,[e])),n(M,t,[e,k,t]),n(Q,t,[t,k]))}function c(e){$++||(X(),J&&e!=A&&(I[G]=e),n(B,t,[t,e]),n(Q,t,[t,e]))}t=e.extend({},T,t);var d,O,U,P,D,M=t.success,B=t.error,Q=t.complete,z=t.dataFilter,R=t.callbackParameter,L=t.callback,W=t.cache,J=t.pageCache,F=t.charset,G=t.url,V=t.data,Y=t.timeout,$=0,X=i;return C&&C(function(e){e.done(M).fail(B),M=e.resolve,B=e.reject}).promise(t),t.abort=function(){!$++&&X()},!1===n(t.beforeSend,t,[t])||$?t:(G=G||u,V=V?"string"==typeof V?V:e.param(V,t.traditional):u,G+=V?r(G)+V:u,R&&(G+=r(G)+encodeURIComponent(R)+"=?"),!W&&!J&&(G+=r(G)+"_"+(new Date).getTime()+"="),G=G.replace(/=\?(&|$)/,"="+L+"$1"),J&&(d=I[G])?d.s?a(d.s[0]):c(d):(S[L]=o,U=e(x)[0],U.id=m+N++,F&&(U[p]=F),j&&j.version()<11.6?(P=e(x)[0]).text="document.getElementById('"+U.id+"')."+y+"()":U[l]=l,E&&(U.htmlFor=U.id,U.event=g),U[v]=U[y]=U[b]=function(e){if(!U[w]||!/i/.test(U[w])){try{U[g]&&U[g]()}catch(e){}e=s,s=0,e?a(e[0]):c(f)}},U.src=G,X=function(e){D&&clearTimeout(D),U[b]=U[v]=U[y]=null,q[_](U),P&&q[_](P)},q[h](U,O=q.firstChild),P&&q[h](P,O),D=Y>0&&setTimeout(function(){c(A)},Y)),t)}function c(e){return new RegExp(e+"=([^;$]*)","i").test(decodeURIComponent(document.cookie))?RegExp.$1:""}function d(e,t,i){var o,n,r,a,c="";void 0!==t&&(i=i||{},null===t&&(t="",i.expires=-1),i.expires&&("number"==typeof i.expires||i.expires.toUTCString)&&("number"==typeof i.expires?(a=new Date,a.setTime(a.getTime()+24*i.expires*60*60*1e3)):a=i.expires,c="; expires="+a.toUTCString()),o=i.path?"; path="+i.path:"",n=i.domain?"; domain="+i.domain:"",r=i.secure?"; secure":"",document.cookie=[e,"=",encodeURIComponent(t),c,o,n,r].join(""))}e="default"in e?e.default:e;var s,l="async",p="charset",u="",f="error",h="insertBefore",m="_jqjsp",g="onclick",y="on"+f,v="onload",b="onreadystatechange",w="readyState",_="removeChild",x="<script>",k="success",A="timeout",S=window,C=e.Deferred,q=e("head")[0]||document.documentElement,I={},N=0,T={callback:m,url:location.href},j=S.opera,E=!!e("<div>").html("\x3c!--[if IE]><i><![endif]--\x3e").find("i").length;a.setup=function(t){e.extend(T,t)},e.jsonp=a,t(".featuretip.tip-wrap{position:fixed;top:0;left:0;width:100%;height:100%;z-index:1000;background:rgba(0,0,0,.5)}.featuretip .tip{position:fixed;left:50%;top:50%;margin-left:-140px;margin-top:-140px;width:280px;background:#fff;border-top:40px solid #000;text-align:center;line-height:1.25}.featuretip .tip .title{margin:20px auto;font-size:24px;font-weight:700;text-align:center}.featuretip .tip .highlight{font-size:18px}.featuretip .tip .content{font-size:16px;color:#444;text-align:center}.featuretip .tip .button{display:block;margin:20px auto;width:150px;height:30px;font-size:14px;line-height:30px;text-align:center;color:#fff;background:#000;text-decoration:none}",void 0),t(".feature-coin.tip-wrap{position:fixed;top:0;left:0;width:100%;height:100%;z-index:1000;background:rgba(0,0,0,.5)}.feature-coin .tip{position:fixed;left:50%;top:50%;margin-left:-140px;margin-top:-140px;width:280px;background:#fff;text-align:center;line-height:1.25;background-repeat:no-repeat}.feature-coin .tip .tip-close{position:absolute;right:0;top:0;width:25px;height:25px;line-height:25px;text-align:center;font-size:16px;color:#fff;background:#000;cursor:pointer}.feature-coin .tip .title{margin:21px auto;font-size:22px;font-weight:700;text-align:center}.feature-coin .tip .highlight{font-size:18px}.feature-coin .tip .content{padding:4px;font-size:16px;color:#444;text-align:center;height:48px;overflow:hidden}.feature-coin .bottom-button{text-align:center}.feature-coin .tip .button,.feature-coin .tip .coin{display:inline-block;margin:20px auto;width:116px;height:26px;font-size:14px;line-height:26px;text-align:center;color:#fff;background:#000;text-decoration:none;border:2px solid #000}.feature-coin .tip .coin{color:#000;background:#fff}",void 0);var O={Android:function(){return!!navigator.userAgent.match(/Android/i)},BlackBerry:function(){return!!navigator.userAgent.match(/BlackBerry/i)},iOS:function(){return!!navigator.userAgent.match(/iPhone|iPad|iPod/i)},Windows:function(){return!!navigator.userAgent.match(/IEMobile/i)},any:function(){return O.Android()||O.BlackBerry()||O.iOS()||O.Windows()}},U=O.any()?"//m.yohobuy.com/home/mycurrency":"//www.yohobuy.com/home/currency",P=e('<div class="featuretip tip-wrap"><div class="tip"><div class="title"></div><div class="content"></div><a class="button" href="">返回</a></div></div>'),D=e('<div class="feature-coin tip-wrap"><div class="tip"><div class="tip-close">×</div><div class="title"></div><div class="content"></div><div class="bottom-button"><a class="button" href="">去逛逛</a><a class="coin" href=\''+U+'?openby:yohobuy={"action":"go.mine"}\'>查看有货币</a></div></div></div>'),M=function(){if(!window._jssdkQS){var t={},i=void 0,o=void 0,n=window.location.search.slice(1).split("&");for(o=0;o<n.length;o++)i=n[o].split("="),t[i[0]]=i[1];window._jssdkQS=t}return e.extend({},window._jssdkQS)},B=function(e){var t=document.createElement("a");return t.href=e,t},Q=function(){var t=M(),i=[],o="?";delete t.uid,delete t.app_version,delete t.client_type,delete t.session_key,delete t.client_secret;for(var n in t)i.push(n+"="+t[n]);t.expires||i.push("expires="+6048e5),i.push("callback=jQueryMktCode"),o+=i.join("&"),e.getScript("//m.yohobuy.com/activity/wechat/1111"+o,function(){})},z=function(){var t=e("body");t.on("click",".feature-coin .close,.feature-coin .tip-close",function(e){D.fadeOut(),e.preventDefault()}),t.on("click",".feature-coin.tip-wrap",function(e){"feature-coin tip-wrap"===e.target.className&&(D.fadeOut(),e.preventDefault())}),t.on("click",".featuretip .close",function(e){P.fadeOut(),e.preventDefault()}),t.on("click",".featuretip .refresh",function(){location.reload()}),t.on("click",".featuretip.tip-wrap",function(e){"featuretip tip-wrap"===e.target.className&&(P.fadeOut(),e.preventDefault())})},R={queryString:M,isMobile:O,urlParse:B,init:function(){Q(),z()},isApp:function(){var e=M();return!(!e.app_version&&("app"!==e.openrefer||!e.uid))},image:function(e,t,i,o,n){return o=isNaN(Number(o))?2:o,e=e||"",e=e.replace(/{width}/g,t).replace(/{height}/g,i).replace(/{mode}/g,o),e.indexOf("imageView2")>0&&(n=n||90,e+="/q/"+n),e.replace("quality/80","quality/60").replace("http:","")},sParamByIframe:function(t){e.getScript("//m.yohobuy.com/activity/wechat/1111"+t,function(){})},showTip:function(t){t=t||{title:"",content:"",close:!0},P.find(".title").html(t.title),P.find(".content").html(t.content),t.close?P.find(".button").addClass("close"):P.find(".button").addClass("refresh").html("刷新"),e("body").append(P),P.show()},showCoinTip:function(t){t=t||{title:"",content:"",close:!0},D.find(".title").html(t.title),D.find(".content").html(t.content),t.close&&D.find(".button").addClass("close"),t.coin?D.find(".coin").css("display","inline-block"):D.find(".coin").hide(),t.img&&D.find(".tip").css("background-image","url("+t.img+")"),e("body").append(D),D.show()}},L=function(){var e=location.href.split("?")[0],t="m.yohobuy.com";return"m.yohobuy.com"!==R.urlParse(e).host&&(t="www.yohobuy.com"),"//"+t+"/signin.html?refer="+encodeURIComponent(location.href)+'&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"'+e.replace(/\//g,"\\/")+'","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}'},W={uid:"",noLoginUrl:L,init:function(){var t=this;return a({url:"//m.yohobuy.com/passport/login/user?callback=?"}).then(function(i){return 200===i.code&&(t.uid=Number(i.data)||0),!t.uid&&R.isApp()&&(t.uid=Number(R.queryString().uid)||0),e.Deferred().resolve(t.uid)},function(){return R.isApp()&&(t.uid=Number(R.queryString().uid)||0),e.Deferred().resolve(t.uid)})},auth:function(){if(!this.uid){var t=L();e("a.auth").attr("href",t)}},favout:function(e){e&&this.uid&&a({url:"//service.yoho.cn/activity/favorite/addFavorite?productSkn="+e+"&uid="+this.uid+"&callback=?"}).then(function(e){200===e.code?R.showTip({content:"恭喜您,收藏成功",close:!0}):R.showTip({content:e.message,close:!0})},function(){R.showTip({title:"收藏失败<br>请刷新重新领取",content:"如多次收藏失败,请联系客服人员<br>带来不便敬请谅解",close:!1})})},getMktCode:function(){return this.uid?Number(this.uid)%1024>=512?0x5af3107a40c3:0x5af3107a40c1:0x5af3107a40c5}},J=["checkJsApi","onMenuShareTimeline","onMenuShareAppMessage","onMenuShareQQ","onMenuShareWeibo","onMenuShareQZone"],F={title:document.title,link:location.href,desc:"YOHO!BUY",imgUrl:"http://static.yohobuy.com/m/v1/img/touch/apple-touch-icon-144x144-precomposed-new.png"},G=function(){var t=R.queryString().share_id;if(t)return a({url:"//m.yohobuy.com/activity/share?callback=?",data:{shareId:t}}).then(function(t){return t&&200===t.code&&t.data&&(F.title=t.data.title,F.link=t.data.link||location.href,F.desc=t.data.content||t.data.title,F.imgUrl=t.data.pic),e.Deferred().resolve()},function(){return e.Deferred().resolve()});var i=e("#shareTitle").val(),o=e("#shareImg").val(),n=e("#shareDesc").val(),r=e("#shareLink").val();return F.title=i||F.title,F.imgUrl=o||F.imgUrl,F.desc=n||F.desc,F.link=r||F.link,e.Deferred().resolve()},V={init:function(){/QQ/i.test(navigator.userAgent)&&e.ajax({url:"//qzonestyle.gtimg.cn/qzone/qzact/common/share/share.js",dataType:"script",cache:!0,success:function(){G().then(function(){window.setShareInfo&&window.setShareInfo({title:F.title,summary:F.desc,pic:F.imgUrl,url:F.link})})}}),/MicroMessenger/i.test(navigator.userAgent)&&e.ajax({url:"//res.wx.qq.com/open/js/jweixin-1.3.2.js",dataType:"script",cache:!0,success:function(){a({url:"//m.yohobuy.com/activity/wechat/share?callback=?",data:{url:location.href}}).then(function(e){window.wx&&(window.wx.config({debug:!1,appId:e.appId,timestamp:e.timestamp,nonceStr:e.nonceStr,signature:e.signature,jsApiList:J}),G().then(function(){window.wx.ready(function(){window.wx.onMenuShareAppMessage(F),window.wx.onMenuShareTimeline(F),window.wx.onMenuShareQQ(F),window.wx.onMenuShareWeibo(F),window.wx.onMenuShareQZone(F)})}))})}})}},Y={"baidu.com":0x5af3107a4037,"so.com":0x5af3107a4031,"sogou.com":0x5af3107a4035,"bing.com":0x5af3107a4039,"m.sm.cn":0x5af3107a403b,"google.com":0x5af3107a403d},$=function(){var e,t=document.referrer;for(var i in Y)if(t.indexOf(i)>-1){e=Y[i];break}return e},X=function(){var e=R.queryString(),t=e.mkt_code||e.union_type||$()||"100000000000349";return delete e.openapp,"yohobuy://yohobuy.com/goapp?ct="+t+'&openby:yohobuy={"action":"go.h5",'+(e.share_id?'"share":"/operations/api/v5/webshare/getShare","shareparam":{"share_id":"'+e.share_id+'"},':"")+'"params":{"islogin":"N","url":"http://feature.yoho.cn'+location.pathname+'","param":'+JSON.stringify(e)+"}}"},H={init:function(){if(R.queryString().openapp){var e=navigator.userAgent.toLowerCase(),t=e.indexOf("os")>-1||e.indexOf("iphone")>-1||e.indexOf("mac")>-1||e.indexOf("ipad")>-1,i=X();if(t)window.location.href=i;else{var o=document.createElement("iframe");o.src=i,o.style.display="none",document.body.appendChild(o)}}}},Z={cookie:c,setCookie:d},K=!1,ee=function(e){e.app=R.queryString(),e.app.uid=e.uid,K||(K=!0,a({url:"//m.yohobuy.com/activity/coin/sendCoin?callback=?",timeout:5e3,data:e}).then(function(e){K=!1,200===e.code&&e.data?200===e.data.code?R.showCoinTip({title:"恭喜您,成功领取有货币!",content:"特殊情况下到账有延时<br>请耐心等待",close:!0,coin:!0,img:e.data.popupImg}):501===e.data.code?R.showCoinTip({title:"领取失败",content:"哎呀,你来的有点早,活动还没开始呢<br/>稍后再来哦",close:!0,img:e.data.popupImg}):502===e.data.code?R.showCoinTip({title:"领取失败",content:"抱歉,活动已结束了,下次要快哟~~",close:!0,img:e.data.popupImg}):503===e.data.code?R.showCoinTip({title:"已经领取",content:"贪心会长胖,你已经领取过了啦~~",close:!0,img:e.data.popupImg}):504===e.data.code?R.showCoinTip({title:"领取失败",content:"哎呀,你来晚了,有货币已经领完了,<br/>下次早点来哦",close:!0,img:e.data.popupImg}):e.data.msg&&R.showCoinTip({title:"领取失败",content:"抱歉,系统错误,有货君正奋力解决中...请稍后再来",close:!0,img:e.data.popupImg}):e.message&&R.showCoinTip({title:"领取失败",content:"抱歉,系统错误,有货君正奋力解决中...请稍后再来",close:!0,img:e.data&&e.data.popupImg})},function(){K=!1,R.showCoinTip({title:"领取失败",content:"抱歉,系统错误,有货君正奋力解决中...请稍后再来",close:!0})}))},te=!1,ie=function(e){e.app=R.queryString(),e.app.uid=e.app.uid||Z.cookie("app_uid"),e.app.app_version=e.app.app_version||Z.cookie("app_version"),e.app.client_type=e.app.client_type||Z.cookie("app_client_type"),e.app.session_key=e.app.session_key||Z.cookie("app_session_key"),te||(te=!0,a({url:"//m.yohobuy.com/activity/feature/couponSend?callback=?",timeout:5e3,data:e}).then(function(e){te=!1,200===e.code?R.showTip({title:"领取成功",content:"恭喜您,领取成功",close:!0}):401===e.code?R.showTip({title:"已经领取",content:'快去分享给更多<br>喜爱<span class="highlight">潮流</span>的小伙伴吧!',close:!0}):e.message&&R.showTip({title:"领取失败<br>请刷新重新领取",content:e.message+"<br>如多次领取失败,请联系客服人员<br>带来不便敬请谅解",close:!1})},function(){te=!1,R.showTip({title:"领取失败<br>请刷新重新领取",content:"如多次领取失败,请联系客服人员<br>带来不便敬请谅解",close:!1})}))},oe=function(t){if(t){var i=Z.cookie("yoho-coin-token");i&&(ee({token:i,uid:t}),Z.setCookie("yoho-coin-token",""))}e("body").on("click",".yoho-coin",function(){var t=e(this).data("token");if(!W.uid)return Z.setCookie("yoho-coin-token",t),"miniprogram"===window.__wxjs_environment&&"undefined"!=typeof wx&&wx.miniProgram?void wx.miniProgram.navigateTo({url:"../bindPhoneNumber/bindPhoneNumber?h5back="+location.href}):(e("#intimacy-link").length<=0&&e("body").append("<a href='"+W.noLoginUrl()+'\' style="display:none;" id="intimacy-link"><span class="intimacy-link"></span></a>'),void e(".intimacy-link").click());ee({token:t,uid:W.uid})})},ne=function(t){if(t){var i=Z.cookie("yoho-conpon-token");i&&(ie({token:i,uid:t}),Z.setCookie("yoho-conpon-token",""))}e("body").on("click",".yoho-conpon",function(){var t=e(this).data("token");if(!W.uid)return Z.setCookie("yoho-conpon-token",t),"miniprogram"===window.__wxjs_environment&&"undefined"!=typeof wx&&wx.miniProgram?void wx.miniProgram.navigateTo({url:"../bindPhoneNumber/bindPhoneNumber?h5back="+location.href}):(e("#intimacy-link").length<=0&&e("body").append("<a href='"+W.noLoginUrl()+'\' style="display:none;" id="intimacy-link"><span class="intimacy-link"></span></a>'),void e(".intimacy-link").click());ie({token:t,uid:W.uid})})},re={init:function(e){oe(e),ne(e)}};!function(t){if(/yoho/i.test(navigator.userAgent)&&/supportWebp/i.test(navigator.userAgent))return void(window.supportWebp=!0);var i={lossy:"UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"},o=new Image;o.onload=function(){var t=o.width>0&&o.height>0;window.supportWebp=t||!1,e(document).trigger("supportWebp")},o.onerror=function(){window.supportWebp=!1,e(document).trigger("supportWebp")},o.src="data:image/webp;base64,"+i[t]}("lossy");var ae=function(e,t){if(!e)return e;t=Object.assign({q:60},t);var i=e.split("?"),o=i[0],n=i[1]||"";if(n&&"imageslim"!==n)/imageView/.test(n)?(/\/q\/\d+/.test(n)?e=e.replace(/\/q\/\d+/g,"/q/"+t.q):e+="/q/"+t.q,window.supportWebp&&!/format\//i.test(n)&&(e+="/format/webp"),window.supportWebp&&(/format\/png/i.test(n)||/format\/jpg/i.test(n))&&(e=e.replace(/format\/png/i,"format/webp").replace(/format\/jpg/i,"format/webp"))):/imageMogr/.test(n)&&(/\/quality\/\d+/.test(n)?e=e.replace(/\/quality\/\d+/g,"/quality/"+t.q):e+="/quality/"+t.q,window.supportWebp&&!/format\//.test(n)&&(e+="/format/webp"),window.supportWebp&&(/format\/png/i.test(n)||/format\/jpg/i.test(n))&&(e=e.replace(/format\/png/i,"format/webp").replace(/format\/jpg/i,"format/webp")));else{if(window.supportWebp)o+="?imageView2/0/interlace/1/format/webp/q/"+t.q;else{o+=60===t.q?"?imageslim":"?imageView2/0/interlace/1/q/"+t.q}e=o}return e};!function(e,t,i,o){var n=e(t);e.fn.lazyload=function(o){function r(){var t=0;c.each(function(){var i=e(this);if(!d.skip_invisible||i.is(":visible"))if(e.abovethetop(this,d)||e.leftofbegin(this,d));else if(e.belowthefold(this,d)||e.rightoffold(this,d)){if(++t>d.failure_limit)return!1}else i.trigger("appear"),t=0})}var a,c=this,d={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:t,data_attribute:"original",skip_invisible:!1,appear:null,load:null,placeholder:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC"};return o&&(void 0!==o.failurelimit&&(o.failure_limit=o.failurelimit,delete o.failurelimit),void 0!==o.effectspeed&&(o.effect_speed=o.effectspeed,delete o.effectspeed),e.extend(d,o)),a=void 0===d.container||d.container===t?n:e(d.container),0===d.event.indexOf("scroll")&&a.bind(d.event,function(){return r()}),this.each(function(){var t=this,i=e(t);t.loaded=!1,void 0!==i.attr("src")&&!1!==i.attr("src")||i.is("img")&&i.attr("src",d.placeholder),i.one("appear",function(){if(!this.loaded){if(d.appear){var o=c.length;d.appear.call(t,o,d)}e("<img />").bind("load",function(){var o=i.attr("data-"+d.data_attribute);i.hide(),i.is("img")?i.attr("src",o):i.css("background-image","url('"+o+"')"),i[d.effect](d.effect_speed),t.loaded=!0;var n=e.grep(c,function(e){return!e.loaded});if(c=e(n),d.load){var r=c.length;d.load.call(t,r,d)}}).attr("src",i.attr("data-"+d.data_attribute))}}),0!==d.event.indexOf("scroll")&&i.bind(d.event,function(){t.loaded||i.trigger("appear")})}),n.bind("resize",function(){r()}),/(?:iphone|ipod|ipad).*os 5/gi.test(navigator.appVersion)&&n.bind("pageshow",function(t){t.originalEvent&&t.originalEvent.persisted&&c.each(function(){e(this).trigger("appear")})}),e(i).ready(function(){r()}),this},e.belowthefold=function(i,o){return(void 0===o.container||o.container===t?(t.innerHeight?t.innerHeight:n.height())+n.scrollTop():e(o.container).offset().top+e(o.container).height())<=e(i).offset().top-o.threshold},e.rightoffold=function(i,o){return(void 0===o.container||o.container===t?n.width()+n.scrollLeft():e(o.container).offset().left+e(o.container).width())<=e(i).offset().left-o.threshold},e.abovethetop=function(i,o){return(void 0===o.container||o.container===t?n.scrollTop():e(o.container).offset().top)>=e(i).offset().top+o.threshold+e(i).height()},e.leftofbegin=function(i,o){return(void 0===o.container||o.container===t?n.scrollLeft():e(o.container).offset().left)>=e(i).offset().left+o.threshold+e(i).width()},e.inviewport=function(t,i){return!(e.rightoffold(t,i)||e.leftofbegin(t,i)||e.belowthefold(t,i)||e.abovethetop(t,i))},e.extend(e.expr[":"],{"below-the-fold":function(t){return e.belowthefold(t,{threshold:0})},"above-the-top":function(t){return!e.belowthefold(t,{threshold:0})},"right-of-screen":function(t){return e.rightoffold(t,{threshold:0})},"left-of-screen":function(t){return!e.rightoffold(t,{threshold:0})},"in-viewport":function(t){return e.inviewport(t,{threshold:0})},"above-the-fold":function(t){return!e.belowthefold(t,{threshold:0})},"right-of-fold":function(t){return e.rightoffold(t,{threshold:0})},"left-of-fold":function(t){return!e.rightoffold(t,{threshold:0})}})}(jQuery,window,document);var ce=function(t,i){var o=void 0,n={threshold:1400};o=t instanceof e?t:e(t).find("img.lazy"),e.extend(n,i);var r=function(){o.each(function(t,o){e(o).attr("data-original",ae(e(o).data("original"),i))}),o.lazyload(n)};void 0!==window.supportWebp?r():e(document).on("supportWebp",r)},de=!1,se=function(){var e="";return R.isMobile.iOS()&&(e="iFP_SalesPromotion_h5"),R.isMobile.Android()&&(e="aFP_SalesPromotion_h5"),e},le=function(e,t,i,o,n){if(i){e.find(".brand-name").html(i.brand_name),e.find(".product-detail").attr("href","//m.yohobuy.com/product/"+i.product_skn+'.html?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":'+i.product_skn+',"from_page_name":"'+se()+'","from_page_param":"'+location.href.split("?")[0]+'"}}'),e.find(".product-name").html(i.product_name),e.find(".vip-price-val").html("¥"+i.vip_price),e.find(".sale-price").html("¥"+i.sales_price),e.data("skn",i.product_skn);var r=e.find(".product-detail-img");r.hasClass("lazy")?r.attr("data-original",R.image(i.default_images,o.w,o.h,2,75)):r.attr("src",R.image(i.default_images,o.w,o.h,2,75)),i.sales_price===i.market_price?e.find(".market-price").hide():e.find(".market-price").html("¥"+i.market_price).show();var a=e.find(".product-brand");a&&(i.shop_id?a.attr("href","//m.yohobuy.com/product/index/brand?domain="+i.brand_domain+'&openby:yohobuy={"action":"go.shop","params":{"shop_id":'+i.shop_id+',"shop_template_type":'+(i.shop_template_type||"1")+',"is_red_shop":'+(i.is_red_shop||1)+"}}"):a.attr("href","//m.yohobuy.com/product/index/brand?domain="+i.brand_domain+'&openby:yohobuy={"action":"go.brand","params":{"brand_id":'+i.brand_id+"}}")),n&&(n.I_INDEX||(n.I_INDEX=0),n.I_INDEX++,e.find(".product-detail").attr("fp",JSON.stringify(n)),a&&(n.I_INDEX++,a.attr("fp",JSON.stringify(n))));var c=e.find(".list-product");if(c){var d="",s=t.gender?t.gender:"1,3",l="//list.m.yohobuy.com?gender="+s;c.data("sort")&&(d+=',"sort":'+i.small_sort_id,l+="&sort="+i.small_sort_id),c.data("misort")&&(d+=',"misort":'+i.middle_sort_id,l+="&misort="+i.middle_sort_id),c.data("msort")&&(d+=',"msort":'+i.max_sort_id,l+="&msort="+i.max_sort_id),l+='&openby:yohobuy={"action":"go.list","params":{"actiontype":1,"gender":'+s+d+"}}",c.attr("href",l)}return e.html(e.html()),e}},pe=function e(t){if(t.length){var i=t.shift();return i&&i.default_images?i:e(t)}},ue=function(t,i,o){var n=t.attr("cloneitem"),r=t.find(".loading"),c=t.find(".feature-product-info"),d=t.data("rownum");if(c.length){if(o.abtest&&(!i.uid||Number(i.uid)%1024>=512))return void(n?e(c[0]).remove():(c.removeClass("novisible"),r.hide()));var s=t.find(".imgwh").val()||"";s=s.split("x")||[];var l={w:s[0]||300,h:s[1]||400},p=t.attr("fp");p=p?JSON.parse(p):"",a({url:"//m.yohobuy.com/activity/individuation?callback=?",data:e.extend({},i,o)}).then(function(i){if(!i||!i.length)return void(n?e(c[0]).remove():(c.removeClass("novisible"),r.hide()));if(i.length=i.length-i.length%d,n)for(var a=isNaN(Number(n))?i.length:Number(n),s=0;s<a;s++){var u=pe(i);if(0===s){var f=e(c[0]),h=le(f,o,u,l,p);h?h.removeClass("novisible"):f.remove()}else{var m=le(e(c[0]).clone(),o,u,l,p);m&&(m.removeClass("novisible"),m.appendTo(t))}}else{for(var g=1;g<i.length;g++)c.last().after(c.clone());var y=t.find(".feature-product-info");y.each(function(t,n){var r=e(n);le(r,o,pe(i),l,p)}),y.removeClass("novisible"),r.hide()}ce(e(".product-source img.lazy"))},function(){n?e(c[0]).remove():(c.removeClass("novisible"),r.hide())})}},fe=function(){var t=W.getMktCode();R.sParamByIframe("callback=jQueryMktCode&cover=1&mkt_code="+t+"&expires=604800000");var i=[];e("a").each(function(){var t=e(this).attr("href");!t||/^#.*$/.test(t)||/^javascript.*$/i.test(t)||i.push(t)});var o=0,n=setInterval(function(){if(++o>3)return void clearInterval(n);window._yas&&window._yas.sendAppLogs&&window.appBaseLogs&&(clearInterval(n),window._yas.sendAppLogs({appop:"YB_H5_PAGE_AB_OPEN_L",param:JSON.stringify({C_ID:R.queryString().yh_channel||1,PAGE_URL:window.originUrl,PAGE_NAME:decodeURI(window.qs.title||document.title),ACTION_URL:i,CROWD_CODE:t+""})},!0),e("a").click(function(){var i=e(this).attr("href");!i||/^#.*$/.test(i)||/^javascript.*$/i.test(i)||window._yas.sendAppLogs({appop:"YB_H5_PAGE_AB_FLR_C",param:JSON.stringify({C_ID:R.queryString().yh_channel||1,PAGE_URL:window.originUrl,PAGE_NAME:decodeURI(window.qs.title||document.title),F_URL:i,CROWD_CODE:t+""})},!0)}))},1e3)},he=function(t){e(".product-source").each(function(i,o){o=e(o);var n=o.attr("condition");if(n){n=JSON.parse(n);var r=R.queryString().yh_channel;n.abtest&&(de=!0),r&&(n.yh_channel=r),i>3?setTimeout(function(){ue(o,t,n)},300):ue(o,t,n)}}),de&&fe()},me={init:function(e){he(!e&&R.isApp()?{uid:"",udid:R.queryString().udid||""}:{uid:e,udid:Z.cookie("_yasvd")})}};e(function(){H.init(),W.init().then(function(e){me.init(e),re.init(e),W.auth(),V.init(),R.init()})});var ge={auth:W.auth,favout:W.favout,getMktCode:function(){return W.getMktCode()},getUid:function(){return W.uid}},ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e){"object"===("undefined"==typeof module?"undefined":ye(module))&&"object"===ye(module.exports)?module.exports=e():"function"==typeof define&&define.amd?define([],e):window._jssdk=e()}(function(){return ge})}(jQuery);