channel.home.js
9.92 KB
webpackJsonp([10],{0: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(11),l=o(6),c=o(18),h=o(40),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){if(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)return i(),!1}),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"),window.setCookie("_Channel",u.data("channel"),{expires:-1,domain:".m.yohobuy.com"}),window.setCookie("_Channel",u.data("channel"),{expires:30,domain:".yohobuy.com"}),o(25)()},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=document.cookie.indexOf("testcookie")!==-1),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",("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,"","")}(),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},25:function(e,n,o){e.exports=function(e){function n(){y||(y=!0,f.showLoadingMask(),h.ajax({type:"GET",url:s,data:{page:b+1},success:function(n){if(" "!==n)y=!1,n.length>1&&(l?null:l=h("#yoho-footer"),l.hasClass("bottom")?l.removeClass("bottom"):null),a=v.find(".good-info").length,v.append(n),g(0===a?v.find(".good-info").find("img.lazy"):v.find(".good-info:gt("+(a-1)+")").find("img.lazy")),f.hideLoadingMask(),b++,h(".good-detail-text .name").each(function(){var e=h(this),n=e.find("a");n[0].mlellipsis(2)});else if(f.hideLoadingMask(),C&&!e){if(c)return;s="/channel/bottomBanner",h.ajax({type:"GET",url:s,data:{gender:C},success:function(e){e=e.data,c=!0,e&&e.img&&(h("#load-more-img").show(),h("#load-more-img a").attr("href",e.url),h("#load-more-img a > img").attr("src",e.img))}})}},error:function(){p.show("网络断开连接了~"),y=!1,f.hideLoadingMask()}}))}function i(){h(window).scrollTop()+w>=h(document).height()-200&&n()}var t,a,s,r,d,l,c,h=o(1),u=o(4),m=o(8),p=o(2),f=o(5),g=o(6),w=h(window).height(),v=h("#goods-list"),y=!1,b=0,C=null,k=!("kids"!==e&&!h(".mobile-wrap").hasClass("kids-wrap")),x=!("lifestyle"!==e&&!h(".mobile-wrap").hasClass("lifestyle-wrap")),T=h("#maybe-like-nav");m.init(),k?s="/product/recom/maylikekids":x?s="lifestyle"===e?"/product/recom/maylike?gender=1,3":"/product/recom/maylikelife":(C="boys"===e||h(".mobile-wrap").hasClass("boys-wrap")?"1,3":"2,3",s="/product/recom/maylike?gender="+C),r=T.children(".focus"),x&&(t=T[0]?new u(T[0]):null,t&&t.on("tap",function(e){var n,o=h(e.target).closest("li"),i=h(".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,h(document).trigger("scroll"),e.srcEvent.stopPropagation())})),f.init(h(".maybe-like")),h(".maybe-like p").on("touchstart",function(){n()}),e&&n(),h(window).scroll(function(){window.requestAnimationFrame(i)})}},40: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}});