@@ -448,7 +448,10 @@ var FlipClock;
448448 reset : function ( ) {
449449 this . factory . time = new FlipClock . Time (
450450 this . factor ,
451- this . factory . original ? Math . round ( this . factory . original ) : 0
451+ this . factory . original ? Math . round ( this . factory . original ) : 0 ,
452+ {
453+ minimumDigits : this . factory . minimumDigits
454+ }
452455 ) ;
453456
454457 this . flip ( this . factory . original , false ) ;
@@ -578,6 +581,16 @@ var FlipClock;
578581
579582 FlipClock . Factory = FlipClock . Base . extend ( {
580583
584+ /**
585+ * The clock's animation rate.
586+ *
587+ * Note, currently this property doesn't do anything.
588+ * This property is here to be used in the future to
589+ * programmaticaly set the clock's animation speed
590+ */
591+
592+ animationRate : 1000 ,
593+
581594 /**
582595 * Auto start the clock on page load (True|False)
583596 */
@@ -639,29 +652,41 @@ var FlipClock;
639652 defaultLanguage : 'english' ,
640653
641654 /**
642- * The language being used to display labels (string)
655+ * The jQuery object
656+ */
657+
658+ $el : false ,
659+
660+ /**
661+ * The FlipClock.Face object
643662 */
644663
645- language : 'english' ,
664+ face : true ,
646665
647666 /**
648667 * The language object after it has been loaded
649668 */
650669
651670 lang : false ,
652671
672+ /**
673+ * The language being used to display labels (string)
674+ */
675+
676+ language : 'english' ,
677+
678+ /**
679+ * The minimum digits the clock must have
680+ */
681+
682+ minimumDigits : 0 ,
683+
653684 /**
654685 * The original starting value of the clock. Used for the reset method.
655686 */
656687
657688 original : false ,
658689
659- /**
660- * The FlipClock.Face object
661- */
662-
663- face : true ,
664-
665690 /**
666691 * Is the clock running? (True|False)
667692 */
@@ -680,18 +705,6 @@ var FlipClock;
680705
681706 timer : false ,
682707
683- /**
684- * An array of FlipClock.List objects
685- */
686-
687- lists : [ ] ,
688-
689- /**
690- * The jQuery object
691- */
692-
693- $el : false ,
694-
695708 /**
696709 * The jQuery object (depcrecated)
697710 */
@@ -724,8 +737,8 @@ var FlipClock;
724737 this . original = ( digit instanceof Date ) ? digit : ( digit ? Math . round ( digit ) : 0 ) ;
725738
726739 this . time = new FlipClock . Time ( this , this . original , {
727- minimumDigits : options . minimumDigits ? options . minimumDigits : 0 ,
728- animationRate : options . animationRate ? options . animationRate : 1000
740+ minimumDigits : this . minimumDigits ,
741+ animationRate : this . animationRate
729742 } ) ;
730743
731744 this . timer = new FlipClock . Timer ( this , options ) ;
@@ -737,6 +750,7 @@ var FlipClock;
737750 if ( this . autoStart ) {
738751 this . start ( ) ;
739752 }
753+
740754 } ,
741755
742756 /**
@@ -758,7 +772,7 @@ var FlipClock;
758772
759773 this . $el . html ( '' ) ;
760774
761- this . time . minimumDigits = 0 ;
775+ this . time . minimumDigits = this . minimumDigits ;
762776
763777 if ( FlipClock [ name ] ) {
764778 face = new FlipClock [ name ] ( this , options ) ;
@@ -993,7 +1007,7 @@ var FlipClock;
9931007 */
9941008
9951009 lastDigit : 0 ,
996-
1010+
9971011 /**
9981012 * Constructor
9991013 *
@@ -1002,8 +1016,6 @@ var FlipClock;
10021016 * @param object An object to override the default properties
10031017 */
10041018
1005- minimumDigits : 0 ,
1006-
10071019 constructor : function ( factory , digit , options ) {
10081020 this . factory = factory ;
10091021 this . digit = digit ;
@@ -1045,38 +1057,7 @@ var FlipClock;
10451057 $delete . remove ( ) ;
10461058
10471059 this . lastDigit = this . digit ;
1048- }
1049-
1050- /*
1051- var prevDigit = this.digit == 0 ? 9 : this.digit - 1;
1052- var nextDigit = this.digit == 9 ? 0 : this.digit + 1;
1053-
1054- this.setBeforeValue(prevDigit);
1055- this.setActiveValue(this.digit);
1056-
1057- var target = this.$el.find('[data-digit="'+digit+'"]');
1058- var active = this.$el.find('.'+this.classes.active).removeClass(this.classes.active);
1059- var before = this.$el.find('.'+this.classes.before).removeClass(this.classes.before);
1060-
1061- if(!this.factory.countdown) {
1062- if(target.is(':first-child')) {
1063- this.$el.find(':last-child').addClass(this.classes.before);
1064- }
1065- else {
1066- target.prev().addClass(this.classes.before);
1067- }
1068- }
1069- else {
1070- if(target.is(':last-child')) {
1071- this.$el.find(':first-child').addClass(this.classes.before);
1072- }
1073- else {
1074- target.next().addClass(this.classes.before);
1075- }
1076- }
1077-
1078- target.addClass(this.classes.active);
1079- */
1060+ }
10801061 } ,
10811062
10821063 /**
@@ -1099,6 +1080,10 @@ var FlipClock;
10991080 } , this . factory . timer . interval ) ;
11001081 } ,
11011082
1083+ /**
1084+ * Creates the list item HTML and returns as a string
1085+ */
1086+
11021087 createListItem : function ( css , value ) {
11031088 return [
11041089 '<li class="' + ( css ? css : '' ) + '">' ,
@@ -1116,6 +1101,10 @@ var FlipClock;
11161101 ] . join ( '' ) ;
11171102 } ,
11181103
1104+ /**
1105+ * Append the list item to the parent DOM node
1106+ */
1107+
11191108 appendListItem : function ( css , value ) {
11201109 var html = this . createListItem ( css , value ) ;
11211110
@@ -1240,7 +1229,7 @@ var FlipClock;
12401229 factory : false ,
12411230
12421231 /**
1243- * The minimum number of digits the clock face will have
1232+ * The minimum number of digits the clock face must have
12441233 */
12451234
12461235 minimumDigits : 0 ,
@@ -1254,6 +1243,14 @@ var FlipClock;
12541243 */
12551244
12561245 constructor : function ( factory , time , options ) {
1246+ if ( typeof options != "object" ) {
1247+ options = { } ;
1248+ }
1249+
1250+ if ( ! options . minimumDigits ) {
1251+ options . minimumDigits = factory . minimumDigits ;
1252+ }
1253+
12571254 this . base ( options ) ;
12581255 this . factory = factory ;
12591256
@@ -1262,14 +1259,6 @@ var FlipClock;
12621259 }
12631260 } ,
12641261
1265- getDateObject : function ( ) {
1266- if ( this . time instanceof Date ) {
1267- return this . time ;
1268- }
1269-
1270- return new Date ( this . getTimeSeconds ( ) ) ;
1271- } ,
1272-
12731262 /**
12741263 * Convert a string or integer to an array of digits
12751264 *
@@ -1346,7 +1335,21 @@ var FlipClock;
13461335 } ,
13471336
13481337 /**
1349- * Gets a daily breakdown
1338+ * Gets a new Date object for the current time
1339+ *
1340+ * @return array Returns a Date object
1341+ */
1342+
1343+ getDateObject : function ( ) {
1344+ if ( this . time instanceof Date ) {
1345+ return this . time ;
1346+ }
1347+
1348+ return new Date ( this . getTimeSeconds ( ) ) ;
1349+ } ,
1350+
1351+ /**
1352+ * Gets a digitized daily counter
13501353 *
13511354 * @return object Returns a digitized object
13521355 */
@@ -1497,28 +1500,6 @@ var FlipClock;
14971500 }
14981501 } ,
14991502
1500- /**
1501- * Gets number of seconds
1502- *
1503- * @param bool Should perform a modulus? If not sent, then no.
1504- * @return int Retuns a ceiled integer
1505- */
1506-
1507- getSeconds : function ( mod ) {
1508- var seconds = this . getTimeSeconds ( ) ;
1509-
1510- if ( mod ) {
1511- if ( seconds == 60 ) {
1512- seconds = 0 ;
1513- }
1514- else {
1515- seconds = seconds % 60 ;
1516- }
1517- }
1518-
1519- return Math . ceil ( seconds ) ;
1520- } ,
1521-
15221503 /**
15231504 * Gets the current twelve hour time
15241505 *
@@ -1541,14 +1522,36 @@ var FlipClock;
15411522 return obj ;
15421523 } ,
15431524
1525+ /**
1526+ * Gets number of seconds
1527+ *
1528+ * @param bool Should perform a modulus? If not sent, then no.
1529+ * @return int Retuns a ceiled integer
1530+ */
1531+
1532+ getSeconds : function ( mod ) {
1533+ var seconds = this . getTimeSeconds ( ) ;
1534+
1535+ if ( mod ) {
1536+ if ( seconds == 60 ) {
1537+ seconds = 0 ;
1538+ }
1539+ else {
1540+ seconds = seconds % 60 ;
1541+ }
1542+ }
1543+
1544+ return Math . ceil ( seconds ) ;
1545+ } ,
1546+
15441547 /**
15451548 * Gets number of weeks
15461549 *
15471550 * @param bool Should perform a modulus? If not sent, then no.
15481551 * @return int Retuns a floored integer
15491552 */
15501553
1551- getWeeks : function ( ) {
1554+ getWeeks : function ( mod ) {
15521555 var weeks = this . getTimeSeconds ( ) / 60 / 60 / 24 / 7 ;
15531556
15541557 if ( mod ) {
@@ -1705,7 +1708,7 @@ var FlipClock;
17051708 interval : 1000 ,
17061709
17071710 /**
1708- * The rate of the animation in milliseconds
1711+ * The rate of the animation in milliseconds (not currently in use)
17091712 */
17101713
17111714 animationRate : 1000 ,
@@ -1890,10 +1893,7 @@ var FlipClock;
18901893 if ( ! this . factory . time . time ) {
18911894 this . factory . original = new Date ( ) ;
18921895
1893- this . factory . time = new FlipClock . Time ( this . factory , this . factory . original , {
1894- minimumDigits : this . factory . time . minimumDigits ? this . factory . time . minimumDigits : 0 ,
1895- animationRate : this . factory . time . animationRate ? this . factory . time . animationRate : 1000
1896- } ) ;
1896+ this . factory . time = new FlipClock . Time ( this . factory , this . factory . original ) ;
18971897 }
18981898
18991899 var time = this . factory . time . getMilitaryTime ( ) ;
@@ -1948,12 +1948,6 @@ var FlipClock;
19481948
19491949 shouldAutoIncrement : false ,
19501950
1951- /**
1952- * Minimum digits the clock face will show
1953- */
1954-
1955- minimumDigits : 2 ,
1956-
19571951 /**
19581952 * Constructor
19591953 *
@@ -2008,9 +2002,7 @@ var FlipClock;
20082002
20092003 if ( time . length > children . length ) {
20102004 $ . each ( time , function ( i , digit ) {
2011- var list = t . createList ( digit , {
2012- minimumDigits : t . minimumDigits
2013- } ) ;
2005+ var list = t . createList ( digit ) ;
20142006
20152007 list . select ( digit ) ;
20162008 } ) ;
@@ -2046,7 +2038,7 @@ var FlipClock;
20462038
20472039 reset : function ( ) {
20482040 this . factory . time = new FlipClock . Time (
2049- this . factor ,
2041+ this . factory ,
20502042 this . factory . original ? Math . round ( this . factory . original ) : 0
20512043 ) ;
20522044
0 commit comments