product.outlet-activity.js 4.61 KB
webpackJsonp([19],{0:function(t,n,e){(function(t){var n=e(16),i=e(15),a=t(".cd-lite");n({el:"#index_nav"})["goto"](t("#index_nav").find(".active").index()),new i.Countdown({el:a})}).call(n,e(1))},2:function(t,n,e){function i(t,n){var e,i;"undefined"!=typeof t&&(e=t.toString(),i=n&&n>0?n:2e3,a.text(e).show(),o=setTimeout(function(){"block"===a.css("display")&&a.hide()},i))}var a,o,l=e(1);!function(){var t='<div id="yoho-tip" class="yoho-tip"></div>';l(".yoho-page").append(t),a=l("#yoho-tip"),a.on("touchend",function(){a.hide(),clearTimeout(o)})}(),n.show=i},15:function(t,n,e){"use strict";function i(t){var n;return this instanceof i?(t.el=a(t.el),void(t.el&&(n=t.el.attr("data-config"),n&&(n=JSON.parse(n.replace(/'/g,'"')),t=a.extend(!0,{},r,n,t)),this.config=t,this._init()))):new i(t)}var a=e(1),o=e(2),l="afterPaint",r={el:{},stopPoint:0,leftTime:0,template:"",varRegular:/\$\{([\-\w]+)\}/g,clock:["d",100,2,"h",24,2,"m",60,2,"s",60,2,"u",10,1],effect:"normal"},f={normal:{paint:function(){var t,n=this;a.each(n.hands,function(e,i){i.lastValue!==i.value&&(t="",a.each(n._toDigitals(i.value,i.bits),function(e,i){t+=n._html(i,"","digital")}),i.node.html(t))})}}},c=function(){function t(){for(var n,a,o,l,r=+new Date-t.nextTime,f=1+Math.floor(r/100);i.length;)i.shift()();for(r=100-r%100,t.nextTime+=100*f,o=0,l=e.length;l>o;o+=2)n=e[o+1],0===n?e[o](f):(n+=2*f-1,a=Math.floor(n/20),a>0&&e[o](a),e[o+1]=n%20+1);setTimeout(t,r)}function n(t,n){var e,i;for(e=0,i=n.length;i>e;++e)if(n[e]===t)return e;return-1}var e=[],i=[];return t.nextTime=+new Date,t(),{add:function(t,n){i.push(function(){e.push(t),e.push(1e3===n?1:0)})},remove:function(t){var a;i.push(function(){a=n(t,e),-1!==a&&e.splice(n(t,e),2)})}}}();a.extend(i.prototype,{_init:function(){var t,n,e=this,i=e.config.el,o=[],l=i.html(),r=e.config.varRegular;e.hands=o,e.frequency=1e3,e._notify=[],r.lastIndex=0,i.html(l.replace(r,function(t,n){var i="";return"u"!==n&&"s-ext"!==n||(e.frequency=100),"s-ext"===n?(o.push({type:"s"}),o.push({type:"u"}),i=e._html("","s","handlet")+e._html(".","","digital")+e._html("","u","handlet")):o.push({type:n}),e._html(i,n,"hand")})),t=e.config.clock,a.each(o,function(n,e){var a,o=e.type,l=100;for(e.node=i.find(".hand-"+o),a=t.length-3;a>-1&&o!==t[a];a-=3)l*=t[a+1];e.base=l,e.radix=t[a+1],e.bits=t[a+2]}),e._getLeft(),e._reflow(),n=e._reflow,e._reflow=function(){return n.apply(e,arguments)},c.add(e._reflow,e.frequency),i.show()},_getLeft:function(){var t=1e3*this.config.leftTime,n=this.config.stopPoint;!t&&n&&(t=n-+new Date),this.left=t-t%this.frequency},_reflow:function(t){var n=this,e=n.config.el;return t=t||0,n.left=n.left-n.frequency*t,a.each(n.hands,function(t,e){e.lastValue=e.value,e.value=Math.floor(n.left/e.base)%e.radix}),n._repaint(),n._notify[n.left]&&a.each(n._notify[n.left],function(t,e){e.call(n)}),n.left<1&&(e.text("— 活动已结束 —"),e.parents(".back-ground-white").on("click",function(){return o.show("活动即将开始,敬请期待!"),!1}),c.remove(n._reflow)),n.left<864e5&&e.find(".left-day").hide(),n},_repaint:function(){f[this.config.effect].paint.apply(this),this.config.el.trigger(l)},_toDigitals:function(t,n){var e=[];for(t=0>t?0:t,n=t.toString().length>1?2:1;n--;)e[n]=t%10,t=Math.floor(t/10);return e},_html:function(t,n,e){switch(a.isArray(t)&&(t=t.join("")),e){case"hand":n=e+" hand-"+n;break;case"handlet":n=e+" hand-"+n;break;case"digital":n="."===t?e+" "+e+"-point "+n:e+" "+e+"-"+t+" "+n}return'<i class="'+n+'">'+t+"</i>"},notify:function(t,n){var e;return t=1e3*t,t-=t%this.frequency,e=this._notify[t]||[],e.push(n),this._notify[t]=e,this}}),n.Countdown=i},16:function(t,n,e){function i(t){function n(t){var n;n=e.find("li").eq(t),n.length>0&&setTimeout(function(){i.scrollToElement(n[0],400)},1)}var e,i,a,o={el:".outlet-nav"};return a=r.extend({},o,t),e=r(a.el),i=new f(e[0],{scrollX:!0,scrollY:!1,tap:!0,eventPassthrough:!0,preventDefault:!0}),{"goto":n}}function a(t){var n=new RegExp("(^|&)"+t+"=([^&]*)(&|$)"),e=window.location.search.substr(1).match(n);return null!==e?decodeURIComponent(e[2]):null}function o(){r("#index_nav").find("li").each(function(){r(this).find("a").text()===s?r(this).attr({"data-nav":"other","data-type":3}):r(this).find("a").text()===c&&r(this).attr({"data-nav":"other","data-type":2})})}function l(){var t=r("#index_nav"),n=a("yh_channel");o(),null===n?(n=a("type"),null===n?t.find('li:not([data-nav="other"])').eq(0).addClass("active").siblings().removeClass("active"):t.find("li[data-type="+n+"]").addClass("active").siblings().removeClass("active")):t.find('li:not([data-nav="other"])').eq(n).addClass("active").siblings().removeClass("active")}var r=e(1),f=e(17),c="即将结束",s="上线预告";l(),t.exports=i}});