forked from voronianski/ngprogress-lite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathngprogress-lite.min.js
More file actions
2 lines (2 loc) · 1.66 KB
/
ngprogress-lite.min.js
File metadata and controls
2 lines (2 loc) · 1.66 KB
1
2
/*! ngprogress-lite - v1.0.4 (http://labs.voronianski.com/ngprogress-lite.js) */
!function(a,b,c){"use strict";b.module("ngProgressLite",[]).provider("ngProgressLite",function(){this.$get=["$document",function(a){return function(d){var e,f,g,h={minimum:c.random(.01,.09),speed:c.random(100,300),ease:"ease",trickleRate:c.random(.03,.12),trickleSpeed:c.random(100,400),template:'<div class="ngProgressLite"><div class="ngProgressLiteBar"></div></div>'},i=d||a.find("body"),j={render:function(){return this.isRendered()?e:(i.addClass("ngProgressLite-on"),e=b.element(h.template),i.append(e),g=!1,e)},remove:function(){i.removeClass("ngProgressLite-on"),e.remove(),g=!0},isRendered:function(){return e&&e.children().length>0&&!g},trickle:function(){var a=100-100*f,b=h.trickleRate*Math.pow(1-Math.sqrt(a),2);return k.inc(b/100)},clamp:function(a,b,c){return b>a?b:a>c?c:a},toBarPercents:function(a){return 100*a},positioning:function(a,b,c){return{width:this.toBarPercents(a)+"%",transition:"all "+b+"ms "+c}}},k={set:function(a){var b=j.render();return a=j.clamp(a,h.minimum,1),f=1===a?null:a,setTimeout(function(){b.children().eq(0).css(j.positioning(a,h.speed,h.ease))},100),1===a&&setTimeout(function(){b.css({transition:"all "+h.speed+"ms linear",opacity:0}),setTimeout(function(){j.remove()},h.speed)},h.speed),k},get:function(){return f},start:function(){f||k.set(0);var a=function(){setTimeout(function(){f&&(j.trickle(),a())},h.trickleSpeed)};return a(),k},inc:function(a){var b=f;return b?("number"!=typeof a&&(a=(1-b)*j.clamp(Math.random()*b,.1,.95)),b=j.clamp(b+a,0,.994),k.set(b)):k.start()},done:function(){f&&k.inc(.3+.5*Math.random()).set(1)}};return k}}]})}(window,window.angular,_);