Code layout change.
[wolnelektury.git] / src / wolnelektury / static / js / contrib / progressSpin.min.js
1 /* https://github.com/mateagar/progressSpin */(function(e){e.fn.progressSpin=function(t){function f(e,t){var i=1-t;var s=Raphael.getRGB(n.activeColor);var o=Raphael.getRGB(n.fillColor);var u=Math.floor(s.r*t+o.r*i);var a=Math.floor(s.g*t+o.g*i);var f=Math.floor(s.b*t+o.b*i);var l=Raphael.rgb(u,a,f);r[e].attr("fill",l)}function l(e){e=e%12;if(e<0){e+=12}return e}if(this.getOptions){return this}var n=e.extend({},e.fn.progressSpin.defaults,t);var r=[];var i=false;var s=null;var o=0;var u=null;var a=this;this.getOptions=function(){return n};this.getVisible=function(){return i};this.getAnimating=function(){return s!=null};this.getCurrentStep=function(){return o};this.setCurrentStep=function(e){if(this.getAnimating()){this.stop(false);o=l(e);this.start()}else{o=l(e)}};this.start=function(){if(this.getAnimating()){}else{this.show();f(o,1);var e=1/(n.tailCount+1);var t=0;var r=n.tailCount;s=setInterval(function(){if(t<r){t++}o=l(o+1);var n=1;for(var i=0;i<=t+1;i++){var s=l(o-i);f(s,1-i*e)}},Math.floor(n.cycleTime/12))}};this.stop=function(e){if(e==null){e=true}if(s){clearInterval(s);s=null}var t=n.fillColor;r.forEach(function(e){e.attr("fill",t)});if(e){this.hide()}};this.show=function(){if(r.length==0){this.render()}else{if(i){}else{r.forEach(function(e){e.show()});i=true}}};this.hide=function(){if(this.getAnimating()){this.stop(false)}if(i){r.forEach(function(e){e.hide()})}i=false};this.render=function(){if(this.getAnimating()){this.stop(false)}if(u){r=[];u.clear();u.setSize(this.width(),this.height())}else{u=Raphael(this.get(0),this.width(),this.height())}var e=Math.floor(this.width()/2);var t=Math.floor(this.height()/2);var s=e;if(t<s){s=t}var o=e-Math.floor(n.stepWidth/2);var a=t-s;var f=s-Math.floor(s*n.knockOutRatio);var l=u.rect(o,a,n.stepWidth,f,n.cornerRadius);l.attr("fill",n.fillColor);l.attr("stroke-width",0);r[0]=l;var c=30;for(var h=1;h<=11;h++){var p=l.clone();p.transform("r"+c+","+e+","+t);r[h]=p;c+=30}i=true};return this};e.fn.progressSpin.defaults={activeColor:"#000000",fillColor:"#aaaaaa",cycleTime:1e3,tailCount:6,stepWidth:5,cornerRadius:2,knockOutRatio:.5}})(jQuery);