product.outlet-activity.js
4.32 KB
webpackJsonp([13],{0:function(t,n,e){(function(t){var n=e(14),i=e(13),o=t(".cd-lite");n({el:"#index_nav"})["goto"](t("#index_nav").find(".active").index()),new i.Countdown({el:o})}).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,o.text(e).show(),a=setTimeout(function(){"block"===o.css("display")&&o.hide()},i))}var o,a,r=e(1);!function(){var t='<div id="yoho-tip" class="yoho-tip"></div>';r(".yoho-page").append(t),o=r("#yoho-tip"),o.on("touchend",function(){o.hide(),clearTimeout(a)})}(),n.show=i},13:function(t,n,e){"use strict";function i(t){var n;return this instanceof i?(t.el=o(t.el),void(t.el&&(n=t.el.attr("data-config"),n&&(n=JSON.parse(n.replace(/'/g,'"')),t=o.extend(!0,{},l,n,t)),this.config=t,this._init()))):new i(t)}var o=e(1),a=e(2),r="afterPaint",l={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;o.each(n.hands,function(e,i){i.lastValue!==i.value&&(t="",o.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,o,a,r,l=+new Date-t.nextTime,f=1+Math.floor(l/100);i.length;)i.shift()();for(l=100-l%100,t.nextTime+=100*f,a=0,r=e.length;r>a;a+=2)n=e[a+1],0===n?e[a](f):(n+=2*f-1,o=Math.floor(n/20),o>0&&e[a](o),e[a+1]=n%20+1);setTimeout(t,l)}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 o;i.push(function(){o=n(t,e),-1!==o&&e.splice(n(t,e),2)})}}}();o.extend(i.prototype,{_init:function(){var t,n,e=this,i=e.config.el,a=[],r=i.html(),l=e.config.varRegular;e.hands=a,e.frequency=1e3,e._notify=[],l.lastIndex=0,i.html(r.replace(l,function(t,n){var i="";return"u"!==n&&"s-ext"!==n||(e.frequency=100),"s-ext"===n?(a.push({type:"s"}),a.push({type:"u"}),i=e._html("","s","handlet")+e._html(".","","digital")+e._html("","u","handlet")):a.push({type:n}),e._html(i,n,"hand")})),t=e.config.clock,o.each(a,function(n,e){var o,a=e.type,r=100;for(e.node=i.find(".hand-"+a),o=t.length-3;o>-1&&a!==t[o];o-=3)r*=t[o+1];e.base=r,e.radix=t[o+1],e.bits=t[o+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,o.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]&&o.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 a.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(r)},_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(o.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},14: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,o,a={el:".outlet-nav"};return o=l.extend({},a,t),e=l(o.el),i=new f(e[0],{scrollX:!0,scrollY:!1,mouseWheel:!0,scrollbars:!0,probeType:3,preventDefault:!0,click:!0}),{"goto":n}}function o(t){var n=new RegExp("(^|&)"+t+"=([^&]*)(&|$)"),e=window.location.search.substr(1).match(n);return null!==e?decodeURIComponent(e[2]):null}function a(){l("#index_nav").find("li").each(function(){l(this).find("a").text()===u?l(this).attr({"data-nav":"other","data-type":3}):l(this).find("a").text()===c&&l(this).attr({"data-nav":"other","data-type":2})})}function r(){l("#index_nav"),o("yh_channel");a()}var l=e(1),f=e(15),c="即将结束",u="上线预告";r(),t.exports=i}});