Commits

Chris Nanney committed b07a4d1

Removed jQuery dependency, which is only used now for demo controls. Added version number.

Comments (0)

Files changed (4)

 
 THIS YOU NEED TO KEEP.
 
+This assumes the ID of the counter div is "#counter"
+
 */
 
-ul.cd{float:left;list-style-type:none;margin:0;padding:0}
-li.t{background:url(../img/digits-top.png) 0 0 no-repeat;width:53px;height:39px}
-li.b{background:url(../img/digits-bottom.png) 0 0 no-repeat;width:53px;height:64px}
-li.s{background:url(../img/comma.png) 2px 75px no-repeat;width:12px;height:100px}
+#counter ul.cd{float:left;list-style-type:none;margin:0;padding:0}
+#counter li.t{background:url(../img/digits-top.png) 0 0 no-repeat;width:53px;height:39px}
+#counter li.b{background:url(../img/digits-bottom.png) 0 0 no-repeat;width:53px;height:64px}
+#counter li.s{background:url(../img/comma.png) 2px 75px no-repeat;width:12px;height:100px}
 <!DOCTYPE html>
-
 <head>
-
+	<meta charset="utf-8" />
 	<title>New Apple-Style Flip Counter Demo</title>
-	<meta charset="utf-8" />
 	<meta name="description" content="A more functional version of my Apple-Style Flip Counter." />
 	<meta name="keywords" content="HTML,CSS,JavaScript,counter,apple-style,flip,animate,digit,demo" />
 	<meta name="author" content="Chris Nanney" />
 
-	<!-- jQuery from Google CDN, REQUIRED -->
-	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
 	<!-- My flip counter script, REQUIRED -->
-	<script type="text/javascript" src="js/flipcounter.min.js"></script>
+	<script type="text/javascript" src="js/flipcounter.js"></script>
 	<!-- Style sheet for the counter, REQUIRED -->
 	<link rel="stylesheet" type="text/css" href="css/counter.css" />
+	
 
-
+	<!-- 
+	NOT REQUIRED FOR COUNTER TO FUNCTION, JUST FOR DEMO PURPOSES
+	------------------------------------------------------------>
+	<!-- jQuery from Google CDN, NOT REQUIRED for the counter itself -->
+	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
 	<!-- jQueryUI from Google CDN, used only for the fancy demo controls, NOT REQUIRED for the counter itself -->
 	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js"></script>
 	<!-- Style sheet for the jQueryUI controls, NOT REQUIRED for the counter itself -->

js/flipcounter.js

 /**
  * Apple-Style Flip Counter
  * ------------------------
+ * Version 0.5 - April 13, 2011 
  *
  * Copyright (c) 2010 Chris Nanney
  * http://cnanney.com/journal/code/apple-style-counter-revisited/
 		inc: 1,
 		pace: 1000,
 		auto: true,
-		debug: false //Uses console.log, so don't enable unless your browser supports it.
+		tFH: 39,
+		bFH: 64,
+		fW: 53
 	};
 	
 	var o = options || {},
-	div = d && d != '' ? "#" + d : "#counter";
+	doc = window.document,
+	div = d && d != '' ? doc.getElementById(d) : doc.getElementById("counter");
 	
 	for (var opt in defaults) o[opt] = (opt in o) ? o[opt] : defaults[opt];
 
-	var tFrameHeight = 39,
-	bFrameHeight = 64,
-	frameWidth = 53,
-	digitsOld = [], digitsNew = [], subStart, subEnd, x, y, nextCount = null,
+	var digitsOld = [], digitsNew = [], subStart, subEnd, x, y, nextCount = null, newDigit, newComma,
 	best = {
 		q: null,
 		pace: 0,
 	 */
 	this.setValue = function(n){
 		if (isNumber(n)){
-			x = o.value.toString();
-			y = n.toString();
+			x = o.value;
+			y = n;
 			o.value = n;
 			digitCheck(x,y);
 		}
 	 */
 	this.add = function(n){
 		if (isNumber(n)){
-			x = o.value.toString();
+			x = o.value;
 			o.value += n;
-			y = o.value.toString();
+			y = o.value;
 			digitCheck(x,y);
 		}
 		return this;
 	 */
 	this.subtract = function(n){
 		if (isNumber(n)){
-			x = o.value.toString();
+			x = o.value;
 			o.value -= n;
 			if (o.value >= 0){
-				y = o.value.toString();
+				y = o.value;
 			}
 			else{
 				y = "0";
 			
 			check = checkSmartValues(diff, cycles, inc, pace, time);
 			
-			// DEBUGGING
-			
-//			if (o.debug){
-//				console.log(
-//					'***************************************************************\n' +
-//					'START: ' + o.value + '\nEND: ' + n + '\n' + check.str
-//				);
-//			}
-			
 			if (diff > 0){
 				while (check.result === false && i < 100){				
 					pace += 10;
 					cycles = Math.floor(time / pace);
 					inc = Math.floor(diff / cycles);
 					
-					check = checkSmartValues(diff, cycles, inc, pace, time);
-					
-					// DEBUGGING
-					
-//					if (o.debug){
-//						console.log('ADJUSTMENT: ' + (i + 1) + '\n' + check.str);
-//					}
-					
+					check = checkSmartValues(diff, cycles, inc, pace, time);					
 					i++;
 				}
 				
 	//---------------------------------------------------------------------------//
 	
 	function doCount(){
-		x = o.value.toString();
+		x = o.value;
 		o.value += o.inc;
-		y = o.value.toString();
+		y = o.value;
 		digitCheck(x,y);
 		if (o.auto === true) nextCount = setTimeout(doCount, o.pace);
 	}
 		if (smart === true) cycles--;
 		
 		if (val != n){
-			x = o.value.toString(),
+			x = o.value,
 			o.auto = true;
 
 			if (val + o.inc <= n && cycles != 0) val += o.inc
 			else val = n;
 			
 			o.value = val;
-			y = o.value.toString();
+			y = o.value;
 			
 			digitCheck(x,y);
 			nextCount = setTimeout(function(){doIncrement(n, smart, cycles)}, o.pace);
 	}
 	
 	function digitCheck(x,y){
-		var diff, adder;
+		var diff, adder,
+		x = x.toString(),
+		y = y.toString();
 		digitsOld = splitToArray(x);
 		digitsNew = splitToArray(y);
 		if (y.length > x.length){
 	function animateDigit(n, oldDigit, newDigit){
 		var speed, step = 0, w,
 		bp = [
-			'-' + frameWidth + 'px -' + (oldDigit * tFrameHeight) + 'px',
-			(frameWidth * -2) + 'px -' + (oldDigit * tFrameHeight) + 'px',
-			'0 -' + (newDigit * tFrameHeight) + 'px',
-			'-' + frameWidth + 'px -' + (oldDigit * bFrameHeight) + 'px',
-			(frameWidth * -2) + 'px -' + (newDigit * bFrameHeight) + 'px',
-			(frameWidth * -3) + 'px -' + (newDigit * bFrameHeight) + 'px',
-			'0 -' + (newDigit * bFrameHeight) + 'px'
+			'-' + o.fW + 'px -' + (oldDigit * o.tFH) + 'px',
+			(o.fW * -2) + 'px -' + (oldDigit * o.tFH) + 'px',
+			'0 -' + (newDigit * o.tFH) + 'px',
+			'-' + o.fW + 'px -' + (oldDigit * o.bFH) + 'px',
+			(o.fW * -2) + 'px -' + (newDigit * o.bFH) + 'px',
+			(o.fW * -3) + 'px -' + (newDigit * o.bFH) + 'px',
+			'0 -' + (newDigit * o.bFH) + 'px'
 		];
 
 		if (o.auto === true && o.pace <= 300){
 		function animate(){
 			if (step < 7){
 				w = step < 3 ? 't' : 'b';
-				jQuery(div + " #d" + n + " li." + w).css("background-position", bp[step]);
+				doc.getElementById("counter_" + w + "_d" + n).style.backgroundPosition = bp[step];
 				step++;
 				if (step != 3) setTimeout(animate, speed);
 				else animate();
 
 	// Adds new digit
 	function addDigit(len, digit){
+		console.log('add');
 		var li = Number(len) - 1;
-		if (li % 3 == 0) jQuery(div).prepend('<ul class="cd"><li class="s"></li></ul>');
-		jQuery(div).prepend('<ul class="cd" id="d' + li + '"><li class="t"></li><li class="b"></li></ul>');
-		jQuery(div + " #d" + li + " li.t").css({'background-position': '0 -' + (digit * tFrameHeight) + 'px'});
-		jQuery(div + " #d" + li + " li.b").css({'background-position': '0 -' + (digit * bFrameHeight) + 'px'});
+		newDigit = doc.createElement("ul");
+		newDigit.className = 'cd';
+		newDigit.id = 'counter_d' + li;
+		newDigit.innerHTML = '<li class="t" id="counter_t_d' + li + '"></li><li class="b" id="counter_b_d' + li + '"></li>';
+		
+		if (li % 3 == 0){
+			newComma = doc.createElement("ul");
+			newComma.className = 'cd';
+			newComma.innerHTML = '<li class="s"></li>';
+			div.insertBefore(newComma, div.firstChild);
+		}
+		
+		div.insertBefore(newDigit, div.firstChild);
+		doc.getElementById("counter_t_d" + li).style.backgroundPosition = '0 -' + (digit * o.tFH) + 'px';
+		doc.getElementById("counter_b_d" + li).style.backgroundPosition = '0 -' + (digit * o.bFH) + 'px';
 	}
 	
 	// Removes digit
 	function removeDigit(id){
-		jQuery(div + " #d" + id).remove();
+		var remove = doc.getElementById("counter_d" + id);
+		div.removeChild(remove);
+
 		// Check for leading comma
-		var first = jQuery(div + " li").first();
-		if (first.hasClass("s")) first.parent("ul").remove();
+		var first = div.firstChild.firstChild;
+		if ((" " + first.className + " ").indexOf(" s ") > -1 ){
+			remove = first.parentNode;
+			div.removeChild(remove);
+		}
 	}
 
 	// Sets the correct digits on load
 	function initialDigitCheck(initial){
 		// Creates the right number of digits
-		var count = initial.toString().length,
+		var initial = initial.toString(),
+		count = initial.length,
 		bit = 1, i;
 		for (i = 0; i < count; i++){
-			jQuery(div).prepend('<ul class="cd" id="d' + i + '"><li class="t"></li><li class="b"></li></ul>');
-			if (bit != (count) && bit % 3 == 0) jQuery(div).prepend('<ul class="cd"><li class="s"></li></ul>');
+			newDigit = doc.createElement("ul");
+			newDigit.className = 'cd';
+			newDigit.id = 'counter_d' + i;
+			newDigit.innerHTML = newDigit.innerHTML = '<li class="t" id="counter_t_d' + i + '"></li><li class="b" id="counter_b_d' + i + '"></li>';
+			div.insertBefore(newDigit, div.firstChild);
+			if (bit != (count) && bit % 3 == 0){
+				newComma = doc.createElement("ul");
+				newComma.className = 'cd';
+				newComma.innerHTML = '<li class="s"></li>';
+				div.insertBefore(newComma, div.firstChild);
+			}
 			bit++;
 		}
 		// Sets them to the right number
-		var digits = splitToArray(initial.toString());
+		var digits = splitToArray(initial);
 		for (i = 0; i < count; i++){
-			jQuery(div + " #d" + i + " li.t").css({'background-position': '0 -' + (digits[i] * tFrameHeight) + 'px'});
-			jQuery(div + " #d" + i + " li.b").css({'background-position': '0 -' + (digits[i] * bFrameHeight) + 'px'});
+			doc.getElementById("counter_t_d" + i).style.backgroundPosition = '0 -' + (digits[i] * o.tFH) + 'px';
+			doc.getElementById("counter_b_d" + i).style.backgroundPosition = '0 -' + (digits[i] * o.bFH) + 'px';
 		}
 		// Do first animation
 		if (o.auto === true) nextCount = setTimeout(doCount, o.pace);
 			}
 		}
 		
-		// DEBUGGING
-		//r.str = 'Condition Checks:\n';
 		for (var i = 1; i <= 5; i++){
-			//r.str += i + ': ';
 			if (r['cond' + i] === false){
-				//r.str += 'FAIL';
 				r.result = false;
-			}
-			
-//			else{
-//				r.str += 'PASS';
-//			}
-//			r.str += i < 5 ? ', ' : '';
-			
+			}			
 		}
-		
-		// DEBUGGING
-		
-//		r.str += '\n----\n   Pace: ' + pace +
-//			'\n   Diff: ' + diff +
-//			'\n   Cycles: ' + cycles +
-//			'\n   Calculated Inc: ' + (diff / cycles) +
-//			'\n   Rounded Inc: ' + inc +
-//			'\n   Calculated time: ' + Math.abs(cycles * pace) +
-//			'\n   Target time: ' + time +
-//			'\n   ACTUAL END VALUE: ' + (cycles*inc+o.value);
-		
 		return r;
 	}
 	

js/flipcounter.min.js

 /**
  * Apple-Style Flip Counter
- * ------------------------
+ * Version 0.5 - April 13, 2011 
  *
  * Copyright (c) 2010 Chris Nanney
  * http://cnanney.com/journal/code/apple-style-counter-revisited/
  * Licensed under MIT
  * http://www.opensource.org/licenses/mit-license.php
  */
-var flipCounter=function(w,D){function s(){i=a.value.toString();a.value+=a.inc;h=a.value.toString();o(i,h);a.auto===!0&&(k=setTimeout(s,a.pace))}function x(c,f,b){var d=a.value,e=typeof f=="undefined"?!1:f,g=typeof b=="undefined"?1:b;e===!0&&g--;d!=c?(i=a.value.toString(),a.auto=!0,d+a.inc<=c&&g!=0?d+=a.inc:d=c,a.value=d,h=a.value.toString(),o(i,h),k=setTimeout(function(){x(c,e,g)},a.pace)):a.auto=!1}function o(c,a){var b;t=y(c);u=y(a);if(a.length>c.length)for(b=a.length-c.length;b>0;){var d=u[a.length-
-b],e=Number(a.length-b+1)-1;e%3==0&&jQuery(j).prepend('<ul class="cd"><li class="s"></li></ul>');jQuery(j).prepend('<ul class="cd" id="d'+e+'"><li class="t"></li><li class="b"></li></ul>');jQuery(j+" #d"+e+" li.t").css({"background-position":"0 -"+d*p+"px"});jQuery(j+" #d"+e+" li.b").css({"background-position":"0 -"+d*n+"px"});b--}if(a.length<c.length)for(b=c.length-a.length;b>0;)jQuery(j+" #d"+(c.length-b)).remove(),d=jQuery(j+" li").first(),d.hasClass("s")&&d.parent("ul").remove(),b--;for(b=0;b<
-t.length;b++)u[b]!=t[b]&&E(b,t[b],u[b])}function E(c,f,b){function d(){g<7&&(h=g<3?"t":"b",jQuery(j+" #d"+c+" li."+h).css("background-position",i[g]),g++,g!=3?setTimeout(d,e):d())}var e,g=0,h,i=["-"+q+"px -"+f*p+"px",q*-2+"px -"+f*p+"px","0 -"+b*p+"px","-"+q+"px -"+f*n+"px",q*-2+"px -"+b*n+"px",q*-3+"px -"+b*n+"px","0 -"+b*n+"px"];if(a.auto===!0&&a.pace<=300)switch(c){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;d()}function y(c){for(var a=[],b=0;b<c.length;b++)A=c.length-(b+1),B=c.length-b,a[b]=c.substring(A,B);return a}function C(a,f,b,d,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*d-e)<=100?!0:!1;g.cond5=f*d<=e?!0:!1;if(g.cond1&&g.cond2&&g.cond4&&g.cond5){a=Math.abs(a-f*b)+Math.abs(f*d-e);if(l.q===null)l.q=a;if(a<=l.q)l.pace=d,l.inc=b}for(b=1;b<=5;b++)if(g["cond"+b]===!1)g.result=!1;return g}function m(a){return!isNaN(parseFloat(a))&&
-isFinite(a)}function z(){clearTimeout(k);k=null}var v={value:0,inc:1,pace:1E3,auto:!0,debug:!1},a=D||{},j=w&&w!=""?"#"+w:"#counter",r;for(r in v)a[r]=r in a?a[r]:v[r];var p=39,n=64,q=53,t=[],u=[],A,B,i,h,k=null,l={q:null,pace:0,inc:0};this.setValue=function(c){if(m(c))i=a.value.toString(),h=c.toString(),a.value=c,o(i,h);return this};this.setIncrement=function(c){a.inc=m(c)?c:v.inc;return this};this.setPace=function(c){a.pace=m(c)?c:v.pace;return this};this.setAuto=function(c){if(c&&!a.atuo)a.auto=
-!0,s();if(!c&&a.auto)k&&z(),a.auto=!1;return this};this.step=function(){a.auto||s();return this};this.add=function(c){m(c)&&(i=a.value.toString(),a.value+=c,h=a.value.toString(),o(i,h));return this};this.subtract=function(c){if(m(c))i=a.value.toString(),a.value-=c,a.value>=0?h=a.value.toString():(h="0",a.value=0),o(i,h);return this};this.incrementTo=function(c,f,b){k&&z();if(typeof f!="undefined"){var f=m(f)?f*1E3:1E4,b=typeof b!="undefined"&&m(b)?b:a.pace,d=typeof c!="undefined"&&m(c)?c-a.value:
-0,e,g,h,i=0;l.q=null;b=f/d>b?Math.round(f/d/10)*10:b;e=Math.floor(f/b);g=Math.floor(d/e);h=C(d,e,g,b,f);if(d>0){for(;h.result===!1&&i<100;)b+=10,e=Math.floor(f/b),g=Math.floor(d/e),h=C(d,e,g,b,f),i++;i==100?(a.inc=l.inc,a.pace=l.pace):(a.inc=g,a.pace=b);x(c,!0,e)}}else x(c)};this.getValue=function(){return a.value};this.stop=function(){k&&z();return this};(function(c){var f=c.toString().length,b=1,d;for(d=0;d<f;d++)jQuery(j).prepend('<ul class="cd" id="d'+d+'"><li class="t"></li><li class="b"></li></ul>'),
-b!=f&&b%3==0&&jQuery(j).prepend('<ul class="cd"><li class="s"></li></ul>'),b++;c=y(c.toString());for(d=0;d<f;d++)jQuery(j+" #d"+d+" li.t").css({"background-position":"0 -"+c[d]*p+"px"}),jQuery(j+" #d"+d+" li.b").css({"background-position":"0 -"+c[d]*n+"px"});a.auto===!0&&(k=setTimeout(s,a.pace))})(a.value)};
+var flipCounter=function(w,D){function s(){l=a.value;a.value+=a.inc;h=a.value;q(l,h);a.auto===!0&&(m=setTimeout(s,a.pace))}function x(c,e,b){var d=a.value,f=typeof e=="undefined"?!1:e,g=typeof b=="undefined"?1:b;f===!0&&g--;d!=c?(l=a.value,a.auto=!0,d+a.inc<=c&&g!=0?d+=a.inc:d=c,a.value=d,h=a.value,q(l,h),m=setTimeout(function(){x(c,f,g)},a.pace)):a.auto=!1}function q(c,e){var b,c=c.toString(),e=e.toString();t=y(c);u=y(e);if(e.length>c.length)for(b=e.length-c.length;b>0;){var d=e.length-b+1,f=u[e.length-
+b];console.log("add");d=Number(d)-1;i=j.createElement("ul");i.className="cd";i.id="counter_d"+d;i.innerHTML='<li class="t" id="counter_t_d'+d+'"></li><li class="b" id="counter_b_d'+d+'"></li>';if(d%3==0)n=j.createElement("ul"),n.className="cd",n.innerHTML='<li class="s"></li>',k.insertBefore(n,k.firstChild);k.insertBefore(i,k.firstChild);j.getElementById("counter_t_d"+d).style.backgroundPosition="0 -"+f*a.tFH+"px";j.getElementById("counter_b_d"+d).style.backgroundPosition="0 -"+f*a.bFH+"px";b--}if(e.length<
+c.length)for(b=c.length-e.length;b>0;){f=j.getElementById("counter_d"+(c.length-b));k.removeChild(f);f=k.firstChild.firstChild;if((" "+f.className+" ").indexOf(" s ")>-1)f=f.parentNode,k.removeChild(f);b--}for(b=0;b<t.length;b++)u[b]!=t[b]&&E(b,t[b],u[b])}function E(c,e,b){function d(){if(g<7)h=g<3?"t":"b",j.getElementById("counter_"+h+"_d"+c).style.backgroundPosition=i[g],g++,g!=3?setTimeout(d,f):d()}var f,g=0,h,i=["-"+a.fW+"px -"+e*a.tFH+"px",a.fW*-2+"px -"+e*a.tFH+"px","0 -"+b*a.tFH+"px","-"+a.fW+
+"px -"+e*a.bFH+"px",a.fW*-2+"px -"+b*a.bFH+"px",a.fW*-3+"px -"+b*a.bFH+"px","0 -"+b*a.bFH+"px"];if(a.auto===!0&&a.pace<=300)switch(c){case 0:f=a.pace/6;break;case 1:f=a.pace/5;break;case 2:f=a.pace/4;break;case 3:f=a.pace/3;break;default:f=a.pace/1.5}else f=80;f=f>80?80:f;d()}function y(a){for(var e=[],b=0;b<a.length;b++)A=a.length-(b+1),B=a.length-b,e[b]=a.substring(A,B);return e}function C(a,e,b,d,f){var g={result:!0};g.cond1=a/e>=1?!0:!1;g.cond2=e*b<=a?!0:!1;g.cond3=Math.abs(e*b-a)<=10?!0:!1;g.cond4=
+Math.abs(e*d-f)<=100?!0:!1;g.cond5=e*d<=f?!0:!1;if(g.cond1&&g.cond2&&g.cond4&&g.cond5){a=Math.abs(a-e*b)+Math.abs(e*d-f);if(o.q===null)o.q=a;if(a<=o.q)o.pace=d,o.inc=b}for(b=1;b<=5;b++)if(g["cond"+b]===!1)g.result=!1;return g}function p(a){return!isNaN(parseFloat(a))&&isFinite(a)}function z(){clearTimeout(m);m=null}var v={value:0,inc:1,pace:1E3,auto:!0,tFH:39,bFH:64,fW:53},a=D||{},j=window.document,k=w&&w!=""?j.getElementById(w):j.getElementById("counter"),r;for(r in v)a[r]=r in a?a[r]:v[r];var t=
+[],u=[],A,B,l,h,m=null,i,n,o={q:null,pace:0,inc:0};this.setValue=function(c){if(p(c))l=a.value,h=c,a.value=c,q(l,h);return this};this.setIncrement=function(c){a.inc=p(c)?c:v.inc;return this};this.setPace=function(c){a.pace=p(c)?c:v.pace;return this};this.setAuto=function(c){if(c&&!a.atuo)a.auto=!0,s();if(!c&&a.auto)m&&z(),a.auto=!1;return this};this.step=function(){a.auto||s();return this};this.add=function(c){if(p(c))l=a.value,a.value+=c,h=a.value,q(l,h);return this};this.subtract=function(c){if(p(c))l=
+a.value,a.value-=c,a.value>=0?h=a.value:(h="0",a.value=0),q(l,h);return this};this.incrementTo=function(c,e,b){m&&z();if(typeof e!="undefined"){var e=p(e)?e*1E3:1E4,b=typeof b!="undefined"&&p(b)?b:a.pace,d=typeof c!="undefined"&&p(c)?c-a.value:0,f,g,h,i=0;o.q=null;b=e/d>b?Math.round(e/d/10)*10:b;f=Math.floor(e/b);g=Math.floor(d/f);h=C(d,f,g,b,e);if(d>0){for(;h.result===!1&&i<100;)b+=10,f=Math.floor(e/b),g=Math.floor(d/f),h=C(d,f,g,b,e),i++;i==100?(a.inc=o.inc,a.pace=o.pace):(a.inc=g,a.pace=b);x(c,
+!0,f)}}else x(c)};this.getValue=function(){return a.value};this.stop=function(){m&&z();return this};(function(c){var c=c.toString(),e=c.length,b=1,d;for(d=0;d<e;d++){i=j.createElement("ul");i.className="cd";i.id="counter_d"+d;i.innerHTML=i.innerHTML='<li class="t" id="counter_t_d'+d+'"></li><li class="b" id="counter_b_d'+d+'"></li>';k.insertBefore(i,k.firstChild);if(b!=e&&b%3==0)n=j.createElement("ul"),n.className="cd",n.innerHTML='<li class="s"></li>',k.insertBefore(n,k.firstChild);b++}c=y(c);for(d=
+0;d<e;d++)j.getElementById("counter_t_d"+d).style.backgroundPosition="0 -"+c[d]*a.tFH+"px",j.getElementById("counter_b_d"+d).style.backgroundPosition="0 -"+c[d]*a.bFH+"px";a.auto===!0&&(m=setTimeout(s,a.pace))})(a.value)};