|
19 | 19 | */ |
20 | 20 |
|
21 | 21 | constructor: function(factory, options) { |
22 | | - factory.countdown = false; |
23 | 22 | this.base(factory, options); |
24 | 23 | }, |
25 | 24 |
|
|
29 | 28 | * @param object Pass the time that should be used to display on the clock. |
30 | 29 | */ |
31 | 30 |
|
32 | | - build: function(time) { |
| 31 | + build: function() { |
33 | 32 | var t = this; |
34 | 33 | var children = this.factory.$el.find('ul'); |
35 | 34 |
|
36 | | - time = time ? time : (this.factory.time.time || this.factory.time.getMilitaryTime()); |
37 | | - |
| 35 | + if(!this.factory.time.time) { |
| 36 | + this.factory.original = new Date(); |
| 37 | + |
| 38 | + this.factory.time = new FlipClock.Time(this.factory, this.factory.original, { |
| 39 | + minimumDigits: this.factory.time.minimumDigits ? this.factory.time.minimumDigits : 0, |
| 40 | + animationRate: this.factory.time.animationRate ? this.factory.time.animationRate : 1000 |
| 41 | + }); |
| 42 | + } |
| 43 | + |
| 44 | + var time = this.factory.time.getMilitaryTime(); |
| 45 | + |
38 | 46 | if(time.length > children.length) { |
39 | 47 | $.each(time, function(i, digit) { |
40 | | - t.factory.lists.push(t.createList(digit)); |
| 48 | + t.createList(digit); |
41 | 49 | }); |
42 | 50 | } |
43 | 51 |
|
44 | | - this.dividers.push(this.createDivider()); |
45 | | - this.dividers.push(this.createDivider()); |
46 | | - |
47 | | - $(this.dividers[0]).insertBefore(this.factory.lists[this.factory.lists.length - 2].$el); |
48 | | - $(this.dividers[1]).insertBefore(this.factory.lists[this.factory.lists.length - 4].$el); |
49 | | - |
50 | | - // this._clearExcessDigits(); |
| 52 | + this.createDivider(); |
| 53 | + this.createDivider(); |
| 54 | + |
| 55 | + $(this.dividers[0]).insertBefore(this.lists[this.lists.length - 2].$el); |
| 56 | + $(this.dividers[1]).insertBefore(this.lists[this.lists.length - 4].$el); |
51 | 57 |
|
52 | | - if(this.autoStart) { |
53 | | - this.start(); |
54 | | - } |
| 58 | + this.base(); |
55 | 59 | }, |
56 | 60 |
|
57 | 61 | /** |
58 | 62 | * Flip the clock face |
59 | 63 | */ |
60 | 64 |
|
61 | 65 | flip: function(time, doNotAddPlayClass) { |
| 66 | + this.autoIncrement(); |
| 67 | + |
62 | 68 | time = time ? time : this.factory.time.getMilitaryTime(); |
63 | 69 |
|
64 | 70 | this.base(time, doNotAddPlayClass); |
65 | 71 | } |
66 | | - |
67 | | - /** |
68 | | - * Clear the excess digits from the tens columns for sec/min |
69 | | - */ |
70 | | - |
71 | | - /* |
72 | | - _clearExcessDigits: function() { |
73 | | - var tenSeconds = this.factory.lists[this.factory.lists.length - 2]; |
74 | | - var tenMinutes = this.factory.lists[this.factory.lists.length - 4]; |
75 | | - |
76 | | - for(var x = 6; x < 10; x++) { |
77 | | - tenSeconds.$el.find('li:last-child').remove(); |
78 | | - tenMinutes.$el.find('li:last-child').remove(); |
79 | | - } |
80 | | - } |
81 | | - */ |
82 | 72 |
|
83 | 73 | }); |
84 | 74 |
|
|
0 commit comments