1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/linuxdash_ynh.git synced 2024-09-03 19:36:07 +02:00
linuxdash_ynh/sources/js/odometer.js

2 lines
7.4 KiB
JavaScript
Raw Normal View History

2014-06-02 13:38:03 +02:00
/*! odometer 0.3.6 */
(function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;p='<span class="odometer-value"></span>',m='<span class="odometer-ribbon"><span class="odometer-ribbon-inner">'+p+"</span></span>",d='<span class="odometer-digit"><span class="odometer-digit-spacer">8</span><span class="odometer-digit-inner">'+m+"</span></span>",g='<span class="odometer-formatting-mark"></span>',c=",ddd",h=60,f=2e3,a=20,i=2,e=.5,j=1e3/h,b=1e3/a,n="transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd",t=document.createElement("div").style,o=null!=t.transition||null!=t.webkitTransition||null!=t.mozTransition||null!=t.oTransition,s=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,k=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,q=function(a){var b;return b=document.createElement("div"),b.innerHTML=a,b.children[0]},r=function(){var a,b;return null!=(a=null!=(b=window.performance)?b.now():void 0)?a:+new Date},v=!1,(u=function(){var a,b,c,d,e;if(!v&&null!=window.jQuery){for(v=!0,d=["html","text"],e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(function(a){var b;return b=window.jQuery.fn[a],window.jQuery.fn[a]=function(a){return null==a||null==this[0].odometer?b.apply(this,arguments):this[0].odometer.update(a)}}(a));return e}})(),setTimeout(u,0),l=function(){function a(b){var d,e,g,h,k,l,m,n,o,p,q,r,s,t,u,v=this;if(this.options=b,this.el=this.options.el,null!=this.el.odometer)return this.el.odometer;for(this.el.odometer=this,s=a.options,h=o=0,q=s.length;q>o;h=++o)e=s[h],null==this.options[e]&&(this.options[e]=h);this.value=this.cleanValue(null!=(t=this.options.value)?t:""),null==(k=this.options).format&&(k.format=c),(l=this.options).format||(l.format="d"),null==(m=this.options).duration&&(m.duration=f),this.MAX_VALUES=0|this.options.duration/j/i,this.renderInside(),this.render();try{for(u=["HTML","Text"],n=function(a){return Object.defineProperty(v.el,"inner"+a,{get:function(){return v.inside["outer"+a]},set:function(a){return v.update(v.cleanValue(a))}})},p=0,r=u.length;r>p;p++)g=u[p],n(g)}catch(w){d=w,this.watchForMutations()}}return a.prototype.renderInside=function(){return this.inside=document.createElement("div"),this.inside.className="odometer-inside",this.el.innerHTML="",this.el.appendChild(this.inside)},a.prototype.watchForMutations=function(){var a,b=this;if(null!=k)try{return null==this.observer&&(this.observer=new k(function(){var a;return a=b.el.innerText,b.renderInside(),b.render(b.value),b.update(a)})),this.watchMutations=!0,this.startWatchingMutations()}catch(c){a=c}},a.prototype.startWatchingMutations=function(){return this.watchMutations?this.observer.observe(this.el,{childList:!0}):void 0},a.prototype.stopWatchingMutations=function(){var a;return null!=(a=this.observer)?a.disconnect():void 0},a.prototype.cleanValue=function(a){return parseInt(a.toString().replace(/[.,]/g,""),10)||0},a.prototype.bindTransitionEnd=function(){var a,b,c,d,e,f,g=this;if(!this.transitionEndBound){for(this.transitionEndBound=!0,b=!1,e=n.split(" "),f=[],c=0,d=e.length;d>c;c++)a=e[c],f.push(this.el.addEventListener(a,function(){return b?!0:(b=!0,setTimeout(function(){return g.render(),b=!1},0),!0)},!1));return f}},a.prototype.resetFormat=function(){return this.format=this.options.format.split("").reverse().join("")},a.prototype.render=function(a){var b,c,d,e,f,g,h,i,j;for(null==a&&(a=this.value),this.stopWatchingMutations(),this.resetFormat(),this.inside.innerHTML="",b=this.el.className.split(" "),e=[],f=0,h=b.length;h>f;f++)c=b[f],c.length&&(/^odometer(-|$)/.test(c)||e.push(c));for(e.push("odometer"),o||e.push("odometer-no-transitions"),this.options.theme?e.push("odometer-theme-"+this.options.theme):e.push("odometer-auto-theme"),this.el.className=e.join(" "),this.ribbons={},this.digits=[],j=a.toString().split("").reverse(),g=0,i=j.length;i>g;g++)d=j[g],this.addDigit(d);return this.startWatchingMutations()},a.prototype.update=function(a){var b,c=this;return a=this.cleanValue(a),(b=a-this.value)?(this.el.className+=b>