index.js
28.3 KB
define("index",["zepto","lazyload","swiper","mlellipsis","iscroll-probe","index"],function(e,a,s){var t;e("js/common"),e("js/passport/index"),e("js/guang/index"),e("js/home/index"),e("js/product/index"),e("js/index/index"),s.exports=t}),define("js/common",["zepto"],function(e,a,s){function t(e){var a,s,t=document.cookie;return document.cookie&&""!==document.cookie&&(s=t.indexOf(e+"="),s>-1&&(s+=e.length+1,a=decodeURIComponent(l.trim(t.substring(s,t.indexOf(";",s)))))),a}function i(){var e,a=t("_UID");return"undefined"==typeof a?0:(e=a.split("::"),"undefined"==typeof e||e.length<4?0:e)}function o(){var e=i();return 0===e?0:e[1]}function n(){var e=t("_g");return"undefined"==typeof e?"":JSON.parse(e).k}var l=e("zepto");!function(){var e=l("#yoho-footer"),a=e.children(".op-row"),s=i();l("body").height()<l(window).height()&&e.addClass("bottom"),0===s?a.prepend('<a href="http://m.yohobuy.com/signin.html">登录</a><span class="sep-line">|</span><a href="http://m.yohobuy.com/reg.html">注册</a>'):a.prepend('Hi,<a class="user-name" href="http://m.yohobuy.com/home?tmp='+Math.random()+'">'+s[0]+'</a><a href="http://m.yohobuy.com/passport/signout/index?token='+s[3]+'">退出</a>'),e.removeClass("hide")}(),window.cookie=t,window.getUser=i,window.getUid=o,window.getShoppingKey=n}),define("js/passport/index",["zepto"],function(e,a,s){e("js/passport/register/register"),e("js/passport/register/code"),e("js/passport/register/password"),e("js/passport/login/login"),e("js/passport/login/international"),e("js/passport/back/mobile"),e("js/passport/back/code"),e("js/passport/back/email"),e("js/passport/back/email-success"),e("js/passport/back/new-password")}),define("js/passport/register/register",["zepto"],function(e,a,s){var t=e("zepto"),i=t("#phone-num"),o=t("#country-select"),n=t("#area-code"),l=t("#btn-next"),r=e("js/passport/api"),d=e("js/plugin/tip"),c=t.trim,p=d.show;r.selectCssHack(t("#country-select")),r.bindClearEvt(),i.bind("input",function(){""===c(i.val())?l.addClass("disable"):l.removeClass("disable")}),o.change(function(){n.text(o.val())}),l.on("touchstart",function(){var e=c(i.val()),a=o.val();l.hasClass("disable")||(r.phoneRegx[a].test(e)?t.ajax({url:"/passport/reg/verifymobile",type:"POST",data:{areaCode:a.replace("+",""),phoneNum:e},success:function(e){200===e.code?location.href=e.data:p(e.message)}}):p("手机号格式不正确,请重新输入"))})}),define("js/passport/api",["zepto"],function(e,a,s){function t(){var e,a=l(".has-eye");a.append('<div class="eye close"></div>'),e=a.children(".eye"),e.on("touchstart",function(e){var a=l(this),s=a.siblings(".pwd");e.preventDefault(),a.toggleClass("close"),a.hasClass("close")?s.attr("type","password"):s.attr("type","text"),s.focus()})}function i(){var e,a=l(".has-clear");a.append('<div class="clear-input"></div>'),e=a.children(".clear-input"),e.on("touchstart",function(a){var s=e.siblings(".input");s.val("").trigger("input").focus(),a.preventDefault()}),a.children(".input").bind("input",function(){var e=l(this),a=e.siblings(".clear-input"),s=r(e.val());""===s?a.hide():a.show()})}function o(e){return e.length>=6&&e.length<=20?!0:!1}function n(e){function a(){var a=e.find("option:selected").text().length;switch(a){case 2:e.outerWidth(90);break;case 3:e.outerWidth(110);break;default:e.outerWidth(130)}}var s=navigator.userAgent;s.match(/uc/i)&&s.match(/android/i)?e.change(function(){a()}):e.removeClass("in-android-uc")}var l=e("zepto"),r=l.trim,d=/^([a-zA-Z0-9]+[_|\_|\.|-]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.|-]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/,c={"+86":/^1[35847]{1}[0-9]{9}$/,"+852":/^[965]{1}[0-9]{7}$/,"+853":/^[0-9]{8}$/,"+886":/^[0-9]{10}$/,"+65":/^[98]{1}[0-9]{7}$/,"+60":/^1[1234679]{1}[0-9]{8}$/,"+1":/^[0-9]{10}$/,"+82":/^01[0-9]{9}$/,"+44":/^7[789][0-9]{8}$/,"+81":/^0[9|8|7][0-9]{9}$/,"+61":/^[0-9]{11}$/};s.exports={emailRegx:d,phoneRegx:c,bindEyesEvt:t,bindClearEvt:i,pwdValidate:o,selectCssHack:n}}),define("js/plugin/tip",["zepto"],function(e,a,s){function t(e,a){var s,t;"undefined"!=typeof e&&(s=e.toString(),t=a&&a>0?a:2e3,i.text(s).show(),o=setTimeout(function(){"block"===i.css("display")&&i.hide()},t))}var i,o,n=e("zepto");!function(){var e='<div id="yoho-tip" class="yoho-tip"></div>';n(".yoho-page").append(e),i=n("#yoho-tip"),i.on("touchstart",function(){i.hide(),clearTimeout(o)})}(),a.show=t}),define("js/passport/register/code",["zepto"],function(e,a,s){e("js/passport/code")(!0)}),define("js/passport/code",["zepto"],function(e,a,s){var t=e("zepto");s.exports=function(a){function s(){var e,a=59;e=setInterval(function(){0===a?(n.text("重发验证码").removeClass("disable"),clearInterval(e)):n.text("重发验证码 ("+a--+"秒)")},1e3)}var i=t("#captcha"),o=t("#btn-next"),n=t("#captcha-tip"),l=t("#phone-num").val(),r=t("#area-code").val().replace("+",""),d=e("js/passport/api"),c=e("js/plugin/tip"),p=t.trim,u=c.show,h=a?"reg":"back";d.bindClearEvt(),i.bind("input",function(){""!==p(i.val())?o.removeClass("disable"):o.addClass("disable")}),n.on("touchstart",function(){n.hasClass("disable")||t.ajax({type:"POST",url:"/passport/"+h+"/sendcode",data:{phoneNum:l,areaCode:r},success:function(e){200===e.code?(n.text("重发验证码 (60秒)").addClass("disable"),s()):u(e.message)}})}),o.on("touchstart",function(){o.hasClass("disable")||t.ajax({type:"POST",url:"/passport/"+h+"/verifycode",data:{phoneNum:l,areaCode:r,code:p(i.val()),token:t("#token").val()},success:function(e){200===e.code?location.href=e.data:u(e.message)}})}),s()}}),define("js/passport/register/password",["zepto"],function(e,a,s){var t=e("zepto"),i=t("#pwd"),o=t("#btn-sure"),n=e("js/passport/api"),l=e("js/plugin/tip"),r=t.trim,d=l.show;n.bindEyesEvt(),i.bind("input",function(){""===r(i.val())?o.addClass("disable"):o.removeClass("disable")}),o.on("touchstart",function(){var e=r(i.val());o.hasClass("disable")||(n.pwdValidate(e)===!1?d("密码6-20位,请重新输入"):t.ajax({type:"POST",url:"/passport/reg/setpassword",data:{password:e,phoneNum:t("#phone-num").val(),areaCode:t("#area-code").val(),token:t("#token").val()},success:function(e){200===e.code?(d("注册成功"),setTimeout(function(){location.href=e.data},1e3)):401===e.code||404===e.code||505===e.code?d(e.message):(d(e.message),setTimeout(function(){location.href=e.data},1e3))}}))})}),define("js/passport/login/login",["zepto"],function(e,a,s){function t(){u&&h?d.removeClass("disable"):d.addClass("disable")}function i(){c.show(),p.show()}function o(){c.hide(),p.hide()}var n=e("zepto"),l=n("#account"),r=n("#pwd"),d=n("#btn-login"),c=n("#retrive-pwd-mask"),p=n("#retrive-pwd-ways"),u=!1,h=!1,f=e("js/passport/api"),g=e("js/plugin/tip"),m=n.trim,v=g.show;f.bindEyesEvt(),f.bindClearEvt(),l.bind("input",function(){u=""!==m(l.val())?!0:!1,t()}),r.bind("input",function(){h=""===m(r.val())?!1:!0,t()}),d.on("touchstart",function(){var e=m(l.val()),a=m(r.val());d.hasClass("disable")||((/^[0-9]+$/.test(e)||f.emailRegx.test(e))&&f.pwdValidate(a)?n.ajax({type:"POST",url:"/passport/login/auth",data:{account:e,password:a},success:function(e){200===e.code?(v("登录成功"),setTimeout(function(){location.href=e.data},1e3)):v(e.message)},error:function(){v("网络断开连接啦~")}}):v("账号或密码有错误,请重新输入"))}),n("#forget-pwd").on("touchstart",function(){i()}),c.on("touchstart",function(){o()}),n("#cancel-retrive").on("touchstart",function(e){e.preventDefault(),o()}),l.trigger("input"),r.trigger("input")}),define("js/passport/login/international",["zepto"],function(e,a,s){function t(){c&&p?d.removeClass("disable"):d.addClass("disable")}var i=e("zepto"),o=i("#phone-num"),n=i("#country-select"),l=i("#area-code"),r=i("#pwd"),d=i("#btn-login"),c=!1,p=!1,u=e("js/passport/api"),h=e("js/plugin/tip"),f=i.trim,g=h.show;u.selectCssHack(n),u.bindEyesEvt(),u.bindClearEvt(),o.bind("input",function(){c=""===f(o.val())?!1:!0,t()}),r.bind("input",function(){var e=f(r.val());p=""===e?!1:!0,t()}),n.change(function(){l.text(n.val())}),d.on("touchstart",function(){var e=f(o.val()),a=n.val(),s=f(r.val());d.hasClass("disable")||(u.phoneRegx[a].test(e)&&u.pwdValidate(s)?i.ajax({type:"POST",url:"/passport/login/auth",data:{areaCode:a.replace("+",""),account:e,password:s},success:function(e){200===e.code?(g("登录成功"),setTimeout(function(){location.href=e.data},1e3)):g(e.message)},error:function(){g("网络断开连接啦~")}}):g("账号或密码有错误,请重新输入"))}),o.trigger("input"),r.trigger("input")}),define("js/passport/back/mobile",["zepto"],function(e,a,s){var t=e("zepto"),i=t("#phone-num"),o=t("#country-select"),n=t("#area-code"),l=t("#btn-next"),r=e("js/passport/api"),d=e("js/plugin/tip"),c=t.trim,p=d.show;r.selectCssHack(t("#country-select")),r.bindClearEvt(),i.bind("input",function(){""===c(i.val())?l.addClass("disable"):l.removeClass("disable")}),o.change(function(){n.text(o.val())}),l.on("touchstart",function(){var e=c(i.val()),a=o.val();l.hasClass("disable")||(r.phoneRegx[a].test(e)?t.ajax({url:"/passport/back/sendcode",type:"POST",data:{areaCode:a.replace("+",""),phoneNum:e},success:function(e){200===e.code?location.href=e.data:p(e.message)}}):p("手机号格式不正确,请重新输入"))})}),define("js/passport/back/code",["zepto"],function(e,a,s){e("js/passport/code")(!1)}),define("js/passport/back/email",["zepto"],function(e,a,s){var t=e("zepto"),i=t("#email"),o=t("#btn-sure"),n=e("js/passport/api"),l=e("js/plugin/tip"),r=t.trim,d=l.show;n.bindClearEvt(),i.bind("input",function(){""===r(i.val())?o.addClass("disable"):o.removeClass("disable")}),o.on("touchstart",function(){var e=r(i.val());o.hasClass("disable")||(n.emailRegx.test(e)?t.ajax({url:"/passport/back/sendemail",type:"POST",data:{email:e},success:function(e){200===e.code?location.href=e.data:d(e.message)}}):d("邮箱格式不正确,请重新输入"))})}),define("js/passport/back/email-success",["zepto"],function(e,a,s){var t=e("zepto"),i=t("#resend"),o=e("js/plugin/tip"),n=o.show;i.on("touchstart",function(e){e.preventDefault(),t.ajax({url:i.data("url"),type:"GET",success:function(e){n(200===e.code?e.message:e.message)}})})}),define("js/passport/back/new-password",["zepto"],function(e,a,s){var t=e("zepto"),i=t("#pwd"),o=t("#btn-ok"),n=e("js/passport/api"),l=e("js/plugin/tip"),r=t.trim,d=l.show,c=t("#phone-num");n.bindEyesEvt(),i.bind("input",function(){""===r(i.val())?o.addClass("disable"):o.removeClass("disable")}),o.on("touchstart",function(){var e,a,s=r(i.val()),l=!0;o.hasClass("disable")||(e={password:s},0===c.length&&(l=!1),l?(t.extend(e,{phoneNum:c.val(),areaCode:t("#areaCode").val(),token:t("#token").val()}),a="/passport/back/passwordByMobile"):(t.extend(e,{code:t("#email-code").val()}),a="/passport/back/passwordByEmail"),n.pwdValidate(s)?t.ajax({type:"POST",url:a,data:e,success:function(e){200===e.code?(d("密码修改成功"),setTimeout(function(){location.href=e.data},1e3)):d(e.message)}}):d("密码6-20位,请重新输入"))})}),define("js/guang/index",["zepto","lazyload","swiper","mlellipsis","iscroll-probe","index"],function(e,a,s){e("js/guang/plus-star/list"),e("js/guang/plus-star/detail"),e("js/guang/home"),e("js/guang/list"),e("js/guang/detail")}),define("js/guang/plus-star/list",["zepto","lazyload","swiper","index"],function(e,a,s){var t,i=e("zepto"),o=e("lazyload"),n=e("swiper"),l=i("#nav-tab > li"),r=i("#ps-content > .content");o(i("img.lazy")),t=new n(".swiper-container",{lazyLoading:!0,pagination:".swiper-pagination"}),i("#nav-tab").delegate("li","touchstart",function(){i(this).hasClass("focus")||(l.toggleClass("focus"),r.toggleClass("hide"),i(document).trigger("scroll"))})}),define("js/guang/plus-star/detail",["zepto","mlellipsis","lazyload"],function(e,a,s){var t,i,o=e("zepto"),n=e("mlellipsis"),l=e("lazyload"),r=o("#intro"),d=o("#intro-more-txt"),c=o("#related-infos-container"),p=e("js/guang/info"),u=e("js/plugin/tip"),h=o("#brand-info").data("id");n.init(),l(o("img.lazy")),r[0].mlellipsis(3),setTimeout(function(){t=r.text(),i=r.attr("title")}),p.initInfosEvt(c),o("#more-intro").bind("touchstart",function(){var e=o(this);e.toggleClass("spread"),e.hasClass("spread")?(r.text(i),d.text("收起")):(r.text(t),d.text("more"))}),o("#brand-like").bind("touchstart",function(e){var a="ok",s=o(this);e.preventDefault(),s.hasClass("like")&&(a="cancel"),o.ajax({type:"POST",url:"/guang/opt/favoriteBrand",data:{id:h,opt:a},success:function(e){200===e.code?s.toggleClass("like"):400===e.code&&u.show("未登录")},error:function(){u.show("网络断开连接了~")}})})}),define("js/guang/info",["zepto","mlellipsis","lazyload"],function(e,a,s){function t(e){r(e.find("img.lazy")),e.each(function(){var e=n(this),a=e.find(".info-title"),s=e.find(".info-text");a[0].mlellipsis(2),s[0].mlellipsis(2)})}function i(e){e.delegate(".like-btn","touchstart",function(e){var a=n(e.currentTarget),s=a.closest(".guang-info"),t="ok";a.hasClass("like")&&(t="cancel"),n.ajax({type:"POST",url:"/guang/opt/praiseArticle",data:{id:s.data("id"),opt:t},success:function(e){var s=e.code;200===s&&(a.next(".like-count").text(e.data),a.toggleClass("like"))},error:function(){d.show("网络断开连接了~")}})}),t(e.find(".guang-info"))}function o(e,a){h||a.end||(h=!0,n.ajax({type:"GET",url:" /guang/list/page",data:a,success:function(s){return" "===s?(a.end=!0,h=!1,p.addClass("hide"),void u.removeClass("hide")):(e.append(s),t(e.find(".guang-info")),a.page++,void(h=!1))},error:function(){d.show("网络断开连接了~"),h=!1}}))}var n=e("zepto"),l=e("mlellipsis"),r=e("lazyload"),d=e("js/plugin/tip"),c=n("#load-more-info"),p=n(""),u=n(""),h=!1;l.init(),c.length>0&&(p=c.children(".loading"),u=c.children(".no-more")),a.initInfosEvt=i,a.setLazyLoadAndMellipsis=t,a.loadMore=o}),define("js/guang/home",["zepto","swiper","mlellipsis","lazyload","index"],function(e,a,s){var t,i=e("zepto"),o=e("swiper"),n=e("js/guang/info"),l=n.setLazyLoadAndMellipsis,r=n.loadMore,d=i("#load-more-info"),c=i(""),p=i(""),u=i(window).height(),h=d.height(),f=i("#info-list"),g=f.children(".info-list"),m=i("#guang-nav"),v=m.children(".focus"),w=v.data("type"),b={};d.length>0&&(c=d.children(".loading"),p=d.children(".no-more")),t=new o(".swiper-container",{lazyLoading:!0,pagination:".swiper-pagination"}),n.initInfosEvt(f),function(){var e=i("#gender").val();m.children(".guang-nav-item").each(function(){var a=i(this).data("type");b[a]={page:1,gender:e,type:a,end:!1}})}(),m.delegate(".guang-nav-item","touchstart",function(){var e,a,s=i(this);s.hasClass("focus")||(a=s.index(),s.addClass("focus"),v.removeClass("focus"),g.not(".hide").addClass("hide"),e=g.eq(a),e.removeClass("hide"),l(e.children(".guang-info")),v=s,w=s.data("type"),b[w].end?(c.addClass("hide"),p.removeClass("hide")):(c.removeClass("hide"),p.addClass("hide")))}),i(document).scroll(function(){i(window).scrollTop()+u>=i(document).height()-h&&r(g,b[w])})}),define("js/guang/list",["zepto","mlellipsis","lazyload"],function(e,a,s){var t=e("zepto"),i=e("js/guang/info"),o=i.loadMore,n=t(window).height(),l=t("#load-more").height(),r=t("#author-infos"),d=t("#tag"),c={page:1,end:!1},p=t("#info-list");i.initInfosEvt(p),r.length>0&&t.extend(c,{authorId:r.data("id")}),d.length>0&&t.extend(c,{tag:d.val()}),t(document).scroll(function(){t(window).scrollTop()+n>=t(document).height()-l&&o(p,c)})}),define("js/guang/detail",["zepto","mlellipsis","lazyload","iscroll-probe"],function(e,a,s){function t(e){var a=e.offset().left,s=-C+a+w/2+"px";n.css({backgroundPosition:s+" bottom"}),m&&b.css({backgroundPosition:s+" bottom"})}function i(e){var a,s,i,u=p(e.currentTarget),f=u.index();u.hasClass("focus")||(l.filter(".focus").removeClass("focus"),m&&(a=u.closest(".fixed-thumb-container").length>0?n:b,s=a.find(".thumb").eq(f),b.find(".thumb.focus").removeClass("focus"),s.addClass("focus")),u.addClass("focus"),t(u),r.not(".hide").addClass("hide"),i=r.eq(f),i.removeClass("hide"),h(i.find(".lazy")),m?c&&c.scrollToElement(d,400):p("body").animate({scrollTop:o.offset().top},400))}var o,n,l,r,d,c,p=e("zepto"),u=e("mlellipsis"),h=e("lazyload"),f=e("iscroll-probe"),g=p(".author .intro"),m=navigator.userAgent.indexOf("iPhone")>0?!0:!1,v=p(".collocation-block").length>0?!0:!1,w=0,b=p(""),d=document.querySelector("#wrapper .collocation-block"),C=p(window).width();m&&p("#wrapper").addClass("ios"),u.init(),h(p(".lazy")),p(".info-list .title, .one-good .reco-name").each(function(){this.mlellipsis(2)}),parseInt(g.offset().left,10)===parseInt(g.css("margin-left"),10)&&g.css("padding-top",0),v&&(o=p(".collocation-block"),n=o.children(".thumb-container"),l=n.find("li"),r=o.find(".prod"),w=l.width(),m&&(b=p("#wrapper").after(n.clone().addClass("fixed-thumb-container fixed-bottom")).next(".thumb-container"),h(b.find(".lazy"),{event:"sporty"})),t(l.filter(".focus")),n.delegate(".thumb","touchend",i),m&&b.delegate(".thumb","touchend",i)),window.onload=function(){var e,a,s,t,i,l=p("#scroller");if(m){if(c=new f("#wrapper",{probeType:3,mouseWheel:!0,click:!0}),document.addEventListener("touchmove",function(e){e.preventDefault()},!1),!v)return void c.on("scroll",function(){l.trigger("scroll")});e=p(window).height(),i=b[0],a=n.height(),s=o.height(),t=o.offset().top,c.on("scroll",function(){var o=-this.y,n=i.className;t-e+a>=o?-1===n.indexOf("fixed-bottom")&&b.addClass("fixed-bottom").removeClass("hide"):t>=o?-1===n.indexOf("hide")&&b.addClass("hide").removeClass("fixed-bottom fixed-top"):t+s-a>=o?-1===n.indexOf("fixed-top")&&b.addClass("fixed-top").removeClass("hide absolute").css("top",""):t+s>=o?(-1===n.indexOf("absolute")&&b.addClass("absolute").removeClass("fixed-top hide"),i.style.top=t+s-a-o+"px"):o>t+s&&-1===n.indexOf("hide")&&b.addClass("hide").removeClass("absolute"),l.trigger("scroll")})}}}),define("js/home/index",["zepto","swiper","lazyload","index"],function(e,a,s){e("js/home/home"),e("js/home/maybe-like")}),define("js/home/home",["zepto","swiper","lazyload","index"],function(e,a,s){function t(){v+=10,w.css({transform:"rotateX("+v+"deg)","-webkit-transform":"rotateX("+v+"deg)","-moz-transform":"rotateX("+v+"deg)"}),v/90%2===1&&(b?(w.addClass("animate"),b=!1):(w.removeClass("animate"),b=!0)),v/90%2===0&&v%360!==0?window.setTimeout(t,3e3):v%360===0?window.setTimeout(t,18e4):d(function(){t()})}var i,o,n,l,r,d,c,p,u,h,f=e("zepto"),g=e("swiper"),m=e("lazyload"),v=0,w=f(".home-header .logo"),b=!0;e("js/home/maybe-like"),m(f("img.lazy")),f(".nav-btn").on("click",function(e){f(this).hasClass("menu-open")||(f(".mobile-wrap").addClass("menu-open"),f(".overlay").addClass("show"),f(".side-nav").addClass("on"),f("body").css({height:f(window).height(),width:"100%",overflow:"hidden"})),e.stopPropagation()}),f(".mobile-wrap").on("click",function(){f(this).hasClass("menu-open")&&(f(".mobile-wrap").removeClass("menu-open"),f(".overlay").removeClass("show"),f(".sub-nav").removeClass("show"),f(".side-nav").removeClass("on"),f("body").css({height:"auto",overflow:"auto"}))}),f(".side-nav").on("click","li",function(){f(this).find(".sub-nav").size()>0&&(f(".sub-nav").removeClass("show"),f(this).find(".sub-nav").addClass("show"))}),f(".sub-nav").each(function(){f(this).find("li").eq(0).on("click",function(e){f(".sub-nav").removeClass("show"),e.stopPropagation()})}),f(".sub-nav").on("mouseenter","li",function(){0!==f(this).index()&&f(this).addClass("current").siblings().removeClass("current")}),f(".banner-swiper").find("li").size()>1&&(i=new g(".banner-swiper",{loop:!0,autoplay:3e3,autoplayDisableOnInteraction:!1,paginationClickable:!0,slideElement:"li",pagination:".banner-top .pagination-inner"})),n=new g(".brands-swiper",{grabCursor:!0,slidesPerView:"auto",wrapperClass:"brands-list",slideElement:"li"}),o=new g(".recommend-swiper",{grabCursor:!0,slidesPerView:"auto",wrapperClass:"recommend-list",slideElement:"li"}),f(".trend-topic-swiper").find("li").size()>1&&(l=new g(".trend-topic-swiper",{loop:!0,autoplay:3e3,autoplayDisableOnInteraction:!1,paginationClickable:!0,slideElement:"li",pagination:".trend-topic-content .pagination-inner"})),f(".category-swiper").each(function(e,a){u="category-swiper"+e,f(this).addClass(u),f("."+u).find(".swiper-slide").size()>1&&(r=new g("."+u,{loop:!0,autoplay:3e3,autoplayDisableOnInteraction:!1,paginationClickable:!0,slideElement:"li",pagination:"."+u+" .pagination-inner"}))}),f(".header-download").on("click",".close-btn",function(){f(this).parent().remove()}),d=function(){var e=null,a=["webkit","moz","ms"];for(p=0;p<a.length;p++)c=a[p]+"RequestAnimationFrame",window[c]&&(h=!0,e=c);return h?function(a){window[e](a)}:function(e){window.setTimeout(e,67)}}(),t()}),define("js/home/maybe-like",["zepto","lazyload"],function(e,a,s){var t,i,o,n,l=e("zepto"),r=e("js/plugin/tip"),d=e("lazyload"),c=l(window).height(),p=l("#load-more").height(),u=l("#goods-list"),h=!1,f=0,g=l(".mobile-wrap").hasClass("boys-wrap")?"1,3":"2,3",m=l(".mobile-wrap").hasClass("kids-wrap")?!0:!1,v=l(".mobile-wrap").hasClass("lifestyle-wrap")?!0:!1,w=l("#maybe-like-nav");i=m?"/product/recom/maylikekids":v?"/product/recom/maylikelife":"/product/recom/maylike?gender="+g,o=w.children(".focus"),l("#maybe-like-nav").delegate("li","touchstart",function(){var e,a=l(this),s=l(".goods-list");a.hasClass("focus")||(n=a.index(),a.addClass("focus"),o.removeClass("focus"),s.not(".hide").addClass("hide"),e=s.eq(n),e.removeClass("hide"),o=a,l(document).trigger("scroll"))}),l(window).scroll(function(){if(l(window).scrollTop()+c>=l(document).height()-p){if(h)return;h=!0,t=u.children(".good-info").length,l.ajax({type:"GET",url:i,data:{page:f+1},success:function(e){return" "===e?void(h=!0):(u.append(e),d(l(".good-info").find("img.lazy")),h=!1,void f++)},error:function(){r.show("网络断开连接了~"),h=!1}})}})}),define("js/product/index",["zepto","swiper","lazyload","index"],function(e,a,s){e("js/product/newsale/newarrival"),e("js/product/newsale/discount"),e("js/product/list"),e("js/product/detail/detail")}),define("js/product/newsale/newarrival",["zepto","swiper","lazyload","index"],function(e,a,s){var t,i,o=e("zepto"),n=e("js/plugin/tip"),l=e("swiper"),r=e("lazyload"),d=o("#newarrival-nav"),c=o("#newarrival-goods-list"),p=c.children(".goods-list"),u=o(window).height(),h=o("#load-more").height(),f=o(".goods-list"),g=!1,m=0,v=0;i=new l(".swiper-container",{lazyLoading:!0,pagination:".swiper-pagination"}),r(o("img.lazy")),t=d.children(".focus"),o("#newarrival-nav").delegate("li","touchstart",function(){var e,a=o(this);a.hasClass("focus")||(v=a.index(),a.addClass("focus"),t.removeClass("focus"),p.not(".hide").addClass("hide"),e=p.eq(v),e.removeClass("hide"),t=a,o(document).trigger("scroll"))}),o(window).scroll(function(){if(o(window).scrollTop()+u>=o(document).height()-h){if(g)return;g=!0,o.ajax({type:"GET",url:"/product/newsale/selectNewSale",data:{dayLimit:v+1,page:m+1},success:function(e){return" "===e?void(g=!0):(f.append(e),r(o(".good-info").find("img.lazy")),g=!1,void m++)},error:function(){n.show("网络断开连接了~"),g=!1}})}})}),define("js/product/newsale/discount",["zepto","swiper","lazyload","index"],function(e,a,s){function t(e){var a="0.1,0.3";switch(e){case 0:a="0.1,0.3";break;case 1:a="0.4,0.6";break;case 2:a="0.7,0.9";break;case 3:a="0.1,0.9"}return a}var i,o,n=e("zepto"),l=e("swiper"),r=e("lazyload"),d=n("#discount-nav"),c=n("#discount-goods-list"),p=c.children(".goods-list"),u=n(".goods-list"),h=0,f=n(window).height(),g=n("#load-more").height(),m=!1,v=0,w="";o=new l(".swiper-container",{lazyLoading:!0,pagination:".swiper-pagination"}),r(n("img.lazy")),i=d.children(".focus"),n("#discount-nav").delegate("li","touchstart",function(){var e,a=n(this);a.hasClass("focus")||(h=a.index(),w=t(h),a.addClass("focus"),i.removeClass("focus"),p.not(".hide").addClass("hide"),e=p.eq(h),e.removeClass("hide"),i=a,n(document).trigger("scroll"))}),n(window).scroll(function(){if(n(window).scrollTop()+f>=n(document).height()-g){if(m)return;m=!0,n.ajax({type:"GET",url:"/product/newsale/selectNewSale",data:{p_d:w,page:v+1},success:function(e){return" "===e?void(m=!1):(u.append(e),r(n(".good-info").find("img.lazy")),m=!1,void v++)},error:function(){tip.show("网络断开连接了~"),m=!1}})}})}),define("js/product/list",["zepto","lazyload"],function(e,a,s){function t(e){var a,s,t,r,d,c={};if(e){for(s in w)w.hasOwnProperty(s)&&(w[s].reload=!0);switch(v.children(".active").removeClass("active"),i.addClass("active"),e.type){case"gender":a={gender:e.id};break;case"brand":a={brand:e.id};break;case"msort":a={msort:e.id};break;case"color":a={color:e.id};break;case"size":a={size:e.id};break;case"price":a={price:e.id};break;case"discount":a={discount:e.id}}n.extend(m,a)}if(!o){if(i.hasClass("new")?r="newest":i.hasClass("price")?r="price":i.hasClass("discount")&&(r="discount"),t=w[r],d=t.page+1,t.reload)d=1;else if(t.end)return;n.extend(c,m,{type:r,order:t.order,page:d}),o=!0,n.ajax({type:"GET",url:"/product/list/search",data:c,success:function(e){var a,s='<p class="no-result">未找到相关搜索结果</p>';switch(r){case"newest":a=u;break;case"price":a=h;break;case"discount":a=f}" "===e?(t.end=!0,t.reload&&a.html(s)):(t.reload?a.html(e):a.append(e),l(a.find(".lazy"))),t.reload=!0,t.page=d,o=!1}})}}var i,o,n=e("zepto"),l=e("lazyload"),r=n("#brand-header"),d=n("#intro-box"),c=e("js/plugin/filter"),p=n("#goods-container"),u=p.children(".new-goods"),h=p.children(".price-goods"),f=p.children(".discount-goods"),g=n(window).height(),m={gender:n("#gender").val(),brand:n("#brand").val(),msort:n("#msort").val(),color:n("#color").val(),size:n("#size").val(),price:n("#price").val(),discount:n("#discount").val()},v=n("#list-nav"),w={newest:{order:1,reload:!0,page:0,end:!1},price:{order:0,reload:!0,page:0,end:!1},discount:{order:0,reload:!0,page:0,end:!1}};l(n(".lazy")),c.registerCbFn(t),v.delegate("li","touchstart",function(){var e,a,s,o=n(this);if(o.hasClass("filter"))o.hasClass("active")?(c.hideFilter(),i.addClass("active"),o.removeClass("active")):(i=o.siblings(".active"),i.removeClass("active"),o.addClass("active"),c.showFilter());else{if(o.hasClass("new")?a="newest":o.hasClass("price")?a="price":o.hasClass("discount")&&(a="discount"),e=w[a],o.hasClass("active")){if(o.hasClass("new"))return;(o.hasClass("price")||o.hasClass("discount"))&&(o.find(".icon > .iconfont").toggleClass("cur"),i=o,e.reload=!0,e.order=0===e.order?1:0)}else{if(s=o.siblings(".active"),i=o,s.hasClass("filter"))c.hideFilter();else switch(p.children(".container:not(.hide)").addClass("hide"),a){case"newest":u.removeClass("hide");break;case"price":h.removeClass("hide");break;case"discount":f.removeClass("hide")}s.removeClass("active"),o.addClass("active")}e.reload&&t()}}),n(window).scroll(function(){n(window).scrollTop()+g>n(document).height()-.25*p.height()&&t()}),r.children(".btn-intro").bind("touchstart",function(){d.removeClass("hide")}),n(".close-intro, .brand-intro-box").click(function(){d.addClass("hide")}),n("#brand-intro").click(function(e){e.stopPropagation()}),r.children(".btn-col").bind("touchstart",function(){n(this).toggleClass("coled")})}),define("js/plugin/filter",["zepto"],function(e,a,s){function t(){r.addClass("hide")}function i(){r.removeClass("hide")}function o(e){n=e}var n,l=e("zepto"),r=l(".filter-mask, .filter-body"),d=r.find(".classify"),c=r.find(".sub-classify");d.children(":first-child").addClass("active"),d.delegate(".classify-item","touchstart",function(){var e=l(this);e.hasClass("active")||(e.siblings(".active").removeClass("active"),e.addClass("active"))}),r.filter(".filter-mask").click(function(){t()}),c.delegate("li","click",function(e){var a,s,i=l(this),o=i.data("id"),r=i.closest(".sub-classify"),d=r.siblings(".shower");e.stopPropagation(),i.hasClass("chosed")||(r.children(".chosed").removeClass("chosed"),i.addClass("chosed"),a=l.trim(i.html()),s=l.trim(d.html()),d.html(s.substring(0,s.indexOf("</span>")+7)+a.substring(0,a.indexOf("<i"))),0===i.index()?d.addClass("default"):d.removeClass("default"),n&&n({type:r.data("type"),id:o}),t())}),a.showFilter=i,a.hideFilter=t,a.registerCbFn=o}),define("js/product/detail/detail",["zepto","swiper","lazyload","index"],function(e,a,s){var t,i=e("zepto"),o=e("swiper"),n=e("lazyload");n(i("img.lazy")),t=new o(".banner-swiper",{loop:!0,pagination:".banner-top .pagination-inner",slideElement:"div",nextButton:".swiper-button-next",prevButton:".swiper-button-prev"})}),define("js/index/index",["zepto"],function(e,a,s){e("js/index/search"),e("js/index/channel")}),define("js/index/search",["zepto"],function(e,a,s){var t=e("zepto"),i=t("#search-input > input"),o=t("#search-input > .clear-input"),n=t(".history");t("#clear-history").bind("touchstart",function(){t.ajax({type:"POST",url:"/search/clearHistory",success:function(e){200===e.code&&n.html("")}})}),t("#search").bind("touchstart",function(){var e=i.val();t.ajax({type:"POST",url:"/search",data:{val:e},success:function(e){200===e.code&&(location.href=e.data)}})}),i.bind("input",function(){""===i.val()?o.addClass("hide"):o.removeClass("hide")}),o.bind("touchstart",function(){i.val("").trigger("input")})}),define("js/index/channel",[],function(e,a,s){});