channel.home.js 9.71 KB
webpackJsonp([8],{0:function(e,n,o){o(22)},2:function(e,n,o){function i(e,n){var o,i;"undefined"!=typeof e&&(o=e.toString(),i=n&&n>0?n:2e3,t.text(o).show(),a=setTimeout(function(){"block"===t.css("display")&&t.hide()},i))}var t,a,s=o(1);!function(){var e='<div id="yoho-tip" class="yoho-tip"></div>';s(".yoho-page").append(e),t=s("#yoho-tip"),t.on("touchend",function(){t.hide(),clearTimeout(a)})}(),n.show=i},3:function(e,n,o){function i(e){var n,o,i=document.cookie;return document.cookie&&""!==document.cookie&&(o=i.indexOf(e+"="),o>-1&&(o+=e.length+1,n=decodeURIComponent(m.trim(i.substring(o,i.indexOf(";",o)))))),n}function t(e,n,o){var i,t,a,s,r="";"undefined"!=typeof n&&(o=o||{},null===n&&(n="",o.expires=-1),o.expires&&("number"==typeof o.expires||o.expires.toUTCString)&&("number"==typeof o.expires?(s=new Date,s.setTime(s.getTime()+24*o.expires*60*60*1e3)):s=o.expires,r="; expires="+s.toUTCString()),i=o.path?"; path="+o.path:"",t=o.domain?"; domain="+o.domain:"",a=o.secure?"; secure":"",document.cookie=[e,"=",encodeURIComponent(n),r,i,t,a].join(""))}function a(){var e=!!navigator.cookieEnabled;return"undefined"!=typeof navigator.cookieEnabled||e||(document.cookie="testcookie",e=-1!==document.cookie.indexOf("testcookie")),e}function s(){var e,n=i("_UID");return"undefined"==typeof n?0:(e=n.split("::"),"undefined"==typeof e||e.length<4?0:e)}function r(){var e=s();return 0===e?0:e[1]}function d(){var e=i("_g");return"undefined"==typeof e?"":JSON.parse(e).k}function l(){var e;0!==f.length&&(e=Math.min(m(window).height(),window.screen.availHeight),m("body").height()<=e-parseInt(f.css("height"),0)?f.addClass("bottom"):f.removeClass("bottom"))}function c(e){var n=m(e).outerHeight();e&&f.css("margin-bottom",n+"px")}function h(){var e,n,o=[],i=window.location.search.slice(1).split("&");for(n=0;n<i.length;n++)e=i[n].split("="),o.push(e[0]),o[e[0]]=e[1];return o}function u(e){return e.replace(/(\d{3})\d{4}(\d{4})/,"$1****$2")}var m=o(1),p=o(4),f=m("#yoho-footer"),g=m(".yoho-page"),w=m(".yoho-header");!function(){var e,n=f.children(".op-row"),o=m(".back-to-top"),i=s();l(),0===i?n.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>'):n.prepend('<span>Hi,</span><a class="user-name" href="http://m.yohobuy.com/home?tmp='+Math.random()+'">'+i[0]+'</a><a href="http://m.yohobuy.com/passport/signout/index">退出</a>'),o.length>0&&(e=new p(o[0]),e.on("tap",function(e){return m(window).scrollTop(0),e.srcEvent.preventDefault(),!1})),f.removeClass("hide")}(),function(e,n,o,i,t){var a=n.createElement(o),s=n.getElementsByTagName(o)[0];e.YohoAcquisitionObject=t,e[t]=function(){e[t].p=arguments},a.async=1,a.src=i,s.parentNode.insertBefore(a,s)}(window,document,"script","http://cdn.yoho.cn/yas-jssdk/1.0.14/yas.js","_yas"),function(){var e=r();e=0===e?"":e,window._ozuid=e,window._yas&&window._yas(1*new Date,"1.0.14","yohobuy_m",e,"","")}(),w.on("touchstart","a",function(){w.find("a").removeClass("highlight"),m(this).addClass("highlight")}).on("touchend touchcancel","a",function(){m(this).removeClass("highlight")}),g.on("touchstart",".tap-hightlight",function(){m(this).siblings(".tap-hightlight").removeClass("highlight"),m(this).addClass("highlight")}).on("touchend touchcancel",".tap-hightlight",function(){m(this).removeClass("highlight")}),m(".nav-home").on("touchstart",function(){m(".homebuttom").toggleClass("hide")}),function(){var e,n,o=0,i="webkit moz ms o".split(" "),t=window.requestAnimationFrame,a=window.cancelAnimationFrame;for(n=0;n<i.length&&(!t||!a);n++)e=i[n],t=t||window[e+"RequestAnimationFrame"],a=a||window[e+"CancelAnimationFrame"]||window[e+"CancelRequestAnimationFrame"];t&&a||(t=function(e){var n=(new Date).getTime(),i=Math.max(0,16-(n-o)),t=window.setTimeout(function(){e(n+i)},i);return o=n+i,t},a=function(e){window.clearTimeout(e)}),window.requestAnimationFrame=t,window.cancelAnimationFrame=a}(),m.extend({queryString:h}),11===f.find(".user-name").text().length&&f.find(".user-name").html(u(f.find(".user-name").text())),window.cookie=i,window.setCookie=t,window.isCookiesEnabled=a,window.getUser=s,window.getUid=r,window.getShoppingKey=d,window.rePosFooter=l,window.reMarginFooter=c,window.queryString=h()},5:function(e,n,o){function i(e){var n='<div class="loading-mask hide"><div class="loading"><div></div><div></div><div></div></div></div>';l=!0,e||(e=d),e.append(n),s=e.children(".loading-mask"),r("body").on("touchstart touchmove touchend",".loading-mask",function(){return!1})}function t(){l||(i(),l=!0),s.removeClass("hide")}function a(){s.addClass("hide")}var s,r=o(1),d=r(".yoho-page"),l=!1;n.init=i,n.showLoadingMask=t,n.hideLoadingMask=a,n.show=t,n.hide=a},22:function(e,n,o){function i(){u.hasClass("menu-open")&&(u.removeClass("menu-open"),m.hide(),r(".sub-nav").removeClass("show"),p.removeClass("on"))}function t(e){e.find("li").on("touchstart",function(){e.find(".highlight").removeClass("highlight"),r(this).addClass("highlight")}).on("touchend touchcancel",function(){r(this).removeClass("highlight")})}function a(){w+=10,g.css({transform:"rotateX("+w+"deg)","-webkit-transform":"rotateX("+w+"deg)","-moz-transform":"rotateX("+w+"deg)"}),w/90%2===1&&(v?(g.addClass("animate"),v=!1):(g.removeClass("animate"),v=!0)),w/90%2===0&&w%360!==0?window.setTimeout(a,3e3):w%360===0?window.setTimeout(a,6e4):window.requestAnimationFrame(a)}var s,r=o(1),d=o(12),l=o(6),c=o(17),h=o(27),u=r(".mobile-wrap"),m=r(".overlay"),p=r(".side-nav"),f=r(".sub-nav"),g=r(".home-header .logo"),w=0,v=!0;o(3),c.attach(document.body),l(r("img.lazy")),h(".notice",1e3*r(".notice").data("time")),r(".nav-btn").on("touchstart",function(){return p.css("pointer-events","none"),u.addClass("menu-open"),m.show().css("opacity",.3),p.addClass("on"),setTimeout(function(){p.css("pointer-events","auto")},400),!1}),m.on("touchstart",function(){return i(),!1}),p.on("touchmove scroll",function(){return!1}),p.on("touchend","li",function(e){return r(this).find(".sub-nav").size()>0&&(r(".sub-nav").removeClass("show"),r(this).find(".sub-nav").addClass("show"),r(this).find(".highlight").removeClass("highlight")),e.target.pathname===location.pathname?(i(),!1):void 0}),f.each(function(){r(this).find("li").eq(0).on("click",function(){return r(".sub-nav").removeClass("show"),!1})}).on("touchstart",function(e){e.currentTarget!==e.target&&f.find("li").removeClass("current")}),t(p),t(f),r(".banner-swiper").find("li").size()>1&&new d(".banner-swiper",{lazyLoading:!0,lazyLoadingInPrevNext:!0,loop:!0,autoplay:3e3,autoplayDisableOnInteraction:!1,paginationClickable:!0,slideElement:"li",pagination:".banner-top .pagination-inner"}),new d(".brands-swiper",{grabCursor:!0,slidesPerView:"auto",wrapperClass:"brands-list",slideElement:"li"}),new d(".recommend-swiper",{grabCursor:!0,slidesPerView:"auto",wrapperClass:"recommend-list",slideElement:"li"}),r(".trend-topic-swiper").find("li").size()>1&&new d(".trend-topic-swiper",{loop:!0,autoplay:3e3,autoplayDisableOnInteraction:!1,paginationClickable:!0,slideElement:"li",pagination:".trend-topic-content .pagination-inner"}),r(".fresh-list-swiper").find("li").size()>1&&new d(".fresh-list-swiper",{lazyLoading:!0,lazyLoadingInPrevNext:!0,grabCursor:!0,slidesPerView:"auto",slideElement:"li",watchSlidesVisibility:!0}),r(".category-swiper").each(function(e){s="category-swiper"+e,r(this).addClass(s),r("."+s).find(".swiper-slide").size()>1&&new d("."+s,{loop:!0,autoplay:3e3,autoplayDisableOnInteraction:!1,paginationClickable:!0,slideElement:"li",pagination:"."+s+" .pagination-inner"})}),setTimeout(a,3e3),r(".home-header .iconfont").on("touchstart",function(){r(this).addClass("highlight")}).on("touchend touchcancel",function(){r(this).removeClass("highlight")}),window.reMarginFooter(".footer-tab"),n.set=function(e){window.setCookie("_Channel",e,{expires:365,domain:".m.yohobuy.com"})},o(23)()},23:function(e,n,o){e.exports=function(e){function n(){w||(w=!0,m.showLoadingMask(),c.ajax({type:"GET",url:s,data:{page:v+1},success:function(n){return" "===n?(w=!1,m.hideLoadingMask(),void(y&&!e&&(s="/channel/bottomBanner",c.ajax({type:"GET",url:s,data:{gender:y},success:function(e){e&&e.img&&(c("#load-more-img").show(),c("#load-more-img a").attr("href",e.url),c("#load-more-img a > img").attr("src",e.img))}})))):(n.length>1&&(l?null:l=c("#yoho-footer"),l.hasClass("bottom")?l.removeClass("bottom"):null),a=g.find(".good-info").length,g.append(n),p(0===a?g.find(".good-info").find("img.lazy"):g.find(".good-info:gt("+(a-1)+")").find("img.lazy")),w=!1,m.hideLoadingMask(),void v++)},error:function(){u.show("网络断开连接了~"),w=!1,m.hideLoadingMask()}}))}function i(){c(window).scrollTop()+f>=c(document).height()-200&&n()}var t,a,s,r,d,l,c=o(1),h=o(4),u=o(2),m=o(5),p=o(6),f=c(window).height(),g=c("#goods-list"),w=!1,v=0,y=null,b=!("kids"!==e&&!c(".mobile-wrap").hasClass("kids-wrap")),C=!("lifestyle"!==e&&!c(".mobile-wrap").hasClass("lifestyle-wrap")),k=c("#maybe-like-nav");b?s="/product/recom/maylikekids":C?s="lifestyle"===e?"/product/recom/maylike?gender=1,3":"/product/recom/maylikelife":(y="boys"===e||c(".mobile-wrap").hasClass("boys-wrap")?"boys":"girls",s="/product/recom/maylike?gender="+y),r=k.children(".focus"),C&&(t=k[0]?new h(k[0]):null,t&&t.on("tap",function(e){var n,o=c(e.target).closest("li"),i=c(".goods-list");e.preventDefault(),o.hasClass("focus")||(d=o.index(),o.addClass("focus"),r.removeClass("focus"),i.not(".hide").addClass("hide"),n=i.eq(d),n.removeClass("hide"),r=o,c(document).trigger("scroll"),e.srcEvent.stopPropagation())})),m.init(c(".maybe-like")),c(".maybe-like p").on("touchstart",function(){n()}),e&&n(),c(window).scroll(function(){window.requestAnimationFrame(i)})}},27:function(e,n,o){function i(e,n){var o=t(e),i=o.find(".notice-item"),a=i.length,s=1;e=e||".notice",n=n||3e3,a>1&&setInterval(function(){s>=a&&(s=0),i.fadeOut(),o.find(".item-"+s).fadeIn(),s++},n)}var t=o(1);e.exports=i}});