index.js
36.3 KB
define("index",["zepto","swiper","lazyload","mlellipsis","iscroll-probe","index"],function(e,a,s){var i;e("js/common"),e("js/category/entry"),e("js/guang/entry"),e("js/home/entry"),e("js/index/entry"),e("js/passport/entry"),e("js/product/entry"),s.exports=i}),define("js/common",["zepto"],function(e,a,s){function i(e){var a,s,i=document.cookie;return document.cookie&&""!==document.cookie&&(s=i.indexOf(e+"="),s>-1&&(s+=e.length+1,a=decodeURIComponent(r.trim(i.substring(s,i.indexOf(";",s)))))),a}function t(e,a,s){var i,t,n,o,l="";"undefined"!=typeof a&&(s=s||{},null===a&&(a="",s.expires=-1),s.expires&&("number"==typeof s.expires||s.expires.toUTCString)&&("number"==typeof s.expires?(o=new Date,o.setTime(o.getTime()+24*s.expires*60*60*1e3)):o=s.expires,l="; expires="+o.toUTCString()),i=s.path?"; path="+s.path:"",t=s.domain?"; domain="+s.domain:"",n=s.secure?"; secure":"",document.cookie=[e,"=",encodeURIComponent(a),l,i,t,n].join(""))}function n(){var e,a=i("_UID");return"undefined"==typeof a?0:(e=a.split("::"),"undefined"==typeof e||e.length<4?0:e)}function o(){var e=n();return 0===e?0:e[1]}function l(){var e=i("_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=i,window.setCookie=t,window.getUser=n,window.getUid=o,window.getShoppingKey=l}),define("js/category/entry",["zepto","swiper","lazyload","index"],function(e,a,s){e("js/category/index"),e("js/category/brand")}),define("js/category/index",["zepto"],function(e,a,s){var i=e("zepto"),t=i(".category-nav"),n=i(".category-container > .content"),o=n.not(".hide");i("#search-input").focus(function(){i(this).blur()}),t.delegate("li","tap",function(){var e=i(this),a=e.index();e.hasClass("focus")||(t.find("li.focus").removeClass("focus"),e.addClass("focus"),o.addClass("hide"),o=n.eq(a).removeClass("hide"))}),i(".primary-level").delegate("li","tap",function(){var e=i(this),a=e.index(),s=e.closest(".content").find(".sub-level");e.hasClass("focus")||(e.closest(".primary-level").children(".focus").removeClass("focus"),e.addClass("focus"),s.not(".hide").addClass("hide"),s.eq(a).removeClass("hide"))})}),define("js/category/brand",["zepto","swiper","lazyload","index"],function(e,a,s){var i,t=e("zepto"),n=e("swiper"),o=e("lazyload"),l=t(".brand-list"),r=t(".newbrand-search").height(),d=t(".yoho-header").height(),c=parseInt(r)+parseInt(d);i=new n(".swiper-container",{lazyLoading:!0,loop:!0,autoplay:3e3,pagination:".swiper-pagination .pagination-inner"}),o(t("img.lazy")),t(".yoho-header").css({"z-index":2,position:"fixed"}),t(".banner-top").css("padding-top","90px"),l.length>0&&t(window).scroll(function(){var e=t(window).scrollTop();t(".brand-list").each(function(){var a=t(this).offset().top-c;e>=a?(l.find(".title-bar").css("position","static"),t(this).find(".title-bar").css({position:"fixed",top:c})):t(this).find(".title-bar").css("position","static")})}),t("#right-bar .con").find("b").unbind().on("tap",function(){var e=t(this).index();t(".bar-"+e).size()>0&&(document.body.scrollTop=parseInt(t(".bar-"+e)[0].offsetTop)-parseInt(c-1))})}),define("js/guang/entry",["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 i,t=e("zepto"),n=e("lazyload"),o=e("swiper"),l=t("#nav-tab > li"),r=t("#ps-content > .content");n(t("img.lazy")),i=new o(".swiper-container",{lazyLoading:!0,pagination:".swiper-pagination"}),t("#nav-tab").delegate("li","tap",function(){t(this).hasClass("focus")||(l.toggleClass("focus"),r.toggleClass("hide"),t(document).trigger("scroll"))})}),define("js/guang/plus-star/detail",["zepto","mlellipsis","lazyload"],function(e,a,s){var i,t,n=e("zepto"),o=e("mlellipsis"),l=e("lazyload"),r=n("#intro"),d=n("#intro-more-txt"),c=n("#related-infos-container"),p=e("js/guang/info"),u=e("js/plugin/tip"),h=n("#brand-info").data("id");o.init(),l(n("img.lazy")),r[0].mlellipsis(3),setTimeout(function(){i=r.text(),t=r.attr("title")}),p.initInfosEvt(c),n("#more-intro").bind("tap",function(){var e=n(this);e.toggleClass("spread"),e.hasClass("spread")?(r.text(t),d.text("收起")):(r.text(i),d.text("more"))}),n("#brand-like").bind("tap",function(e){var a="ok",s=n(this);e.preventDefault(),s.hasClass("like")&&(a="cancel"),n.ajax({type:"POST",url:"/product/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 i(e){r(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 t(e){e.delegate(".like-btn","tap",function(e){var a=o(e.currentTarget),s=a.closest(".guang-info"),i="ok";a.hasClass("like")&&(i="cancel"),o.ajax({type:"POST",url:"/guang/opt/praiseArticle",data:{id:s.data("id"),opt:i},success:function(e){var s=e.code;200===s&&(a.next(".like-count").text(e.data),a.toggleClass("like"))},error:function(){d.show("网络断开连接了~")}})}),i(e.find(".guang-info"))}function n(e,a){f||a.end||(0===a.page&&c.showLoadingMask(),f=!0,o.ajax({type:"GET",url:" /guang/index/page",data:a,success:function(s){return" "===s?(a.end=!0,f=!1,u.addClass("hide"),void h.removeClass("hide")):(e.append(s),i(e.find(".guang-info")),0===a.page&&c.hideLoadingMask(),a.page++,void(f=!1))},error:function(){d.show("网络断开连接了~"),f=!1}}))}var o=e("zepto"),l=e("mlellipsis"),r=e("lazyload"),d=e("js/plugin/tip"),c=e("js/plugin/loading"),p=o("#load-more-info"),u=o(""),h=o(""),f=!1;l.init(),p.length>0&&(u=p.children(".loading"),h=p.children(".no-more")),a.initInfosEvt=t,a.setLazyLoadAndMellipsis=i,a.loadMore=n}),define("js/plugin/tip",["zepto"],function(e,a,s){function i(e,a){var s,i;"undefined"!=typeof e&&(s=e.toString(),i=a&&a>0?a:2e3,t.text(s).show(),n=setTimeout(function(){"block"===t.css("display")&&t.hide()},i))}var t,n,o=e("zepto");!function(){var e='<div id="yoho-tip" class="yoho-tip"></div>';o(".yoho-page").append(e),t=o("#yoho-tip"),t.on("tap",function(){t.hide(),clearTimeout(n)})}(),a.show=i}),define("js/plugin/loading",["zepto"],function(e,a,s){function i(){n.removeClass("hide")}function t(){n.addClass("hide")}var n,o=e("zepto"),l=o(".yoho-page");!function(){var e='<div class="loading-mask hide"><div class="loading"></div></div>';l.append(e),n=l.children(".loading-mask")}(),a.showLoadingMask=i,a.hideLoadingMask=t}),define("js/guang/home",["zepto","swiper","mlellipsis","lazyload","index"],function(e,a,s){var i,t=e("zepto"),n=e("swiper"),o=e("js/guang/info"),l=o.loadMore,r=t("#load-more-info"),d=t(""),c=t(""),p=t(window).height(),u=r.height(),h=t("#info-list"),f=h.children(".info-list"),g=t("#guang-nav"),v=g.children(".focus"),m=v.data("type"),w={};r.length>0&&(d=r.children(".loading"),c=r.children(".no-more")),i=new n(".swiper-container",{lazyLoading:!0,pagination:".swiper-pagination"}),o.initInfosEvt(h),function(){var e=t("#gender").val();g.children(".guang-nav-item").each(function(){var a=t(this).data("type"),s=t(this).hasClass("focus");w[a]={page:s?1:0,gender:e,type:a,end:!1}})}(),g.delegate(".guang-nav-item","tap",function(){var e,a,s=t(this);s.hasClass("focus")||(a=s.index(),s.addClass("focus"),v.removeClass("focus"),f.not(".hide").addClass("hide"),e=f.eq(a),e.removeClass("hide"),v=s,m=s.data("type"),0===w[m].page&&l(e,w[m]),w[m].end?(d.addClass("hide"),c.removeClass("hide")):(d.removeClass("hide"),c.addClass("hide")))}),t(document).scroll(function(){t(window).scrollTop()+p>=t(document).height()-u&&l(f.not("hide"),w[m])})}),define("js/guang/list",["zepto","mlellipsis","lazyload"],function(e,a,s){var i=e("zepto"),t=e("js/guang/info"),n=t.loadMore,o=i(window).height(),l=i("#load-more").height(),r=i("#author-infos"),d=i("#tag"),c={page:1,end:!1},p=i("#info-list");t.initInfosEvt(p),r.length>0&&i.extend(c,{authorId:r.data("id")}),d.length>0&&i.extend(c,{tag:d.val()}),i(document).scroll(function(){i(window).scrollTop()+o>=i(document).height()-l&&n(p,c)})}),define("js/guang/detail",["zepto","mlellipsis","lazyload","iscroll-probe"],function(e,a,s){function i(e){var a=e.offset().left,s=-C+a+w/2+"px";o.css({backgroundPosition:s+" bottom"}),v&&b.css({backgroundPosition:s+" bottom"})}function t(e){var a,s,t,u=p(e.currentTarget),f=u.index();u.hasClass("focus")||(l.filter(".focus").removeClass("focus"),v&&(a=u.closest(".fixed-thumb-container").length>0?o:b,s=a.find(".thumb").eq(f),b.find(".thumb.focus").removeClass("focus"),s.addClass("focus")),u.addClass("focus"),i(u),r.not(".hide").addClass("hide"),t=r.eq(f),t.removeClass("hide"),h(t.find(".lazy")),v?c&&c.scrollToElement(d,400):p("body").animate({scrollTop:n.offset().top},400))}var n,o,l,r,d,c,p=e("zepto"),u=e("mlellipsis"),h=e("lazyload"),f=e("iscroll-probe"),g=p(".author .intro"),v=navigator.userAgent.indexOf("iPhone")>0?!0:!1,m=p(".collocation-block").length>0?!0:!1,w=0,b=p(""),d=document.querySelector("#wrapper .collocation-block"),C=p(window).width();v&&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),m&&(n=p(".collocation-block"),o=n.children(".thumb-container"),l=o.find("li"),r=n.find(".prod"),w=l.width(),v&&(b=p("#wrapper").after(o.clone().addClass("fixed-thumb-container fixed-bottom")).next(".thumb-container"),h(b.find(".lazy"),{event:"sporty"})),i(l.filter(".focus")),o.delegate(".thumb","touchend",t),v&&b.delegate(".thumb","touchend",t)),window.onload=function(){var e,a,s,i,t,l=p("#scroller");if(v){if(c=new f("#wrapper",{probeType:3,mouseWheel:!0,click:!0}),document.addEventListener("touchmove",function(e){e.preventDefault()},!1),!m)return void c.on("scroll",function(){l.trigger("scroll")});e=p(window).height(),t=b[0],a=o.height(),s=n.height(),i=n.offset().top,c.on("scroll",function(){var n=-this.y,o=t.className;i-e+a>=n?-1===o.indexOf("fixed-bottom")&&b.addClass("fixed-bottom").removeClass("hide"):i>=n?-1===o.indexOf("hide")&&b.addClass("hide").removeClass("fixed-bottom fixed-top"):i+s-a>=n?-1===o.indexOf("fixed-top")&&b.addClass("fixed-top").removeClass("hide absolute").css("top",""):i+s>=n?(-1===o.indexOf("absolute")&&b.addClass("absolute").removeClass("fixed-top hide"),t.style.top=i+s-a-n+"px"):n>i+s&&-1===o.indexOf("hide")&&b.addClass("hide").removeClass("absolute"),l.trigger("scroll")})}}}),define("js/home/entry",["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 i(){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(i,3e3):m%360===0?window.setTimeout(i,6e4):d(function(){i()})}var t,n,o,l,r,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("tap",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("tap",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("tap","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("tap",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&&(t=new g(".banner-swiper",{lazyLoading:!0,lazyLoadingInPrevNext:!0,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"}),n=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("tap",".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)}}(),i()}),define("js/home/maybe-like",["zepto","lazyload"],function(e,a,s){var i,t,n,o,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",v=l(".mobile-wrap").hasClass("kids-wrap")?!0:!1,m=l(".mobile-wrap").hasClass("lifestyle-wrap")?!0:!1,w=l("#maybe-like-nav");t=v?"/product/recom/maylikekids":m?"/product/recom/maylikelife":"/product/recom/maylike?gender="+g,n=w.children(".focus"),l("#maybe-like-nav").delegate("li","tap",function(){var e,a=l(this),s=l(".goods-list");a.hasClass("focus")||(o=a.index(),a.addClass("focus"),n.removeClass("focus"),s.not(".hide").addClass("hide"),e=s.eq(o),e.removeClass("hide"),n=a,l(document).trigger("scroll"))}),l(window).scroll(function(){if(l(window).scrollTop()+c>=l(document).height()-p){if(h)return;h=!0,i=u.children(".good-info").length,l.ajax({type:"GET",url:t,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/index/entry",["zepto"],function(e,a,s){e("js/index/search"),e("js/index/channel"),e("js/index/footer")}),define("js/index/search",["zepto"],function(e,a,s){var i=e("zepto"),t=i("#search-input input"),n=i("#search-input .clear-input"),o=i("#search-form"),l=i(".history"),r=i("#clear-history"),d=e("js/index/write-search"),c=d.getRanToken();r.bind("tap",function(){localStorage.removeItem("historys"),l.html("")}),t.bind("input",function(){""===t.val()?n.addClass("hide"):n.removeClass("hide")}),n.bind("tap",function(){t.val("").trigger("input")}),function(){var e,a,s,i="";if(localStorage&&(a=localStorage.getItem("historys"),a&&a.length>0)){for(a=a.split(c),s=0;s<a.length;s++)e=a[s],""!==e&&(i+='<li><a href="/?query='+e+'">'+e+"</li>");l.html(i),r.removeClass("hide")}}(),d.bindWirteLocal(o)}),define("js/index/write-search",[],function(e,a,s){function i(){return n}function t(e){e.on("submit",function(){var e,a=this.query.value;if(localStorage){if(e=localStorage.getItem("historys"),e=e?e:"",e.indexOf(n+a+n)>-1)return;""===e&&(a=n+a),e+=a+n,localStorage.setItem("historys",e)}})}var n=" ??++ ";a.getRanToken=i,a.bindWirteLocal=t}),define("js/index/channel",[],function(e,a,s){}),define("js/index/footer",["zepto"],function(e,a,s){function i(){var e="http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445",a=new Date;setTimeout(function(){new Date-a<2e3&&(window.location=e)},500)}var t=e("zepto"),n=t(".search-box"),o=t(".index-search"),l=t(".index-logo");t("#float-layer-close").bind("tap",function(){t("#float-layer-app").hide(),window.setCookie("_float-layer-app","id490655927",{domain:".yohobuy.com"}),window.setCookie("_float-layer-app-close",1,{domain:".yohobuy.com",expires:1})}),t("#float-layer-btn").tap(function(){i("bottom")}),window.cookie("_float-layer-app")?t("#float-layer-app").hide():t("#float-layer-app").show(),n.find("input").on("focus",function(){l.css({width:0,display:"none"}),n.css({width:"12.8rem"}),o.css({width:"15.5rem"}),t(".clear-text, .no-search").show()}).on("blur",function(){l.css({width:"5.4rem",display:"block"}),n.css({width:"8.8rem"}),o.css({width:"9.6rem"}),t(".clear-text, .no-search").hide()}),n.find(".clear-text").tap(function(){n.find("input").val("").trigger("focus")}),n.find(".search-icon").tap(function(){o.submit()})}),define("js/passport/entry",["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 i=e("zepto"),t=i("#phone-num"),n=i("#country-select"),o=i("#area-code"),l=i("#btn-next"),r=e("js/passport/api"),d=e("js/plugin/tip"),c=i.trim,p=d.show;r.selectCssHack(i("#country-select")),r.bindClearEvt(),t.bind("input",function(){""===c(t.val())?l.addClass("disable"):l.removeClass("disable")}),n.change(function(){o.text(n.val())}),l.on("tap",function(){var e=c(t.val()),a=n.val();l.hasClass("disable")||(r.phoneRegx[a].test(e)?i.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 i(e){var a,s=l(".has-eye");e&&"open"===e.status?s.append('<div class="eye"></div>'):s.append('<div class="eye close"></div>'),a=s.children(".eye"),a.on("tap",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 t(){var e,a=l(".has-clear");a.append('<div class="clear-input"></div>'),e=a.children(".clear-input"),e.on("tap",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 n(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 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:i,bindClearEvt:t,pwdValidate:n,selectCssHack:o}}),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 i=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 t=i("#captcha"),n=i("#btn-next"),o=i("#captcha-tip"),l=i("#phone-num").val(),r=i("#area-code").val().replace("+",""),d=e("js/passport/api"),c=e("js/plugin/tip"),p=i.trim,u=c.show,h=a?"reg":"back";d.bindClearEvt(),t.bind("input",function(){""!==p(t.val())?n.removeClass("disable"):n.addClass("disable")}),o.on("tap",function(){o.hasClass("disable")||i.ajax({type:"POST",url:"/passport/"+h+"/sendcode",data:{phoneNum:l,areaCode:r},success:function(e){200===e.code?(o.text("重发验证码 (60秒)").addClass("disable"),s()):u(e.message)}})}),n.on("tap",function(){n.hasClass("disable")||i.ajax({type:"POST",url:"/passport/"+h+"/verifycode",data:{phoneNum:l,areaCode:r,code:p(t.val()),token:i("#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 i=e("zepto"),t=i("#pwd"),n=i("#btn-sure"),o=e("js/passport/api"),l=e("js/plugin/tip"),r=i.trim,d=l.show;o.bindEyesEvt({status:"open"}),t.bind("input",function(){""===r(t.val())?n.addClass("disable"):n.removeClass("disable")}),n.on("tap",function(){var e=r(t.val());n.hasClass("disable")||(o.pwdValidate(e)===!1?d("密码6-20位,请重新输入"):i.ajax({type:"POST",url:"/passport/reg/setpassword",data:{password:e,phoneNum:i("#phone-num").val(),areaCode:i("#area-code").val(),token:i("#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 i(){u&&h?d.removeClass("disable"):d.addClass("disable")}function t(){c.show(),p.show()}function n(){c.hide(),p.hide()}var o=e("zepto"),l=o("#account"),r=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(),l.bind("input",function(){u=""!==v(l.val())?!0:!1,i()}),r.bind("input",function(){h=""===v(r.val())?!1:!0,i()}),d.on("tap",function(){var e=v(l.val()),a=v(r.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("tap",function(){t()}),c.on("tap",function(){n()}),o("#cancel-retrive").on("tap",function(e){e.preventDefault(),n()}),l.trigger("input"),r.trigger("input")}),define("js/passport/login/international",["zepto"],function(e,a,s){function i(){c&&p?d.removeClass("disable"):d.addClass("disable")}var t=e("zepto"),n=t("#phone-num"),o=t("#country-select"),l=t("#area-code"),r=t("#pwd"),d=t("#btn-login"),c=!1,p=!1,u=e("js/passport/api"),h=e("js/plugin/tip"),f=t.trim,g=h.show;u.selectCssHack(o),u.bindEyesEvt(),u.bindClearEvt(),n.bind("input",function(){c=""===f(n.val())?!1:!0,i()}),r.bind("input",function(){var e=f(r.val());p=""===e?!1:!0,i()}),o.change(function(){l.text(o.val())}),d.on("tap",function(){var e=f(n.val()),a=o.val(),s=f(r.val());d.hasClass("disable")||(u.phoneRegx[a].test(e)&&u.pwdValidate(s)?t.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("账号或密码有错误,请重新输入"))}),n.trigger("input"),r.trigger("input")}),define("js/passport/back/mobile",["zepto"],function(e,a,s){var i=e("zepto"),t=i("#phone-num"),n=i("#country-select"),o=i("#area-code"),l=i("#btn-next"),r=e("js/passport/api"),d=e("js/plugin/tip"),c=i.trim,p=d.show;r.selectCssHack(i("#country-select")),r.bindClearEvt(),t.bind("input",function(){""===c(t.val())?l.addClass("disable"):l.removeClass("disable")}),n.change(function(){o.text(n.val())}),l.on("tap",function(){var e=c(t.val()),a=n.val();l.hasClass("disable")||(r.phoneRegx[a].test(e)?i.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 i=e("zepto"),t=i("#email"),n=i("#btn-sure"),o=e("js/passport/api"),l=e("js/plugin/tip"),r=i.trim,d=l.show;o.bindClearEvt(),t.bind("input",function(){""===r(t.val())?n.addClass("disable"):n.removeClass("disable")}),n.on("tap",function(){var e=r(t.val());n.hasClass("disable")||(o.emailRegx.test(e)?i.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 i=e("zepto"),t=i("#resend"),n=e("js/plugin/tip"),o=n.show;t.on("tap",function(e){e.preventDefault(),i.ajax({url:t.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 i=e("zepto"),t=i("#pwd"),n=i("#btn-ok"),o=e("js/passport/api"),l=e("js/plugin/tip"),r=i.trim,d=l.show,c=i("#phone-num");o.bindEyesEvt(),t.bind("input",function(){""===r(t.val())?n.addClass("disable"):n.removeClass("disable")}),n.on("tap",function(){var e,a,s=r(t.val()),l=!0;n.hasClass("disable")||(e={password:s},0===c.length&&(l=!1),l?(i.extend(e,{phoneNum:c.val(),areaCode:i("#areaCode").val(),token:i("#token").val()}),a="/passport/back/passwordByMobile"):(i.extend(e,{code:i("#email-code").val()}),a="/passport/back/passwordByEmail"),o.pwdValidate(s)?i.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/product/entry",["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){function i(e){var a,s,i,t,l,d,p={};if(e){for(s in y)y.hasOwnProperty(s)&&(y[s].reload=!0);switch(C.children(".active").removeClass("active"),z.addClass("active"),e.type){case"gender":a={gender:e.id};break;case"brand":a={brand:e.id};break;case"sort":a={sort: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};break;case"limit":a={limit:e.id};break;case"channel":a={channel:e.id};break;case"p_d":a={p_d:e.id}}o.extend(v,a)}if(!n){if(z.hasClass("today")?(t="today",l=1):z.hasClass("week")?(t="week",l=2):z.hasClass("sale")&&(t="sale",l=3),i=y[t],d=i.page+1,i.reload)d=1;else if(i.end)return;o.extend(p,v,{dayLimit:l,page:d}),n=!0,c.showLoadingMask(),o.ajax({type:"GET",url:"/product/newsale/selectNewSale",data:p,success:function(e){var a,s='<p class="no-result">未找到相关搜索结果</p>';switch(t){case"today":a=u;break;case"week":a=h;break;case"sale":a=f}" "===e?(i.end=!0,i.reload&&a.html(s)):(i.reload?a.html(e):a.append(e),r(a.find(".lazy"))),i.reload=!1,i.page=d,n=!1,c.hideLoadingMask()}})}}var t,n,o=e("zepto"),l=e("swiper"),r=e("lazyload"),d=e("js/plugin/filter"),c=e("js/plugin/loading"),p=o("#goods-container"),u=o(p.children().get(0)),h=o(p.children().get(1)),f=o(p.children().get(2)),g=o(window).height(),v={gender:o("#gender").val(),brand:o("#brand").val(),sort:o("#sort").val(),color:o("#color").val(),size:o("#size").val(),price:o("#price").val(),discount:o("#discount").val(),limit:o("#limit").val(),channel:o("#channel").val(),p_d:o("#p_d").val()},m=new Date,w=m.getMonth()+1,b=m.getDate(),C=o("#list-nav"),y={today:{reload:!0,page:0,end:!1},week:{reload:!0,page:0,end:!1},sale:{reload:!0,page:0,end:!1}},z=C.find(".active");h.addClass("hide"),f.addClass("hide"),o("#today a").text(w+"月"+b+"号"),o(".swiper-container .swiper-slide").length>1&&(t=new l(".swiper-container",{lazyLoading:!0,lazyLoadingInPrevNext:!0,loop:!0,autoplay:3e3,autoplayDisableOnInteraction:!1,paginationClickable:!0,pagination:".swiper-pagination"})),r(o(".lazy")),d.registerCbFn(i),C.delegate("li","tap",function(){var e,a,s,t=o(this);if(t.hasClass("filter"))t.hasClass("active")?(d.hideFilter(),z.addClass("active"),t.removeClass("active")):(z=t.siblings(".active"),z.removeClass("active"),t.addClass("active"),d.showFilter());else{if(t.hasClass("today")?a="today":t.hasClass("week")?a="week":t.hasClass("sale")&&(a="sale"),e=y[a],!t.hasClass("active")){if(s=t.siblings(".active"),z=t,s.hasClass("filter"))d.hideFilter();else switch(p.children(".container:not(.hide)").addClass("hide"),a){case"today":u.removeClass("hide");break;case"week":h.removeClass("hide");break;case"sale":f.removeClass("hide")}s.removeClass("active"),t.addClass("active")}e.reload&&i()}}),o(window).scroll(function(){o(window).scrollTop()+g>o(document).height()-.25*p.height()&&void 0!==z&&i()}),i()}),define("js/plugin/filter",["zepto"],function(e,a,s){function i(){r.addClass("hide")}function t(){r.removeClass("hide")}function n(e){o=e}var o,l=e("zepto"),r=l(".filter-mask"),d=r.find(".classify"),c=r.find(".sub-classify");d.children(":first-child").addClass("active"),d.delegate(".classify-item","tap",function(e){var a=l(this);e.stopPropagation(),a.hasClass("active")||(a.siblings(".active").removeClass("active"),a.addClass("active"))}),r.tap(function(){i()}),c.delegate("li","tap",function(e){var a,s,t=l(this),n=t.data("id"),r=t.closest(".sub-classify"),d=r.siblings(".shower");e.stopPropagation(),t.hasClass("chosed")||(r.children(".chosed").removeClass("chosed"),t.addClass("chosed"),a=l.trim(t.html()),s=l.trim(d.html()),d.html(s.substring(0,s.indexOf("</span>")+7)+a.substring(0,a.indexOf("<i"))),0===t.index()?d.addClass("default"):d.removeClass("default"),o&&o({type:r.data("type"),id:n}),i())}),a.showFilter=t,a.hideFilter=i,a.registerCbFn=n}),define("js/product/newsale/discount",["zepto","swiper","lazyload","index"],function(e,a,s){function i(e){var a,s,i,t,l,d={};if(e){for(s in w)w.hasOwnProperty(s)&&(w[s].reload=!0);switch(m.children(".active").removeClass("active"),b.addClass("active"),e.type){case"gender":a={gender:e.id};break;case"brand":a={brand:e.id};break;case"sort":a={sort: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(!n){if(b.hasClass("new")?t="newest":b.hasClass("price")?t="price":b.hasClass("discount")&&(t="discount"),i=w[t],l=i.page+1,i.reload)l=1;else if(i.end)return;o.extend(d,v,{type:t,order:i.order,page:l}),n=!0,c.showLoadingMask(),o.ajax({type:"GET",url:"/product/newsale/selectNewSale",data:d,success:function(e){var a,s='<p class="no-result">未找到相关搜索结果</p>';switch(t){case"newest":a=u;break;case"price":a=h;break;case"discount":a=f}" "===e?(i.end=!0,i.reload&&a.html(s)):(i.reload?a.html(e):a.append(e),r(a.find(".lazy"))),i.reload=!1,i.page=l,n=!1,c.hideLoadingMask()}})}}var t,n,o=e("zepto"),l=e("swiper"),r=e("lazyload"),d=e("js/plugin/filter"),c=e("js/plugin/loading"),p=o("#goods-container"),u=o(p.children().get(0)),h=o(p.children().get(1)),f=o(p.children().get(2)),g=o(window).height(),v={gender:o("#gender").val(),brand:o("#brand").val(),sort:o("#sort").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}},b=m.find(".active");o(".swiper-container .swiper-slide").length>1&&(t=new l(".swiper-container",{lazyLoading:!0,lazyLoadingInPrevNext:!0,
loop:!0,autoplay:3e3,autoplayDisableOnInteraction:!1,paginationClickable:!0,pagination:".swiper-pagination"})),r(o(".lazy")),d.registerCbFn(i),m.delegate("li","tap",function(){var e,a,s,t=o(this);if(t.hasClass("filter"))t.hasClass("active")?(d.hideFilter(),b.addClass("active"),t.removeClass("active")):(b=t.siblings(".active"),b.removeClass("active"),t.addClass("active"),d.showFilter());else{if(t.hasClass("new")?a="newest":t.hasClass("price")?a="price":t.hasClass("discount")&&(a="discount"),e=w[a],t.hasClass("active")){if(t.hasClass("new"))return;(t.hasClass("price")||t.hasClass("discount"))&&(t.find(".icon > .iconfont").toggleClass("cur"),b=t,e.reload=!0,e.order=0===e.order?1:0)}else{if(s=t.siblings(".active"),b=t,s.hasClass("filter"))d.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"),t.addClass("active")}e.reload&&i()}}),o(window).scroll(function(){o(window).scrollTop()+g>o(document).height()-.25*p.height()&&void 0!==b&&i()}),i()}),define("js/product/list",["zepto","lazyload"],function(e,a,s){function i(e){var a,s,i,l,r,d={};if(!t){if(e){for(s in C)C.hasOwnProperty(s)&&(C[s].reload=!0);switch(b.children(".active").removeClass("active"),y.addClass("active"),e.type){case"gender":a={gender:e.id};break;case"brand":a={brand:e.id};break;case"sort":a={sort: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(w,a)}if(y.hasClass("new")?l="newest":y.hasClass("price")?l="price":y.hasClass("discount")&&(l="discount"),i=C[l],r=i.page+1,i.reload)r=1;else if(i.end)return;n.extend(d,w,{type:l,order:i.order,page:r}),t=!0,u.showLoadingMask(),n.ajax({type:"GET",url:"/index/search/search",data:d,success:function(e){var a,s='<p class="no-result">未找到相关搜索结果</p>';switch(l){case"newest":a=f;break;case"price":a=g;break;case"discount":a=v}" "===e?(i.end=!0,i.reload&&a.html(s)):(i.reload?a.html(e):a.append(e),o(a.find(".lazy"))),i.reload=!1,i.page=r,t=!1,u.hideLoadingMask()}})}}var t,n=e("zepto"),o=e("lazyload"),l=n("#brand-header"),r=n("#intro-box"),d=e("js/plugin/filter"),c=e("js/index/write-search"),p=e("js/plugin/tip"),u=e("js/plugin/loading"),h=n("#goods-container"),f=h.children(".new-goods"),g=h.children(".price-goods"),v=h.children(".discount-goods"),m=n(window).height(),w={gender:n("#gender").val(),brand:n("#brand").val(),sort:n("#sort").val(),color:n("#color").val(),size:n("#size").val(),price:n("#price").val(),discount:n("#discount").val(),query:n("#query").val()},b=n("#list-nav"),C={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}},y=b.find(".active");o(n(".lazy")),d.registerCbFn(i),c.bindWirteLocal(n("#search-form")),b.delegate("li","tap",function(){var e,a,s,t=n(this);if(t.hasClass("filter"))t.hasClass("active")?(d.hideFilter(),y.addClass("active"),t.removeClass("active")):(y=t.siblings(".active"),y.removeClass("active"),t.addClass("active"),d.showFilter());else{if(t.hasClass("new")?a="newest":t.hasClass("price")?a="price":t.hasClass("discount")&&(a="discount"),e=C[a],t.hasClass("active")){if(t.hasClass("new"))return;(t.hasClass("price")||t.hasClass("discount"))&&(t.find(".icon > .iconfont").toggleClass("cur"),y=t,e.reload=!0,e.order=0===e.order?1:0)}else{if(s=t.siblings(".active"),y=t,s.hasClass("filter"))d.hideFilter();else switch(h.children(".container:not(.hide)").addClass("hide"),a){case"newest":f.removeClass("hide");break;case"price":g.removeClass("hide");break;case"discount":v.removeClass("hide")}s.removeClass("active"),t.addClass("active")}e.reload&&i()}}),n(window).scroll(function(){n(window).scrollTop()+m>n(document).height()-.25*h.height()&&i()}),l.children(".btn-intro").bind("tap",function(){r.removeClass("hide")}),n(".close-intro, .brand-intro-box").tap(function(){r.addClass("hide")}),n("#brand-intro").tap(function(e){e.stopPropagation()}),l.children(".btn-col").bind("tap",function(){var e,a=n(this),s=l.data("id");e=a.hasClass("coled")?"cancel":"ok",n.ajax({type:"POST",url:"/product/opt/favoriteBrand",data:{id:s,opt:e},success:function(e){200===e.code?a.toggleClass("coled"):400===e.code&&p.show("未登录")},error:function(){p.show("网络断开连接了~")}})}),i()}),define("js/product/detail/detail",["zepto","swiper","lazyload","index"],function(e,a,s){var i,t=e("zepto"),n=e("swiper"),o=e("lazyload");o(t("img.lazy")),i=new n(".banner-swiper",{loop:!0,pagination:".banner-top .pagination-inner",slideElement:"div",nextButton:".swiper-button-next",prevButton:".swiper-button-prev"})});