|
12 | 12 |
|
13 | 13 | FlipClock.CounterFace = FlipClock.Face.extend({ |
14 | 14 |
|
15 | | - // autoStart: false, |
| 15 | + /** |
| 16 | + * Tells the counter clock face if it should auto-increment |
| 17 | + */ |
| 18 | + |
| 19 | + shouldAutoIncrement: false, |
| 20 | + |
| 21 | + /** |
| 22 | + * Minimum digits the clock face will show |
| 23 | + */ |
16 | 24 |
|
17 | 25 | minimumDigits: 2, |
18 | 26 |
|
|
24 | 32 | */ |
25 | 33 |
|
26 | 34 | constructor: function(factory, options) { |
27 | | - //factory.timer.interval = 0; |
28 | | - factory.autoStart = options.autoStart ? true : false; |
29 | | - //factory.running = true; |
| 35 | + |
| 36 | + if(typeof options != "object") { |
| 37 | + options = {}; |
| 38 | + } |
| 39 | + |
| 40 | + factory.autoStart = options.autoStart ? true : false; |
| 41 | + |
| 42 | + if(options.autoStart) { |
| 43 | + this.shouldAutoIncrement = true; |
| 44 | + } |
30 | 45 |
|
31 | 46 | factory.increment = function() { |
32 | 47 | factory.countdown = false; |
|
59 | 74 | build: function() { |
60 | 75 | var t = this; |
61 | 76 | var children = this.factory.$el.find('ul'); |
62 | | - var lists = []; |
63 | 77 | var time = this.factory.getTime().digitize([this.factory.getTime().time]); |
64 | 78 |
|
65 | 79 | if(time.length > children.length) { |
|
69 | 83 | }); |
70 | 84 |
|
71 | 85 | list.select(digit); |
72 | | - lists.push(list); |
73 | 86 | }); |
74 | 87 |
|
75 | 88 | } |
76 | 89 |
|
77 | | - $.each(lists, function(i, list) { |
| 90 | + $.each(this.lists, function(i, list) { |
78 | 91 | list.play(); |
79 | 92 | }); |
80 | 93 |
|
81 | | - this.factory.lists = lists; |
| 94 | + this.base(); |
82 | 95 | }, |
83 | 96 |
|
84 | 97 | /** |
85 | 98 | * Flip the clock face |
86 | 99 | */ |
87 | 100 |
|
88 | | - flip: function(time, doNotAddPlayClass) { |
| 101 | + flip: function(time, doNotAddPlayClass) { |
| 102 | + if(this.shouldAutoIncrement) { |
| 103 | + this.autoIncrement(); |
| 104 | + } |
| 105 | + |
89 | 106 | if(!time) { |
90 | 107 | time = this.factory.getTime().digitize([this.factory.getTime().time]); |
91 | 108 | } |
92 | 109 |
|
93 | | - if(this.autoStart) { |
94 | | - this.autoIncrement(); |
95 | | - } |
96 | | - |
97 | 110 | this.base(time, doNotAddPlayClass); |
98 | 111 | }, |
99 | 112 |
|
|
0 commit comments