product.break-code.js 11.6 KB
webpackJsonp([7],{0:function(e,t,i){function n(e){var t=new RegExp("(^|&)"+e+"=([^&]*)(&|$)"),i=window.location.search.substr(1).match(t);return null!==i?i[2]:null}function a(e){var t;return t=e.hasClass("coat")?"coat":e.hasClass("trouser")?"trouser":e.hasClass("shoes")?"shoes":"other"}function o(e){var t,i,n,o,s,r={},d={};if(!c){if("object"===l.type(e)&&(e=[e]),e){for(t in q)q.hasOwnProperty(t)&&(q[t].reload=!0);for(s=0;s<e.length;s++){switch(e[s].type){case"gender":d={gender:e[s].id};break;case"brand":d={brand:e[s].id};break;case"sort":d={sort:e[s].id};break;case"color":d={color:e[s].id};break;case"size":d={size:e[s].id};break;case"price":d={price:e[s].id};break;case"discount":d={discount:e[s].id};break;case"p_d":d={p_d:e[s].id};break;case"ageLevel":d={age_level:e[s].id};break;case"breakSort":d={breakSort:e[s].id};break;case"breakSize":d={breakSize:e[s].id}}l.extend(S,d)}}if(n=a(E),i=q[n],o=i.page+1,i.reload)o=1;else if(i.end)return;l.extend(r,S,{type:"stock",order:0,page:o}),c=!0,m.showLoadingMask(),l.ajax({type:"GET",url:"/product/sale/search",data:r,success:function(e){var t,a;switch(n){case"coat":t=b;break;case"trouser":t=y;break;case"shoes":t=C;break;default:t=k}t.hasClass("hide")&&(t.siblings().addClass("hide"),t.removeClass("hide")),""===e?(i.end=!0,i.reload&&t.html(F)):i.reload?(t.html(e),f(t.find(".lazy"))):(a=t.find(".good-info").length,t.append(e),f(t.find(".good-info:gt("+(a-1)+") .lazy"))),i.reload=!1,i.page=o,c=!1,m.hideLoadingMask(),window.rePosFooter(),l(".good-detail-text .name").each(function(){var e=l(this),t=e.find("a");t[0].mlellipsis(2)})},error:function(){p.show("网络断开连接了~"),c=!1,m.hideLoadingMask()}})}}function s(){l.ajax({type:"GET",url:"/product/sale/filter",data:l.extend(S,{saleType:"1"}),success:function(e){d&&d.remove(),v.append(e),d=l(".filter-mask"),g.initFilter({fCbFn:o,hCbFn:function(){E.addClass("active"),E.siblings(".filter").removeClass("active"),l("#size-swiper-"+E.index()).show()},missStatus:!0})}})}function r(){l(window).scrollTop()+x>l(document).height()-.25*v.height()-50&&"undefined"!=typeof E&&o()}var d,c,l=i(1),h=i(11),u=i(8),f=i(6),p=i(2),g=i(10),m=i(5),v=l("#goods-container"),w=v.children(),b=l(w.get(0)),y=l(w.get(1)),C=l(w.get(2)),k=l(w.get(3)),x=l(window).height(),F='<p class="no-result">未找到相关搜索结果</p>',S=i(9),z={},T=l("#list-nav"),_=l(".swiper-size"),q={coat:{reload:!0,page:0,end:!1},trouser:{reload:!0,page:0,end:!1},shoes:{reload:!0,page:0,end:!1},other:{reload:!0,page:0,end:!1}},E=T.find(".active"),A=[],D=["coat","trouser","shoes","other"];i(26),i(3),u.init(),f(l("img.lazy")),S=l.extend({yh_channel:n("channel")||"boys",saleType:1},S),z=l.extend({},S),l(".banner-swiper .swiper-slide").length>1&&new h(".swiper-container",{observer:!0,observeParents:!0,lazyLoading:!0,lazyLoadingInPrevNext:!0,loop:!0,autoplay:3e3,autoplayDisableOnInteraction:!0,paginationClickable:!0,pagination:".banner-top .pagination-inner"}),l.each(_,function(e){A[e]=new h("#size-swiper-"+e,{slidesPerView:"auto"})}),l.each(T.find("li"),function(e,t){l(t).addClass(D[e])}),s(),f(l(".lazy")),T.bind("contextmenu",function(){return!1}),T.on("touchend touchcancel",function(e){var t,i,n,r,d,c=l(e.target).closest("li");if(e.preventDefault(),c.hasClass("filter"))c.hasClass("active")?(g.hideFilter(),E.addClass("active"),c.removeClass("active"),_.eq(E.index()).show()):(E=c.siblings(".active"),_.hide(),E.removeClass("active"),c.addClass("active"),g.showFilter());else{if(r=a(c),t=q[r],!c.hasClass("active")){if(d=c.siblings(".active"),c.attr("class")!==E.attr("class")&&(g.resetFilter(),l(".classify .shower").removeClass("default"),S.breakSort=c.data("id"),S.breakSize=c.data("allsub"),s(),S=l.extend({},z)),E=c,d.hasClass("filter"))g.hideFilter();else switch(v.children(".container:not(.hide)").addClass("hide"),r){case"coat":b.removeClass("hide");break;case"trouser":y.removeClass("hide");break;case"shoes":C.removeClass("hide");break;case"other":k.removeClass("hide")}d.removeClass("active"),c.addClass("active"),i=c.data("id"),n=c.data("allsub"),_.hide(),l("#size-swiper-"+c.index()).show(),A[c.index()].onResize()}t.reload&&o([{type:"breakSort",id:i},{type:"breakSize",id:n}])}e.stopPropagation()}),_.on("click",function(e){var t,i,n,s,r,d=l(e.target).closest("li"),c=d.parents(".size-area").index(),h=T.find("li").eq(c);e.preventDefault(),"undefined"!=typeof d&&0!==d.length&&(s=a(h),t=q[s],d.hasClass("active")||(t.reload=!0,r=d.siblings(".active"),E=h,r.removeClass("active"),d.addClass("active"),i=h.data("id"),n=d.data("id"),t.reload&&o([{type:"breakSort",id:i},{type:"breakSize",id:n}]),e.stopPropagation()))}),l(window).scroll(function(){window.requestAnimationFrame(r)}),l(function(){var e,t=window.queryString.type;e=t&&"1"!==t?"3"===t?".trouser":".shoes":".coat",l("#list-nav").find(e).addClass("active").siblings().removeClass("active"),o([{type:"breakSort",id:l(e).data("id")},{type:"breakSize",id:l(e).data("allsub")}])}),T.on("touchstart","li",function(){l(this).addClass("bytouch")}).on("touchend touchcancel",function(){T.find("li").removeClass("bytouch")})},2:function(e,t,i){function n(e,t){var i,n;"undefined"!=typeof e&&(i=e.toString(),n=t&&t>0?t:2e3,a.text(i).show(),o=setTimeout(function(){"block"===a.css("display")&&a.hide()},n))}var a,o,s=i(1);!function(){var e='<div id="yoho-tip" class="yoho-tip"></div>';s(".yoho-page").append(e),a=s("#yoho-tip"),a.on("touchend",function(){a.hide(),clearTimeout(o)})}(),t.show=n},3:function(e,t,i){function n(e){var t,i,n=document.cookie;return document.cookie&&""!==document.cookie&&(i=n.indexOf(e+"="),i>-1&&(i+=e.length+1,t=decodeURIComponent(f.trim(n.substring(i,n.indexOf(";",i)))))),t}function a(e,t,i){var n,a,o,s,r="";"undefined"!=typeof t&&(i=i||{},null===t&&(t="",i.expires=-1),i.expires&&("number"==typeof i.expires||i.expires.toUTCString)&&("number"==typeof i.expires?(s=new Date,s.setTime(s.getTime()+24*i.expires*60*60*1e3)):s=i.expires,r="; expires="+s.toUTCString()),n=i.path?"; path="+i.path:"",a=i.domain?"; domain="+i.domain:"",o=i.secure?"; secure":"",document.cookie=[e,"=",encodeURIComponent(t),r,n,a,o].join(""))}function o(){var e=!!navigator.cookieEnabled;return"undefined"!=typeof navigator.cookieEnabled||e||(document.cookie="testcookie",e=document.cookie.indexOf("testcookie")!==-1),e}function s(){var e,t=n("_UID");return"undefined"==typeof t?0:(e=t.split("::"),"undefined"==typeof e||e.length<4?0:e)}function r(){var e=s();return 0===e?0:e[1]}function d(){var e=n("_g");return"undefined"==typeof e?"":JSON.parse(e).k}function c(){var e;0!==g.length&&(e=Math.min(f(window).height(),window.screen.availHeight),f("body").height()<=e-parseInt(g.css("height"),0)?g.addClass("bottom"):g.removeClass("bottom"))}function l(e){var t=f(e).outerHeight();e&&g.css("margin-bottom",t+"px")}function h(){var e,t,i=[],n=window.location.search.slice(1).split("&");for(t=0;t<n.length;t++)e=n[t].split("="),i.push(e[0]),i[e[0]]=e[1];return i}function u(e){return e.replace(/(\d{3})\d{4}(\d{4})/,"$1****$2")}var f=i(1),p=i(4),g=f("#yoho-footer"),m=f(".yoho-page"),v=f(".yoho-header");!function(){var e,t=g.children(".op-row"),i=f(".back-to-top"),n=s();c(),0===n?t.prepend('<a href="http://m.yohobuy.com/signin.html?refer='+location.href+'">登录</a><span class="sep-line">|</span><a href="http://m.yohobuy.com/reg.html">注册</a>'):t.prepend('<span>Hi,</span><a class="user-name" href="http://m.yohobuy.com/home?tmp='+Math.random()+'">'+n[0]+'</a><a href="http://m.yohobuy.com/passport/signout/index">退出</a>'),i.length>0&&(e=new p(i[0]),e.on("tap",function(e){return f(window).scrollTop(0),e.srcEvent.preventDefault(),!1})),g.removeClass("hide")}(),function(e,t,i,n,a){var o=t.createElement(i),s=t.getElementsByTagName(i)[0];e.YohoAcquisitionObject=a,e[a]=function(){e[a].p=arguments},o.async=1,o.src=n,s.parentNode.insertBefore(o,s)}(window,document,"script",("https:"===document.location.protocol?"https":"http")+"://cdn.yoho.cn/yas-jssdk/1.0.17/yas.js","_yas"),function(){var e=r();e=0===e?"":e,window._ozuid=e,window._yas&&window._yas(1*new Date,"1.0.17","yohobuy_m",e,"","")}(),v.on("touchstart","a",function(){v.find("a").removeClass("highlight"),f(this).addClass("highlight")}).on("touchend touchcancel","a",function(){f(this).removeClass("highlight")}),m.on("touchstart",".tap-hightlight",function(){f(this).siblings(".tap-hightlight").removeClass("highlight"),f(this).addClass("highlight")}).on("touchend touchcancel",".tap-hightlight",function(){f(this).removeClass("highlight")}),f(".nav-home").on("touchstart",function(){f(".homebuttom").toggleClass("hide")}),function(){var e,t,i=0,n="webkit moz ms o".split(" "),a=window.requestAnimationFrame,o=window.cancelAnimationFrame;for(t=0;t<n.length&&(!a||!o);t++)e=n[t],a=a||window[e+"RequestAnimationFrame"],o=o||window[e+"CancelAnimationFrame"]||window[e+"CancelRequestAnimationFrame"];a&&o||(a=function(e){var t=(new Date).getTime(),n=Math.max(0,16-(t-i)),a=window.setTimeout(function(){e(t+n)},n);return i=t+n,a},o=function(e){window.clearTimeout(e)}),window.requestAnimationFrame=a,window.cancelAnimationFrame=o}(),f.extend({queryString:h}),11===g.find(".user-name").text().length&&g.find(".user-name").html(u(g.find(".user-name").text())),window.cookie=n,window.setCookie=a,window.isCookiesEnabled=o,window.getUser=s,window.getUid=r,window.getShoppingKey=d,window.rePosFooter=c,window.reMarginFooter=l,window.queryString=h()},5:function(e,t,i){function n(e){var t='<div class="loading-mask hide"><div class="loading"><div></div><div></div><div></div></div></div>';c=!0,e||(e=d),e.append(t),s=e.children(".loading-mask"),r("body").on("touchstart touchmove touchend",".loading-mask",function(){return!1})}function a(){c||(n(),c=!0),s.removeClass("hide")}function o(){s.addClass("hide")}var s,r=i(1),d=r(".yoho-page"),c=!1;t.init=n,t.showLoadingMask=a,t.hideLoadingMask=o,t.show=a,t.hide=o},9:function(e,t,i){var n=i(1),a={};n(".query-param").each(function(){var e=n(this);a[e.data("attr")]=e.val()}),e.exports=a},10:function(e,t,i){function n(){u.addClass("hide")}function a(){u.removeClass("hide")}function o(){var e=g(".filter-body .classify");e.on("touchstart",".shower",function(){e.removeClass("highlight"),g(this).addClass("highlight")}).on("touchend touchcancel",".shower",function(){g(this).removeClass("highlight")})}function s(){var e=g(".filter-body .sub-item");e.on("touchstart",function(){e.removeClass("highlight"),g(this).addClass("highlight")}).on("touchend touchcancel",function(){g(this).removeClass("highlight")})}function r(e){e.hasClass("active")||(e.siblings(".active").removeClass("active"),e.addClass("active"))}function d(e){var t,i,n=e.closest(".sub-classify"),a=n.siblings(".shower");return e.hasClass("chosed")?n:(n.children(".chosed").removeClass("chosed"),e.addClass("chosed"),t=g.trim(e.html()),i=g.trim(a.html()),a.html(i.substring(0,i.indexOf("</span>")+7)+t.substring(0,t.indexOf("<i"))),0===e.index()?a.addClass("default"):a.removeClass("default"),n)}function c(e){var t,i=e.data("id");t=d(e),f&&f({type:t.data("type"),id:i}),p&&p(),n()}function l(e){var t;f=e.fCbFn,p=e.hCbFn,window.missStatus=e.missStatus,o(),s(),u=g(".filter-mask"),u[0]&&(t=new m(u[0]),t.on("tap",function(e){var t,i=g(e.target);e.preventDefault(),i.closest(".filter-body").length>0?(t=i.closest(".sub-item"),t.length>0?(t=i.closest("li"),c(t)):(t=i.closest(".classify-item"),e.srcEvent.stopPropagation(),r(t))):(n(),p&&p())}))}function h(){"undefined"!=typeof u&&(g(".sub-classify").each(function(){d(g(this).children(":first-child"))}),r(g(".classify > :first-child")))}var u,f,p,g=i(1),m=i(4);t.initFilter=l,t.showFilter=a,t.hideFilter=n,t.resetFilter=h},26:function(e,t,i){var n=i(1),a=n("#suspend-cart");n.ajax({type:"GET",url:"/cart/index/count",success:function(e){var t;200===e.code&&(t=e.data.cart_goods_count,t>99&&(t="99+"),0===t&&n(".cart-count").remove(),a.find(".cart-count").html(t).removeClass("hide"))}})}});