@@ -477,7 +477,22 @@ var FlipClock;
477477 */
478478
479479 stop : function ( ) { } ,
480-
480+
481+ /**
482+ * Auto increments/decrements the value of the clock face
483+ */
484+
485+ autoIncrement : function ( ) {
486+ if ( ! ( this . factory . time . time instanceof Date ) ) {
487+ if ( ! this . factory . countdown ) {
488+ this . increment ( ) ;
489+ }
490+ else {
491+ this . decrement ( ) ;
492+ }
493+ }
494+ } ,
495+
481496 /**
482497 * Increments the value of the clock face
483498 */
@@ -506,6 +521,7 @@ var FlipClock;
506521 flip : function ( time , doNotAddPlayClass ) {
507522 var t = this ;
508523
524+ /*
509525 if (!(this.factory.time.time instanceof Date)) {
510526 if(!this.factory.countdown) {
511527 this.increment();
@@ -514,6 +530,7 @@ var FlipClock;
514530 this.decrement();
515531 }
516532 }
533+ */
517534
518535 $ . each ( time , function ( i , digit ) {
519536 var list = t . lists [ i ] ;
@@ -639,6 +656,12 @@ var FlipClock;
639656
640657 clockFace : 'HourlyCounter' ,
641658
659+ /**
660+ * The name of the clock face class in use
661+ */
662+
663+ countdown : false ,
664+
642665 /**
643666 * The name of the default clock face class to use if the defined
644667 * clockFace variable is not a valid FlipClock.Face object
@@ -728,13 +751,15 @@ var FlipClock;
728751
729752 this . lists = [ ] ;
730753 this . running = false ;
731- this . base ( options ) ;
754+ this . base ( options ) ;
755+
732756 this . $el = $ ( obj ) . addClass ( this . classes . wrapper ) ;
733757
734758 // Depcrated support of the $wrapper property.
735759 this . $wrapper = this . $el ;
736760
737761 this . original = ( digit instanceof Date ) ? digit : ( digit ? Math . round ( digit ) : 0 ) ;
762+
738763 this . time = new FlipClock . Time ( this , this . original , {
739764 minimumDigits : options . minimumDigits ? options . minimumDigits : 0 ,
740765 animationRate : options . animationRate ? options . animationRate : 1000
@@ -743,6 +768,7 @@ var FlipClock;
743768 this . timer = new FlipClock . Timer ( this , options ) ;
744769
745770 this . lang = this . loadLanguage ( this . language ) ;
771+
746772 this . face = this . loadClockFace ( this . clockFace , options ) ;
747773
748774 if ( this . autoStart ) {
@@ -833,6 +859,7 @@ var FlipClock;
833859 var t = this ;
834860
835861 if ( ! t . running && ( ! t . countdown || t . countdown && t . time . time > 0 ) ) {
862+
836863 t . face . start ( t . time ) ;
837864 t . timer . start ( function ( ) {
838865 t . flip ( ) ;
@@ -1932,7 +1959,7 @@ var FlipClock;
19321959 time = time ? time : this . factory . time . getMilitaryTime ( ) ;
19331960
19341961 this . base ( time , doNotAddPlayClass ) ;
1935- } ,
1962+ }
19361963
19371964 /**
19381965 * Clear the excess digits from the tens columns for sec/min
@@ -1967,7 +1994,7 @@ var FlipClock;
19671994
19681995 FlipClock . CounterFace = FlipClock . Face . extend ( {
19691996
1970- autoStart : false ,
1997+ // autoStart: false,
19711998
19721999 minimumDigits : 2 ,
19732000
@@ -1979,9 +2006,9 @@ var FlipClock;
19792006 */
19802007
19812008 constructor : function ( factory , options ) {
1982- factory . timer . interval = 0 ;
1983- factory . autoStart = false ;
1984- factory . running = true ;
2009+ // factory.timer.interval = 0;
2010+ factory . autoStart = options . autoStart ? true : false ;
2011+ // factory.running = true;
19852012
19862013 factory . increment = function ( ) {
19872014 factory . countdown = false ;
@@ -2007,12 +2034,6 @@ var FlipClock;
20072034 this . base ( factory , options ) ;
20082035 } ,
20092036
2010- /**
2011- * Increments the time with each face flip
2012- */
2013-
2014- increment : function ( ) { } ,
2015-
20162037 /**
20172038 * Build the clock face
20182039 */
@@ -2050,6 +2071,10 @@ var FlipClock;
20502071 if ( ! time ) {
20512072 time = this . factory . getTime ( ) . digitize ( [ this . factory . getTime ( ) . time ] ) ;
20522073 }
2074+
2075+ if ( this . autoStart ) {
2076+ this . autoIncrement ( ) ;
2077+ }
20532078
20542079 this . base ( time , doNotAddPlayClass ) ;
20552080 } ,
@@ -2146,8 +2171,10 @@ var FlipClock;
21462171 time = this . factory . time . getDayCounter ( this . showSeconds ) ;
21472172 }
21482173
2174+ this . autoIncrement ( ) ;
2175+
21492176 this . base ( time , doNotAddPlayClass ) ;
2150- } ,
2177+ }
21512178
21522179 /**
21532180 * Clear the excess digits from the tens columns for sec/min
@@ -2241,9 +2268,12 @@ var FlipClock;
22412268 flip : function ( time , doNotAddPlayClass ) {
22422269 if ( ! time ) {
22432270 time = this . factory . time . getHourCounter ( ) ;
2244- }
2271+ }
2272+
2273+ this . autoIncrement ( ) ;
2274+
22452275 this . base ( time , doNotAddPlayClass ) ;
2246- } ,
2276+ }
22472277
22482278 /**
22492279 * Clear the excess digits from the tens columns for sec/min
@@ -2308,6 +2338,7 @@ var FlipClock;
23082338 if ( ! time ) {
23092339 time = this . factory . time . getMinuteCounter ( ) ;
23102340 }
2341+
23112342 this . base ( time , doNotAddPlayClass ) ;
23122343 }
23132344
@@ -2393,12 +2424,13 @@ var FlipClock;
23932424
23942425 _isPM : function ( ) {
23952426 return this . _getMeridium ( ) == 'PM' ? true : false ;
2396- } ,
2427+ }
23972428
23982429 /**
23992430 * Clear the excess digits from the tens columns for sec/min
24002431 */
24012432
2433+ /*
24022434 _clearExcessDigits: function() {
24032435 var tenSeconds = this.factory.lists[this.factory.lists.length - 2];
24042436 var tenMinutes = this.factory.lists[this.factory.lists.length - 4];
@@ -2408,6 +2440,7 @@ var FlipClock;
24082440 tenMinutes.$el.find('li:last-child').remove();
24092441 }
24102442 }
2443+ */
24112444
24122445 } ) ;
24132446
0 commit comments