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