Commits

Chris Nanney committed 84a23bb

Forgot to update addDigit function for new bOffset.

  • Participants
  • Parent commits 9f9631c
  • Tags v0.5.2

Comments (0)

Files changed (2)

File js/flipcounter.js

 		
 		div.insertBefore(newDigit, div.firstChild);
 		doc.getElementById(o.idPre + "_t_d" + li).style.backgroundPosition = '0 -' + (digit * o.tFH) + 'px';
-		doc.getElementById(o.idPre + "_b_d" + li).style.backgroundPosition = '0 -' + (digit * o.bFH) + 'px';
+		doc.getElementById(o.idPre + "_b_d" + li).style.backgroundPosition = '0 -' + (digit * o.bFH + o.bOffset) + 'px';
 	}
 	
 	// Removes digit

File js/flipcounter.min.js

  * http://www.opensource.org/licenses/mit-license.php
  */
 var flipCounter=function(x,B){function u(){l=a.value;a.value+=a.inc;h=a.value;r(l,h);a.auto===!0&&(n=setTimeout(u,a.pace))}function y(d,f,b){var c=a.value,e=typeof f=="undefined"?!1:f,g=typeof b=="undefined"?1:b;e===!0&&g--;c!=d?(l=a.value,a.auto=!0,c+a.inc<=d&&g!=0?c+=a.inc:c=d,a.value=c,h=a.value,r(l,h),n=setTimeout(function(){y(d,e,g)},a.pace)):a.auto=!1}function r(d,f){v=d.toString().split("").reverse();s=f.toString().split("").reverse();var b,c=v.length,e=s.length;if(e>c)for(b=e-c;b>0;){var g=
-s[e-b],m=Number(e-b+1)-1;i=j.createElement("ul");i.className="cd";i.id=a.idPre+"_d"+m;i.innerHTML='<li class="t" id="'+a.idPre+"_t_d"+m+'"></li><li class="b" id="'+a.idPre+"_b_d"+m+'"></li>';if(m%3==0)o=j.createElement("ul"),o.className="cd",o.innerHTML='<li class="s"></li>',k.insertBefore(o,k.firstChild);k.insertBefore(i,k.firstChild);j.getElementById(a.idPre+"_t_d"+m).style.backgroundPosition="0 -"+g*a.tFH+"px";j.getElementById(a.idPre+"_b_d"+m).style.backgroundPosition="0 -"+g*a.bFH+"px";b--}if(e<
-c)for(b=c-e;b>0;){e=j.getElementById(a.idPre+"_d"+(c-b));k.removeChild(e);e=k.firstChild.firstChild;if((" "+e.className+" ").indexOf(" s ")>-1)e=e.parentNode,k.removeChild(e);b--}for(b=0;b<c;b++)s[b]!=v[b]&&C(b,v[b],s[b])}function C(d,f,b){function c(){if(g<7){m=g<3?"t":"b";if(h=j.getElementById(a.idPre+"_"+m+"_d"+d))h.style.backgroundPosition=i[g];g++;g!=3?setTimeout(c,e):c()}}var e,g=0,m,h,i=["-"+a.fW+"px -"+f*a.tFH+"px",a.fW*-2+"px -"+f*a.tFH+"px","0 -"+b*a.tFH+"px","-"+a.fW+"px -"+(f*a.bFH+a.bOffset)+
-"px",a.fW*-2+"px -"+(b*a.bFH+a.bOffset)+"px",a.fW*-3+"px -"+(b*a.bFH+a.bOffset)+"px","0 -"+(b*a.bFH+a.bOffset)+"px"];if(a.auto===!0&&a.pace<=300)switch(d){case 0:e=a.pace/6;break;case 1:e=a.pace/5;break;case 2:e=a.pace/4;break;case 3:e=a.pace/3;break;default:e=a.pace/1.5}else e=80;e=e>80?80:e;c()}function A(a,f,b,c,e){var g={result:!0};g.cond1=a/f>=1?!0:!1;g.cond2=f*b<=a?!0:!1;g.cond3=Math.abs(f*b-a)<=10?!0:!1;g.cond4=Math.abs(f*c-e)<=100?!0:!1;g.cond5=f*c<=e?!0:!1;if(g.cond1&&g.cond2&&g.cond4&&g.cond5){a=
-Math.abs(a-f*b)+Math.abs(f*c-e);if(p.q===null)p.q=a;if(a<=p.q)p.pace=c,p.inc=b}for(b=1;b<=5;b++)if(g["cond"+b]===!1)g.result=!1;return g}function q(a){return!isNaN(parseFloat(a))&&isFinite(a)}function z(){clearTimeout(n);n=null}var w={value:0,inc:1,pace:1E3,auto:!0,tFH:39,bFH:64,fW:53,bOffset:390,idPre:"counter"},a=B||{},j=window.document,k=x&&x!=""?j.getElementById(x):j.getElementById("counter"),t;for(t in w)a[t]=t in a?a[t]:w[t];var v=[],s=[],l,h,n=null,i,o,p={q:null,pace:0,inc:0};this.setValue=
-function(d){if(q(d))l=a.value,h=d,a.value=d,r(l,h);return this};this.setIncrement=function(d){a.inc=q(d)?d:w.inc;return this};this.setPace=function(d){a.pace=q(d)?d:w.pace;return this};this.setAuto=function(d){if(d&&!a.atuo)a.auto=!0,u();if(!d&&a.auto)n&&z(),a.auto=!1;return this};this.step=function(){a.auto||u();return this};this.add=function(d){if(q(d))l=a.value,a.value+=d,h=a.value,r(l,h);return this};this.subtract=function(d){if(q(d))l=a.value,a.value-=d,a.value>=0?h=a.value:(h="0",a.value=0),
-r(l,h);return this};this.incrementTo=function(d,f,b){n&&z();if(typeof f!="undefined"){var f=q(f)?f*1E3:1E4,b=typeof b!="undefined"&&q(b)?b:a.pace,c=typeof d!="undefined"&&q(d)?d-a.value:0,e,g,h,i=0;p.q=null;b=f/c>b?Math.round(f/c/10)*10:b;e=Math.floor(f/b);g=Math.floor(c/e);h=A(c,e,g,b,f);if(c>0){for(;h.result===!1&&i<100;)b+=10,e=Math.floor(f/b),g=Math.floor(c/e),h=A(c,e,g,b,f),i++;i==100?(a.inc=p.inc,a.pace=p.pace):(a.inc=g,a.pace=b);y(d,!0,e)}}else y(d)};this.getValue=function(){return a.value};
-this.stop=function(){n&&z();return this};(function(d){var d=d.toString(),f=d.length,b=1,c;for(c=0;c<f;c++){i=j.createElement("ul");i.className="cd";i.id=a.idPre+"_d"+c;i.innerHTML=i.innerHTML='<li class="t" id="'+a.idPre+"_t_d"+c+'"></li><li class="b" id="'+a.idPre+"_b_d"+c+'"></li>';k.insertBefore(i,k.firstChild);if(b!=f&&b%3==0)o=j.createElement("ul"),o.className="cd",o.innerHTML='<li class="s"></li>',k.insertBefore(o,k.firstChild);b++}d=d.toString().split("").reverse();for(c=0;c<f;c++)j.getElementById(a.idPre+
-"_t_d"+c).style.backgroundPosition="0 -"+d[c]*a.tFH+"px",j.getElementById(a.idPre+"_b_d"+c).style.backgroundPosition="0 -"+(d[c]*a.bFH+a.bOffset)+"px";a.auto===!0&&(n=setTimeout(u,a.pace))})(a.value)};
+s[e-b],m=Number(e-b+1)-1;i=j.createElement("ul");i.className="cd";i.id=a.idPre+"_d"+m;i.innerHTML='<li class="t" id="'+a.idPre+"_t_d"+m+'"></li><li class="b" id="'+a.idPre+"_b_d"+m+'"></li>';if(m%3==0)o=j.createElement("ul"),o.className="cd",o.innerHTML='<li class="s"></li>',k.insertBefore(o,k.firstChild);k.insertBefore(i,k.firstChild);j.getElementById(a.idPre+"_t_d"+m).style.backgroundPosition="0 -"+g*a.tFH+"px";j.getElementById(a.idPre+"_b_d"+m).style.backgroundPosition="0 -"+(g*a.bFH+a.bOffset)+
+"px";b--}if(e<c)for(b=c-e;b>0;){e=j.getElementById(a.idPre+"_d"+(c-b));k.removeChild(e);e=k.firstChild.firstChild;if((" "+e.className+" ").indexOf(" s ")>-1)e=e.parentNode,k.removeChild(e);b--}for(b=0;b<c;b++)s[b]!=v[b]&&C(b,v[b],s[b])}function C(d,f,b){function c(){if(g<7){m=g<3?"t":"b";if(h=j.getElementById(a.idPre+"_"+m+"_d"+d))h.style.backgroundPosition=i[g];g++;g!=3?setTimeout(c,e):c()}}var e,g=0,m,h,i=["-"+a.fW+"px -"+f*a.tFH+"px",a.fW*-2+"px -"+f*a.tFH+"px","0 -"+b*a.tFH+"px","-"+a.fW+"px -"+
+(f*a.bFH+a.bOffset)+"px",a.fW*-2+"px -"+(b*a.bFH+a.bOffset)+"px",a.fW*-3+"px -"+(b*a.bFH+a.bOffset)+"px","0 -"+(b*a.bFH+a.bOffset)+"px"];if(a.auto===!0&&a.pace<=300)switch(d){case 0:e=a.pace/6;break;case 1:e=a.pace/5;break;case 2:e=a.pace/4;break;case 3:e=a.pace/3;break;default:e=a.pace/1.5}else e=80;e=e>80?80:e;c()}function A(a,f,b,c,e){var g={result:!0};g.cond1=a/f>=1?!0:!1;g.cond2=f*b<=a?!0:!1;g.cond3=Math.abs(f*b-a)<=10?!0:!1;g.cond4=Math.abs(f*c-e)<=100?!0:!1;g.cond5=f*c<=e?!0:!1;if(g.cond1&&
+g.cond2&&g.cond4&&g.cond5){a=Math.abs(a-f*b)+Math.abs(f*c-e);if(p.q===null)p.q=a;if(a<=p.q)p.pace=c,p.inc=b}for(b=1;b<=5;b++)if(g["cond"+b]===!1)g.result=!1;return g}function q(a){return!isNaN(parseFloat(a))&&isFinite(a)}function z(){clearTimeout(n);n=null}var w={value:0,inc:1,pace:1E3,auto:!0,tFH:39,bFH:64,fW:53,bOffset:390,idPre:"counter"},a=B||{},j=window.document,k=x&&x!=""?j.getElementById(x):j.getElementById("counter"),t;for(t in w)a[t]=t in a?a[t]:w[t];var v=[],s=[],l,h,n=null,i,o,p={q:null,
+pace:0,inc:0};this.setValue=function(d){if(q(d))l=a.value,h=d,a.value=d,r(l,h);return this};this.setIncrement=function(d){a.inc=q(d)?d:w.inc;return this};this.setPace=function(d){a.pace=q(d)?d:w.pace;return this};this.setAuto=function(d){if(d&&!a.atuo)a.auto=!0,u();if(!d&&a.auto)n&&z(),a.auto=!1;return this};this.step=function(){a.auto||u();return this};this.add=function(d){if(q(d))l=a.value,a.value+=d,h=a.value,r(l,h);return this};this.subtract=function(d){if(q(d))l=a.value,a.value-=d,a.value>=0?
+h=a.value:(h="0",a.value=0),r(l,h);return this};this.incrementTo=function(d,f,b){n&&z();if(typeof f!="undefined"){var f=q(f)?f*1E3:1E4,b=typeof b!="undefined"&&q(b)?b:a.pace,c=typeof d!="undefined"&&q(d)?d-a.value:0,e,g,h,i=0;p.q=null;b=f/c>b?Math.round(f/c/10)*10:b;e=Math.floor(f/b);g=Math.floor(c/e);h=A(c,e,g,b,f);if(c>0){for(;h.result===!1&&i<100;)b+=10,e=Math.floor(f/b),g=Math.floor(c/e),h=A(c,e,g,b,f),i++;i==100?(a.inc=p.inc,a.pace=p.pace):(a.inc=g,a.pace=b);y(d,!0,e)}}else y(d)};this.getValue=
+function(){return a.value};this.stop=function(){n&&z();return this};(function(d){var d=d.toString(),f=d.length,b=1,c;for(c=0;c<f;c++){i=j.createElement("ul");i.className="cd";i.id=a.idPre+"_d"+c;i.innerHTML=i.innerHTML='<li class="t" id="'+a.idPre+"_t_d"+c+'"></li><li class="b" id="'+a.idPre+"_b_d"+c+'"></li>';k.insertBefore(i,k.firstChild);if(b!=f&&b%3==0)o=j.createElement("ul"),o.className="cd",o.innerHTML='<li class="s"></li>',k.insertBefore(o,k.firstChild);b++}d=d.toString().split("").reverse();
+for(c=0;c<f;c++)j.getElementById(a.idPre+"_t_d"+c).style.backgroundPosition="0 -"+d[c]*a.tFH+"px",j.getElementById(a.idPre+"_b_d"+c).style.backgroundPosition="0 -"+(d[c]*a.bFH+a.bOffset)+"px";a.auto===!0&&(n=setTimeout(u,a.pace))})(a.value)};