index.js 25.8 KB
define("index",["zepto","lazyload","swiper","mlellipsis","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(r.trim(t.substring(s,t.indexOf(";",s)))))),a}function n(){var e,a=t("_UID");return"undefined"==typeof a?0:(e=a.split("::"),"undefined"==typeof e||e.length<4?0:e)}function i(){var e=n();return 0===e?0:e[1]}function o(){var e=t("_g");return"undefined"==typeof e?"":JSON.parse(e).k}var r=e("zepto");!function(){var e=r("#yoho-footer"),a=e.children(".op-row"),s=n();r("body").height()<r(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=n,window.getUid=i,window.getShoppingKey=o}),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"),n=t("#phone-num"),i=t("#country-select"),o=t("#area-code"),r=t("#btn-next"),l=e("js/passport/api"),d=e("js/plugin/tip"),c=t.trim,p=d.show;l.selectCssHack(t("#country-select")),l.bindClearEvt(),n.bind("input",function(){""===c(n.val())?r.addClass("disable"):r.removeClass("disable")}),i.change(function(){o.text(i.val())}),r.on("touchstart",function(){var e=c(n.val()),a=i.val();r.hasClass("disable")||(l.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=r(".has-eye");a.append('<div class="eye close"></div>'),e=a.children(".eye"),e.on("touchstart",function(e){var a=r(this),s=a.siblings(".pwd");e.preventDefault(),a.toggleClass("close"),a.hasClass("close")?s.attr("type","password"):s.attr("type","text"),s.focus()})}function n(){var e,a=r(".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=r(this),a=e.siblings(".clear-input"),s=l(e.val());""===s?a.hide():a.show()})}function i(e){return e.length>=6&&e.length<=20?!0:!1}function o(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 r=e("zepto"),l=r.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:n,pwdValidate:i,selectCssHack:o}}),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,n.text(s).show(),i=setTimeout(function(){"block"===n.css("display")&&n.hide()},t))}var n,i,o=e("zepto");!function(){var e='<div id="yoho-tip" class="yoho-tip"></div>';o(".yoho-page").append(e),n=o("#yoho-tip"),n.on("touchstart",function(){n.hide(),clearTimeout(i)})}(),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?(o.text("重发验证码").removeClass("disable"),clearInterval(e)):o.text("重发验证码 ("+a--+"秒)")},1e3)}var n=t("#captcha"),i=t("#btn-next"),o=t("#captcha-tip"),r=t("#phone-num").val(),l=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(),n.bind("input",function(){""!==p(n.val())?i.removeClass("disable"):i.addClass("disable")}),o.on("touchstart",function(){o.hasClass("disable")||t.ajax({type:"POST",url:"/passport/"+h+"/sendcode",data:{phoneNum:r,areaCode:l},success:function(e){200===e.code?(o.text("重发验证码 (60秒)").addClass("disable"),s()):u(e.message)}})}),i.on("touchstart",function(){i.hasClass("disable")||t.ajax({type:"POST",url:"/passport/"+h+"/verifycode",data:{phoneNum:r,areaCode:l,code:p(n.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"),n=t("#pwd"),i=t("#btn-sure"),o=e("js/passport/api"),r=e("js/plugin/tip"),l=t.trim,d=r.show;o.bindEyesEvt(),n.bind("input",function(){""===l(n.val())?i.addClass("disable"):i.removeClass("disable")}),i.on("touchstart",function(){var e=l(n.val());i.hasClass("disable")||(o.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 n(){c.show(),p.show()}function i(){c.hide(),p.hide()}var o=e("zepto"),r=o("#account"),l=o("#pwd"),d=o("#btn-login"),c=o("#retrive-pwd-mask"),p=o("#retrive-pwd-ways"),u=!1,h=!1,f=e("js/passport/api"),g=e("js/plugin/tip"),v=o.trim,m=g.show;f.bindEyesEvt(),f.bindClearEvt(),r.bind("input",function(){u=""!==v(r.val())?!0:!1,t()}),l.bind("input",function(){h=""===v(l.val())?!1:!0,t()}),d.on("touchstart",function(){var e=v(r.val()),a=v(l.val());d.hasClass("disable")||((/^[0-9]+$/.test(e)||f.emailRegx.test(e))&&f.pwdValidate(a)?o.ajax({type:"POST",url:"/passport/login/auth",data:{account:e,password:a},success:function(e){200===e.code?(m("登录成功"),setTimeout(function(){location.href=e.data},1e3)):m(e.message)},error:function(){m("网络断开连接啦~")}}):m("账号或密码有错误,请重新输入"))}),o("#forget-pwd").on("touchstart",function(){n()}),c.on("touchstart",function(){i()}),o("#cancel-retrive").on("touchstart",function(e){e.preventDefault(),i()}),r.trigger("input"),l.trigger("input")}),define("js/passport/login/international",["zepto"],function(e,a,s){function t(){c&&p?d.removeClass("disable"):d.addClass("disable")}var n=e("zepto"),i=n("#phone-num"),o=n("#country-select"),r=n("#area-code"),l=n("#pwd"),d=n("#btn-login"),c=!1,p=!1,u=e("js/passport/api"),h=e("js/plugin/tip"),f=n.trim,g=h.show;u.selectCssHack(o),u.bindEyesEvt(),u.bindClearEvt(),i.bind("input",function(){c=""===f(i.val())?!1:!0,t()}),l.bind("input",function(){var e=f(l.val());p=""===e?!1:!0,t()}),o.change(function(){r.text(o.val())}),d.on("touchstart",function(){var e=f(i.val()),a=o.val(),s=f(l.val());d.hasClass("disable")||(u.phoneRegx[a].test(e)&&u.pwdValidate(s)?n.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("账号或密码有错误,请重新输入"))}),i.trigger("input"),l.trigger("input")}),define("js/passport/back/mobile",["zepto"],function(e,a,s){var t=e("zepto"),n=t("#phone-num"),i=t("#country-select"),o=t("#area-code"),r=t("#btn-next"),l=e("js/passport/api"),d=e("js/plugin/tip"),c=t.trim,p=d.show;l.selectCssHack(t("#country-select")),l.bindClearEvt(),n.bind("input",function(){""===c(n.val())?r.addClass("disable"):r.removeClass("disable")}),i.change(function(){o.text(i.val())}),r.on("touchstart",function(){var e=c(n.val()),a=i.val();r.hasClass("disable")||(l.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"),n=t("#email"),i=t("#btn-sure"),o=e("js/passport/api"),r=e("js/plugin/tip"),l=t.trim,d=r.show;o.bindClearEvt(),n.bind("input",function(){""===l(n.val())?i.addClass("disable"):i.removeClass("disable")}),i.on("touchstart",function(){var e=l(n.val());i.hasClass("disable")||(o.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"),n=t("#resend"),i=e("js/plugin/tip"),o=i.show;n.on("touchstart",function(e){e.preventDefault(),t.ajax({url:n.data("url"),type:"GET",success:function(e){o(200===e.code?e.message:e.message)}})})}),define("js/passport/back/new-password",["zepto"],function(e,a,s){var t=e("zepto"),n=t("#pwd"),i=t("#btn-ok"),o=e("js/passport/api"),r=e("js/plugin/tip"),l=t.trim,d=r.show,c=t("#phone-num");o.bindEyesEvt(),n.bind("input",function(){""===l(n.val())?i.addClass("disable"):i.removeClass("disable")}),i.on("touchstart",function(){var e,a,s=l(n.val()),r=!0;i.hasClass("disable")||(e={password:s},0===c.length&&(r=!1),r?(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"),o.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","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")}),define("js/guang/plus-star/list",["zepto","lazyload","swiper","index"],function(e,a,s){var t,n=e("zepto"),i=e("lazyload"),o=e("swiper"),r=n("#nav-tab > li"),l=n("#ps-content > .content");i(n("img.lazy")),t=new o(".swiper-container",{lazyLoading:!0,pagination:".swiper-pagination"}),n("#nav-tab").delegate("li","touchstart",function(){n(this).hasClass("focus")||(r.toggleClass("focus"),l.toggleClass("hide"),n(document).trigger("scroll"))})}),define("js/guang/plus-star/detail",["zepto","mlellipsis","lazyload"],function(e,a,s){var t,n,i=e("zepto"),o=e("mlellipsis"),r=e("lazyload"),l=i("#intro"),d=i("#intro-more-txt"),c=i("#related-infos-container"),p=e("js/guang/info"),u=e("js/plugin/tip"),h=i("#brand-info").data("id");o.init(),r(i("img.lazy")),l[0].mlellipsis(3),setTimeout(function(){t=l.text(),n=l.attr("title")}),p.initInfosEvt(c),i("#more-intro").bind("touchstart",function(){var e=i(this);e.toggleClass("spread"),e.hasClass("spread")?(l.text(n),d.text("收起")):(l.text(t),d.text("more"))}),i("#brand-like").bind("touchstart",function(e){var a="ok",s=i(this);e.preventDefault(),s.hasClass("like")&&(a="cancel"),i.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){l(e.find("img.lazy")),e.each(function(){var e=o(this),a=e.find(".info-title"),s=e.find(".info-text");a[0].mlellipsis(2),s[0].mlellipsis(2)})}function n(e){e.delegate(".like-btn","touchstart",function(e){var a=o(e.currentTarget),s=a.closest(".guang-info"),t="ok";a.hasClass("like")&&(t="cancel"),o.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 i(e,a){h||a.end||(h=!0,o.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 o=e("zepto"),r=e("mlellipsis"),l=e("lazyload"),d=e("js/plugin/tip"),c=o("#load-more-info"),p=o(""),u=o(""),h=!1;r.init(),c.length>0&&(p=c.children(".loading"),u=c.children(".no-more")),a.initInfosEvt=n,a.setLazyLoadAndMellipsis=t,a.loadMore=i}),define("js/guang/home",["zepto","swiper","mlellipsis","lazyload","index"],function(e,a,s){var t,n=e("zepto"),i=e("swiper"),o=e("js/guang/info"),r=o.setLazyLoadAndMellipsis,l=o.loadMore,d=n("#load-more-info"),c=n(""),p=n(""),u=n(window).height(),h=d.height(),f=n("#info-list"),g=f.children(".info-list"),v=n("#guang-nav"),m=v.children(".focus"),w=m.data("type"),b={};d.length>0&&(c=d.children(".loading"),p=d.children(".no-more")),t=new i(".swiper-container",{lazyLoading:!0,pagination:".swiper-pagination"}),o.initInfosEvt(f),function(){var e=n("#gender").val();v.children(".guang-nav-item").each(function(){var a=n(this).data("type");b[a]={page:1,gender:e,type:a,end:!1}})}(),v.delegate(".guang-nav-item","touchstart",function(){var e,a,s=n(this);s.hasClass("focus")||(a=s.index(),s.addClass("focus"),m.removeClass("focus"),g.not(".hide").addClass("hide"),e=g.eq(a),e.removeClass("hide"),r(e.children(".guang-info")),m=s,w=s.data("type"),b[w].end?(c.addClass("hide"),p.removeClass("hide")):(c.removeClass("hide"),p.addClass("hide")))}),n(document).scroll(function(){n(window).scrollTop()+u>=n(document).height()-h&&l(g,b[w])})}),define("js/guang/list",["zepto","mlellipsis","lazyload"],function(e,a,s){var t=e("zepto"),n=e("js/guang/info"),i=n.loadMore,o=t(window).height(),r=t("#load-more").height(),l=t("#author-infos"),d=t("#tag"),c={page:1,end:!1},p=t("#info-list");n.initInfosEvt(p),l.length>0&&t.extend(c,{authorId:l.data("id")}),d.length>0&&t.extend(c,{tag:d.val()}),t(document).scroll(function(){t(window).scrollTop()+o>=t(document).height()-r&&i(p,c)})}),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(){m+=10,w.css({transform:"rotateX("+m+"deg)","-webkit-transform":"rotateX("+m+"deg)","-moz-transform":"rotateX("+m+"deg)"}),m/90%2===1&&(b?(w.addClass("animate"),b=!1):(w.removeClass("animate"),b=!0)),m/90%2===0&&m%360!==0?window.setTimeout(t,3e3):m%360===0?window.setTimeout(t,18e4):d(function(){t()})}var n,i,o,r,l,d,c,p,u,h,f=e("zepto"),g=e("swiper"),v=e("lazyload"),m=0,w=f(".home-header .logo"),b=!0;e("js/home/maybe-like"),v(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&&(n=new g(".banner-swiper",{loop:!0,autoplay:3e3,autoplayDisableOnInteraction:!1,paginationClickable:!0,slideElement:"li",pagination:".banner-top .pagination-inner"})),o=new g(".brands-swiper",{grabCursor:!0,slidesPerView:"auto",wrapperClass:"brands-list",slideElement:"li"}),i=new g(".recommend-swiper",{grabCursor:!0,slidesPerView:"auto",wrapperClass:"recommend-list",slideElement:"li"}),f(".trend-topic-swiper").find("li").size()>1&&(r=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&&(l=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,n,i,o,r=e("zepto"),l=e("js/plugin/tip"),d=e("lazyload"),c=r(window).height(),p=r("#load-more").height(),u=r("#goods-list"),h=!1,f=0,g=r(".mobile-wrap").hasClass("boys-wrap")?"1,3":"2,3",v=r(".mobile-wrap").hasClass("kids-wrap")?!0:!1,m=r(".mobile-wrap").hasClass("lifestyle-wrap")?!0:!1,w=r("#maybe-like-nav");n=v?"/product/recom/maylikekids":m?"/product/recom/maylikelife":"/product/recom/maylike?gender="+g,i=w.children(".focus"),r("#maybe-like-nav").delegate("li","touchstart",function(){var e,a=r(this),s=r(".goods-list");a.hasClass("focus")||(o=a.index(),a.addClass("focus"),i.removeClass("focus"),s.not(".hide").addClass("hide"),e=s.eq(o),e.removeClass("hide"),i=a,r(document).trigger("scroll"))}),r(window).scroll(function(){if(r(window).scrollTop()+c>=r(document).height()-p){if(h)return;h=!0,t=u.children(".good-info").length,r.ajax({type:"GET",url:n,data:{page:f+1},success:function(e){return" "===e?void(h=!0):(u.append(e),d(r(".good-info").find("img.lazy")),h=!1,void f++)},error:function(){l.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,n,i=e("zepto"),o=e("js/plugin/tip"),r=e("swiper"),l=e("lazyload"),d=i("#newarrival-nav"),c=i("#newarrival-goods-list"),p=c.children(".goods-list"),u=i(window).height(),h=i("#load-more").height(),f=i(".goods-list"),g=!1,v=0,m=0;n=new r(".swiper-container",{lazyLoading:!0,pagination:".swiper-pagination"}),l(i("img.lazy")),t=d.children(".focus"),i("#newarrival-nav").delegate("li","touchstart",function(){var e,a=i(this);a.hasClass("focus")||(m=a.index(),a.addClass("focus"),t.removeClass("focus"),p.not(".hide").addClass("hide"),e=p.eq(m),e.removeClass("hide"),t=a,i(document).trigger("scroll"))}),i(window).scroll(function(){if(i(window).scrollTop()+u>=i(document).height()-h){if(g)return;g=!0,i.ajax({type:"GET",url:"/product/newsale/selectNewSale",data:{dayLimit:m+1,page:v+1},success:function(e){return" "===e?void(g=!0):(f.append(e),l(i(".good-info").find("img.lazy")),g=!1,void v++)},error:function(){o.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 n,i,o=e("zepto"),r=e("swiper"),l=e("lazyload"),d=o("#discount-nav"),c=o("#discount-goods-list"),p=c.children(".goods-list"),u=o(".goods-list"),h=0,f=o(window).height(),g=o("#load-more").height(),v=!1,m=0,w="";i=new r(".swiper-container",{lazyLoading:!0,pagination:".swiper-pagination"}),l(o("img.lazy")),n=d.children(".focus"),o("#discount-nav").delegate("li","touchstart",function(){var e,a=o(this);a.hasClass("focus")||(h=a.index(),w=t(h),a.addClass("focus"),n.removeClass("focus"),p.not(".hide").addClass("hide"),e=p.eq(h),e.removeClass("hide"),n=a,o(document).trigger("scroll"))}),o(window).scroll(function(){if(o(window).scrollTop()+f>=o(document).height()-g){if(v)return;v=!0,o.ajax({type:"GET",url:"/product/newsale/selectNewSale",data:{p_d:w,page:m+1},success:function(e){return" "===e?void(v=!1):(u.append(e),l(o(".good-info").find("img.lazy")),v=!1,void m++)},error:function(){tip.show("网络断开连接了~"),v=!1}})}})}),define("js/product/list",["zepto","lazyload"],function(e,a,s){function t(e){var a,s,t,l,d,c={};if(e){for(s in w)w.hasOwnProperty(s)&&(w[s].reload=!0);switch(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}}o.extend(v,a)}if(!i){if(n.hasClass("new")?l="newest":n.hasClass("price")?l="price":n.hasClass("discount")&&(l="discount"),t=w[l],d=t.page+1,t.reload)d=1;else if(t.end)return;o.extend(c,v,{type:l,order:t.order,page:d}),i=!0,o.ajax({type:"GET",url:"/product/list/search",data:c,success:function(e){var a,s='<p class="no-result">未找到相关搜索结果</p>';switch(l){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),r(a.find(".lazy"))),t.reload=!0,t.page=d,i=!1}})}}var n,i,o=e("zepto"),r=e("lazyload"),l=o("#brand-header"),d=o("#intro-box"),c=e("js/plugin/filter"),p=o("#goods-container"),u=p.children(".new-goods"),h=p.children(".price-goods"),f=p.children(".discount-goods"),g=o(window).height(),v={gender:o("#gender").val(),brand:o("#brand").val(),msort:o("#msort").val(),color:o("#color").val(),size:o("#size").val(),price:o("#price").val(),discount:o("#discount").val()},m=o("#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}};r(o(".lazy")),c.registerCbFn(t),m.delegate("li","touchstart",function(){var e,a,s,i=o(this);if(i.hasClass("filter"))i.hasClass("active")?(c.hideFilter(),n.addClass("active"),i.removeClass("active")):(n=i.siblings(".active"),n.removeClass("active"),i.addClass("active"),c.showFilter());else{if(i.hasClass("new")?a="newest":i.hasClass("price")?a="price":i.hasClass("discount")&&(a="discount"),e=w[a],i.hasClass("active")){if(i.hasClass("new"))return;(i.hasClass("price")||i.hasClass("discount"))&&(i.find(".icon > .iconfont").toggleClass("cur"),n=i,e.reload=!0,e.order=0===e.order?1:0)}else{if(s=i.siblings(".active"),n=i,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"),i.addClass("active")}e.reload&&t()}}),o(window).scroll(function(){o(window).scrollTop()+g>o(document).height()-.25*p.height()&&t()}),l.children(".btn-intro").bind("touchstart",function(){d.removeClass("hide")}),o(".close-intro, .brand-intro-box").click(function(){d.addClass("hide")}),o("#brand-intro").click(function(e){e.stopPropagation()}),l.children(".btn-col").bind("touchstart",function(){o(this).toggleClass("coled")})}),define("js/plugin/filter",["zepto"],function(e,a,s){function t(){l.addClass("hide")}function n(){l.removeClass("hide")}function i(e){o=e}var o,r=e("zepto"),l=r(".filter-mask, .filter-body"),d=l.find(".classify"),c=l.find(".sub-classify");d.children(":first-child").addClass("active"),d.delegate(".classify-item","touchstart",function(){var e=r(this);e.hasClass("active")||(e.siblings(".active").removeClass("active"),e.addClass("active"))}),l.filter(".filter-mask").click(function(){t()}),c.delegate("li","click",function(e){var a,s,n=r(this),i=n.data("id"),l=n.closest(".sub-classify"),d=l.siblings(".shower");e.stopPropagation(),n.hasClass("chosed")||(l.children(".chosed").removeClass("chosed"),n.addClass("chosed"),a=r.trim(n.html()),s=r.trim(d.html()),d.html(s.substring(0,s.indexOf("</span>")+7)+a.substring(0,a.indexOf("<i"))),0===n.index()?d.addClass("default"):d.removeClass("default"),o&&o({type:l.data("type"),id:i}),t())}),a.showFilter=n,a.hideFilter=t,a.registerCbFn=i}),define("js/product/detail/detail",["zepto","swiper","lazyload","index"],function(e,a,s){var t,n=e("zepto"),i=e("swiper"),o=e("lazyload");o(n("img.lazy")),t=new i(".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"),n=t("#search-input > input"),i=t("#search-input > .clear-input"),o=t(".history");t("#clear-history").bind("touchstart",function(){t.ajax({type:"POST",url:"/search/clearHistory",success:function(e){200===e.code&&o.html("")}})}),t("#search").bind("touchstart",function(){var e=n.val();t.ajax({type:"POST",url:"/search",data:{val:e},success:function(e){200===e.code&&(location.href=e.data)}})}),n.bind("input",function(){""===n.val()?i.addClass("hide"):i.removeClass("hide")}),i.bind("touchstart",function(){n.val("").trigger("input")})}),define("js/index/channel",[],function(e,a,s){});