timepiece 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/timepiece.js +346 -344
- data/lib/timepiece/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a37bf25526114eabdd9bb6b6e1c908f638ed38c
|
4
|
+
data.tar.gz: 602b85542bd34b8cf8df335174ec67318f64e346
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b25392445fbdb28953eb96c7736126ddb212aaec2e929b91abb1175b5be3cc3b936e172f0d6e58d7ebd41a2c4a52973c6d59ffb3d3b4b2aacdb73fcf8626645
|
7
|
+
data.tar.gz: 2c3f2bb8bccadb4b054a0adab7e773ea4dade88092a4b6b6cc347664e234d9947350924628a92b10fb2378f968a664e9cc8ca3faaf7e510228df0c51a4b3a78e
|
@@ -1,389 +1,391 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
(function($){
|
2
|
+
get_analog_hours = []
|
3
|
+
get_analog_minutes = []
|
4
|
+
get_analog_seconds = []
|
4
5
|
|
5
|
-
function get_analog(){
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
}
|
6
|
+
function get_analog(){
|
7
|
+
var zones = []
|
8
|
+
$(".timepiece-analog").each(function(){ zones.push($(this).attr('data-timezone')) })
|
9
|
+
var timezones = { 'timezones' : zones }
|
10
|
+
$.ajax({ type: "POST", url: "/timepiece/clock.json", data: timezones, dataType: "json", cache: false }).success(function(time){
|
11
|
+
for(var i = 0; i < time.length; i++){
|
12
|
+
get_analog_hours.push(parseInt(time[i].hours,10))
|
13
|
+
get_analog_minutes.push(parseInt(time[i].minutes,10))
|
14
|
+
get_analog_seconds.push(parseInt(time[i].seconds,10))
|
15
|
+
}
|
16
|
+
analog_hours = get_analog_hours
|
17
|
+
analog_minutes = get_analog_minutes
|
18
|
+
analog_seconds = get_analog_seconds
|
19
|
+
});
|
20
|
+
}
|
20
21
|
|
21
|
-
function show_analog(){
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
} else {
|
28
|
-
analog_seconds[i] = 0
|
29
|
-
if (analog_minutes[i] < 59){
|
30
|
-
analog_minutes[i] += 1
|
22
|
+
function show_analog(){
|
23
|
+
analog = setInterval(function(){
|
24
|
+
analog_running = true;
|
25
|
+
for(i = 0; i < analog_hours.length; i++){
|
26
|
+
if (analog_seconds[i] < 59){
|
27
|
+
analog_seconds[i] += 1
|
31
28
|
} else {
|
32
|
-
|
33
|
-
if (
|
34
|
-
|
29
|
+
analog_seconds[i] = 0
|
30
|
+
if (analog_minutes[i] < 59){
|
31
|
+
analog_minutes[i] += 1
|
35
32
|
} else {
|
36
|
-
|
33
|
+
analog_minutes[i] = 0
|
34
|
+
if (analog_hours[i] < 23){
|
35
|
+
analog_hours[i] += 1
|
36
|
+
} else {
|
37
|
+
analog_hours[i] = 0
|
38
|
+
}
|
37
39
|
}
|
38
40
|
}
|
39
41
|
}
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
$(e).removeClass('timepiece-analog-day')
|
48
|
-
}
|
49
|
-
$(e).html(function(){
|
50
|
-
if(analog_hours[i] > 12){
|
51
|
-
$(e).data('analog_hours', analog_hours[i] - 12)
|
52
|
-
}else if(analog_hours[i] == 0){
|
53
|
-
$(e).data('analog_hours', 12)
|
54
|
-
}else if(analog_hours[i] == 12){
|
55
|
-
$(e).data('analog_hours', 12)
|
56
|
-
}else if(analog_hours[i] < 12){
|
57
|
-
$(e).data('analog_hours', analog_hours[i])
|
42
|
+
$(".timepiece-analog").each(function(i, e){
|
43
|
+
if(analog_hours[i] >= 6 && analog_hours[i] < 18){
|
44
|
+
$(e).addClass('timepiece-analog-day')
|
45
|
+
$(e).removeClass('timepiece-analog-night')
|
46
|
+
}else{
|
47
|
+
$(e).addClass('timepiece-analog-night')
|
48
|
+
$(e).removeClass('timepiece-analog-day')
|
58
49
|
}
|
59
|
-
$(e).
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
50
|
+
$(e).html(function(){
|
51
|
+
if(analog_hours[i] > 12){
|
52
|
+
$(e).data('analog_hours', analog_hours[i] - 12)
|
53
|
+
}else if(analog_hours[i] == 0){
|
54
|
+
$(e).data('analog_hours', 12)
|
55
|
+
}else if(analog_hours[i] == 12){
|
56
|
+
$(e).data('analog_hours', 12)
|
57
|
+
}else if(analog_hours[i] < 12){
|
58
|
+
$(e).data('analog_hours', analog_hours[i])
|
59
|
+
}
|
60
|
+
$(e).data('hours_angle', ($(e).data('analog_hours') * 30) + (analog_minutes[i] / 2));
|
61
|
+
$(e).data('minutes_angle', analog_minutes[i] * 6);
|
62
|
+
$(e).data('seconds_angle', analog_seconds[i] * 6);
|
63
|
+
$('.timepiece-hours-container', $(e)).css({'-ms-transform':'rotateZ(' + $(e).data('hours_angle') + 'deg)','-webkit-transform':'rotateZ(' + $(e).data('hours_angle') + 'deg)','transform':'rotateZ(' + $(e).data('hours_angle') + 'deg)'}); // angle set on each
|
64
|
+
$('.timepiece-minutes-container', $(e)).css({'-ms-transform':'rotateZ(' + $(e).data('minutes_angle') + 'deg)','-webkit-transform':'rotateZ(' + $(e).data('minutes_angle') + 'deg)','transform':'rotateZ(' + $(e).data('minutes_angle') + 'deg)'});
|
65
|
+
$('.timepiece-seconds-container', $(e)).css({'-ms-transform':'rotateZ(' + $(e).data('seconds_angle') + 'deg)','-webkit-transform':'rotateZ(' + $(e).data('seconds_angle') + 'deg)','transform':'rotateZ(' + $(e).data('seconds_angle') + 'deg)'});
|
66
|
+
})
|
65
67
|
})
|
66
|
-
})
|
67
|
-
}
|
68
|
-
}
|
68
|
+
}, 1000)
|
69
|
+
}
|
69
70
|
|
70
|
-
get_hours = []
|
71
|
-
get_minutes = []
|
72
|
-
get_seconds = []
|
71
|
+
get_hours = []
|
72
|
+
get_minutes = []
|
73
|
+
get_seconds = []
|
73
74
|
|
74
|
-
function get_time(){
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
}
|
75
|
+
function get_time(){
|
76
|
+
var zones = []
|
77
|
+
$(".timepiece").each(function(){ zones.push($(this).attr('data-timezone')) })
|
78
|
+
var timezones = { 'timezones' : zones }
|
79
|
+
$.ajax({ type: "POST", url: "/timepiece/clock.json", data: timezones, dataType: "json", cache: false }).success(function(time){
|
80
|
+
for(var i = 0; i < time.length; i++){
|
81
|
+
get_hours.push(parseInt(time[i].hours,10))
|
82
|
+
get_minutes.push(parseInt(time[i].minutes,10))
|
83
|
+
get_seconds.push(parseInt(time[i].seconds,10))
|
84
|
+
}
|
85
|
+
hours = get_hours
|
86
|
+
minutes = get_minutes
|
87
|
+
seconds = get_seconds
|
88
|
+
});
|
89
|
+
}
|
89
90
|
|
90
|
-
function show_time(){
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
}
|
91
|
+
function show_time(){
|
92
|
+
clock = setInterval(function(){
|
93
|
+
clock_running = true;
|
94
|
+
for(i = 0; i < hours.length; i++){
|
95
|
+
if (seconds[i] < 59){
|
96
|
+
seconds[i] += 1
|
97
|
+
} else {
|
98
|
+
seconds[i] = 0
|
99
|
+
if (minutes[i] < 59){
|
100
|
+
minutes[i] += 1
|
101
|
+
} else {
|
102
|
+
minutes[i] = 0
|
103
|
+
if (hours[i] < 23){
|
104
|
+
hours[i] += 1
|
105
|
+
} else {
|
106
|
+
hours[i] = 0
|
107
|
+
}
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
$(".timepiece").each(function(i, e){
|
112
|
+
$(e).html(function(){
|
113
|
+
if($(e).attr("data-tptype") == '12'){
|
114
|
+
if(hours[i] > 12){
|
115
|
+
$(e).data('hours', hours[i] - 12)
|
116
|
+
abbr = 'pm'
|
117
|
+
}else if(hours[i] == 0){
|
118
|
+
$(e).data('hours', 12)
|
119
|
+
abbr = 'am'
|
120
|
+
}else if(hours[i] == 12){
|
121
|
+
$(e).data('hours', 12)
|
122
|
+
abbr = 'pm'
|
123
|
+
}else if(hours[i] < 12){
|
124
|
+
$(e).data('hours', hours[i])
|
125
|
+
abbr = 'am'
|
126
|
+
}
|
127
|
+
if($(e).attr("data-abbr_separator") == '.'){
|
128
|
+
abbr = abbr.replace(/([apm])/g, '$1.')
|
129
|
+
}
|
130
|
+
if($(e).attr("data-lead") == '0' || $(e).attr("data-lead") == 'zero' ){
|
131
|
+
$('.timepiece-hours', $(e)).html(( $(e).data('hours') < 10 ? "0" : "" ) + $(e).data('hours'));
|
132
|
+
}else if($(e).attr("data-lead") == '_' || $(e).attr("data-lead") == 'space' ){
|
133
|
+
$('.timepiece-hours', $(e)).html(( $(e).data('hours') < 10 ? " " : "" ) + $(e).data('hours'));
|
134
|
+
}else{
|
135
|
+
$('.timepiece-hours', $(e)).html($(e).data('hours'));
|
136
|
+
}
|
137
|
+
$('.timepiece-minutes', $(e)).html(( minutes[i] < 10 ? "0" : "" ) + minutes[i]);
|
138
|
+
$('.timepiece-seconds', $(e)).html(( seconds[i] < 10 ? "0" : "" ) + seconds[i]);
|
139
|
+
$('.timepiece-abbr', $(e)).html(abbr);
|
140
|
+
if(abbr == 'am'){
|
141
|
+
$('.timepiece-abbr', $(e)).removeClass('timepiece-abbr-pm');
|
142
|
+
$('.timepiece-abbr', $(e)).addClass('timepiece-abbr-am');
|
143
|
+
} else {
|
144
|
+
$('.timepiece-abbr', $(e)).removeClass('timepiece-abbr-am');
|
145
|
+
$('.timepiece-abbr', $(e)).addClass('timepiece-abbr-pm');
|
146
|
+
}
|
147
|
+
}else{
|
148
|
+
$('.timepiece-hours', $(e)).html(( hours[i] < 10 ? "0" : "" ) + hours[i]);
|
149
|
+
$('.timepiece-minutes', $(e)).html(( minutes[i] < 10 ? "0" : "" ) + minutes[i]);
|
150
|
+
$('.timepiece-seconds', $(e)).html(( seconds[i] < 10 ? "0" : "" ) + seconds[i]);
|
151
|
+
}
|
152
|
+
})
|
153
|
+
})
|
154
|
+
}, 1000)
|
155
|
+
}
|
155
156
|
|
156
|
-
get_timer_days = []
|
157
|
-
get_timer_hours = []
|
158
|
-
get_timer_minutes = []
|
159
|
-
get_timer_seconds = []
|
157
|
+
get_timer_days = []
|
158
|
+
get_timer_hours = []
|
159
|
+
get_timer_minutes = []
|
160
|
+
get_timer_seconds = []
|
160
161
|
|
161
|
-
function set_timer(){
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
}
|
162
|
+
function set_timer(){
|
163
|
+
$(".timepiece-timer").each(function(){
|
164
|
+
get_timer_days.push(parseInt($(this).attr('data-days'),10))
|
165
|
+
get_timer_hours.push(parseInt($(this).attr('data-hours'),10))
|
166
|
+
get_timer_minutes.push(parseInt($(this).attr('data-minutes'),10))
|
167
|
+
get_timer_seconds.push(parseInt($(this).attr('data-seconds'),10))
|
168
|
+
timer_days = get_timer_days
|
169
|
+
timer_hours = get_timer_hours
|
170
|
+
timer_minutes = get_timer_minutes
|
171
|
+
timer_seconds = get_timer_seconds
|
172
|
+
});
|
173
|
+
}
|
173
174
|
|
174
|
-
function show_timer(){
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
} else {
|
181
|
-
timer_seconds[i] = 0
|
182
|
-
if (timer_minutes[i] < 59){
|
183
|
-
timer_minutes[i] += 1
|
175
|
+
function show_timer(){
|
176
|
+
timer = setInterval(function(){
|
177
|
+
timer_running = true;
|
178
|
+
for(i = 0; i < timer_hours.length; i++){
|
179
|
+
if (timer_seconds[i] < 59){
|
180
|
+
timer_seconds[i] += 1
|
184
181
|
} else {
|
185
|
-
|
186
|
-
if (
|
187
|
-
|
182
|
+
timer_seconds[i] = 0
|
183
|
+
if (timer_minutes[i] < 59){
|
184
|
+
timer_minutes[i] += 1
|
188
185
|
} else {
|
189
|
-
|
190
|
-
|
186
|
+
timer_minutes[i] = 0
|
187
|
+
if (timer_hours[i] < 23){
|
188
|
+
timer_hours[i] += 1
|
189
|
+
} else {
|
190
|
+
timer_hours[i] = 0
|
191
|
+
timer_days[i] += 1
|
192
|
+
}
|
191
193
|
}
|
192
194
|
}
|
193
195
|
}
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
}
|
196
|
+
$(".timepiece-timer").each(function(i, e){
|
197
|
+
$(e).html(function(){
|
198
|
+
$('.timepiece-days', $(e)).html(timer_days[i]);
|
199
|
+
if (timer_days[i] == 1){
|
200
|
+
$('.tp-descriptor-days', $(e)).html(' day ');
|
201
|
+
} else {
|
202
|
+
$('.tp-descriptor-days', $(e)).html(' days ');
|
203
|
+
}
|
204
|
+
$('.timepiece-hours', $(e)).html(timer_hours[i]);
|
205
|
+
if (timer_hours[i] == 1){
|
206
|
+
$('.tp-descriptor-hours', $(e)).html(' hour ');
|
207
|
+
} else {
|
208
|
+
$('.tp-descriptor-hours', $(e)).html(' hours ');
|
209
|
+
}
|
210
|
+
$('.timepiece-minutes', $(e)).html(timer_minutes[i]);
|
211
|
+
if (timer_minutes[i] == 1){
|
212
|
+
$('.tp-descriptor-minutes', $(e)).html(' minute ');
|
213
|
+
} else {
|
214
|
+
$('.tp-descriptor-minutes', $(e)).html(' minutes ');
|
215
|
+
}
|
216
|
+
$('.timepiece-seconds', $(e)).html(timer_seconds[i]);
|
217
|
+
if (timer_seconds[i] == 1){
|
218
|
+
$('.tp-descriptor-seconds', $(e)).html(' second ');
|
219
|
+
} else {
|
220
|
+
$('.tp-descriptor-seconds', $(e)).html(' seconds ');
|
221
|
+
}
|
222
|
+
})
|
221
223
|
})
|
222
|
-
})
|
223
|
-
}
|
224
|
-
}
|
224
|
+
}, 1000)
|
225
|
+
}
|
225
226
|
|
226
|
-
get_countdown_days = []
|
227
|
-
get_countdown_hours = []
|
228
|
-
get_countdown_minutes = []
|
229
|
-
get_countdown_seconds = []
|
227
|
+
get_countdown_days = []
|
228
|
+
get_countdown_hours = []
|
229
|
+
get_countdown_minutes = []
|
230
|
+
get_countdown_seconds = []
|
230
231
|
|
231
|
-
function set_countdown(){
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
}
|
232
|
+
function set_countdown(){
|
233
|
+
$(".timepiece-countdown").each(function(){
|
234
|
+
get_countdown_days.push(parseInt($(this).attr('data-days'),10))
|
235
|
+
get_countdown_hours.push(parseInt($(this).attr('data-hours'),10))
|
236
|
+
get_countdown_minutes.push(parseInt($(this).attr('data-minutes'),10))
|
237
|
+
get_countdown_seconds.push(parseInt($(this).attr('data-seconds'),10))
|
238
|
+
countdown_days = get_countdown_days
|
239
|
+
countdown_hours = get_countdown_hours
|
240
|
+
countdown_minutes = get_countdown_minutes
|
241
|
+
countdown_seconds = get_countdown_seconds
|
242
|
+
});
|
243
|
+
}
|
243
244
|
|
244
|
-
function show_countdown(){
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
} else {
|
251
|
-
countdown_seconds[i] = 59
|
252
|
-
if (countdown_minutes[i] > 0){
|
253
|
-
countdown_minutes[i] -= 1
|
245
|
+
function show_countdown(){
|
246
|
+
countdown = setInterval(function(){
|
247
|
+
countdown_running = true;
|
248
|
+
for(i = 0; i < countdown_hours.length; i++){
|
249
|
+
if (countdown_seconds[i] > 0){
|
250
|
+
countdown_seconds[i] -= 1
|
254
251
|
} else {
|
255
|
-
|
256
|
-
if (
|
257
|
-
|
252
|
+
countdown_seconds[i] = 59
|
253
|
+
if (countdown_minutes[i] > 0){
|
254
|
+
countdown_minutes[i] -= 1
|
258
255
|
} else {
|
259
|
-
|
260
|
-
if (
|
261
|
-
|
256
|
+
countdown_minutes[i] = 59
|
257
|
+
if (countdown_hours[i] > 0){
|
258
|
+
countdown_hours[i] -= 1
|
262
259
|
} else {
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
260
|
+
countdown_hours[i] = 23
|
261
|
+
if (countdown_days[i] > 0){
|
262
|
+
countdown_days[i] -= 1
|
263
|
+
} else {
|
264
|
+
countdown_days[i] = 0
|
265
|
+
countdown_hours[i] = 0
|
266
|
+
countdown_minutes[i] = 0
|
267
|
+
countdown_seconds[i] = 0
|
268
|
+
}
|
267
269
|
}
|
268
270
|
}
|
269
271
|
}
|
270
272
|
}
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
}
|
273
|
+
$(".timepiece-countdown").each(function(i, e){
|
274
|
+
$(e).html(function(){
|
275
|
+
$('.timepiece-days', $(e)).html(countdown_days[i]);
|
276
|
+
if (countdown_days[i] == 1){
|
277
|
+
$('.tp-descriptor-days', $(e)).html(' day ');
|
278
|
+
} else {
|
279
|
+
$('.tp-descriptor-days', $(e)).html(' days ');
|
280
|
+
}
|
281
|
+
$('.timepiece-hours', $(e)).html(countdown_hours[i]);
|
282
|
+
if (countdown_hours[i] == 1){
|
283
|
+
$('.tp-descriptor-hours', $(e)).html(' hour ');
|
284
|
+
} else {
|
285
|
+
$('.tp-descriptor-hours', $(e)).html(' hours ');
|
286
|
+
}
|
287
|
+
$('.timepiece-minutes', $(e)).html(countdown_minutes[i]);
|
288
|
+
if (countdown_minutes[i] == 1){
|
289
|
+
$('.tp-descriptor-minutes', $(e)).html(' minute ');
|
290
|
+
} else {
|
291
|
+
$('.tp-descriptor-minutes', $(e)).html(' minutes ');
|
292
|
+
}
|
293
|
+
$('.timepiece-seconds', $(e)).html(countdown_seconds[i]);
|
294
|
+
if (countdown_seconds[i] == 1){
|
295
|
+
$('.tp-descriptor-seconds', $(e)).html(' second ');
|
296
|
+
} else {
|
297
|
+
$('.tp-descriptor-seconds', $(e)).html(' seconds ');
|
298
|
+
}
|
299
|
+
})
|
298
300
|
})
|
299
|
-
})
|
300
|
-
}
|
301
|
-
}
|
302
|
-
|
303
|
-
function reset_analog(){
|
304
|
-
get_analog_hours = []
|
305
|
-
get_analog_minutes = []
|
306
|
-
get_analog_seconds = []
|
307
|
-
get_analog()
|
308
|
-
}
|
309
|
-
|
310
|
-
function reset_time(){
|
311
|
-
get_hours = []
|
312
|
-
get_minutes = []
|
313
|
-
get_seconds = []
|
314
|
-
get_time()
|
315
|
-
}
|
316
|
-
|
317
|
-
function reset_timer(){
|
318
|
-
get_timer_days = []
|
319
|
-
get_timer_hours = []
|
320
|
-
get_timer_minutes = []
|
321
|
-
get_timer_seconds = []
|
322
|
-
set_timer()
|
323
|
-
}
|
324
|
-
|
325
|
-
function reset_countdown(){
|
326
|
-
get_countdown_days = []
|
327
|
-
get_countdown_hours = []
|
328
|
-
get_countdown_minutes = []
|
329
|
-
get_countdown_seconds = []
|
330
|
-
set_countdown()
|
331
|
-
}
|
332
|
-
|
333
|
-
/* Let's discuss when those functions will be performed. */
|
301
|
+
}, 1000)
|
302
|
+
}
|
334
303
|
|
335
|
-
|
336
|
-
|
337
|
-
|
304
|
+
function reset_analog(){
|
305
|
+
get_analog_hours = []
|
306
|
+
get_analog_minutes = []
|
307
|
+
get_analog_seconds = []
|
338
308
|
get_analog()
|
339
|
-
show_analog()
|
340
309
|
}
|
341
|
-
|
342
|
-
|
343
|
-
|
310
|
+
|
311
|
+
function reset_time(){
|
312
|
+
get_hours = []
|
313
|
+
get_minutes = []
|
314
|
+
get_seconds = []
|
315
|
+
get_time()
|
344
316
|
}
|
345
|
-
|
317
|
+
|
318
|
+
function reset_timer(){
|
319
|
+
get_timer_days = []
|
320
|
+
get_timer_hours = []
|
321
|
+
get_timer_minutes = []
|
322
|
+
get_timer_seconds = []
|
346
323
|
set_timer()
|
347
|
-
show_timer()
|
348
324
|
}
|
349
|
-
|
325
|
+
|
326
|
+
function reset_countdown(){
|
327
|
+
get_countdown_days = []
|
328
|
+
get_countdown_hours = []
|
329
|
+
get_countdown_minutes = []
|
330
|
+
get_countdown_seconds = []
|
350
331
|
set_countdown()
|
351
|
-
show_countdown()
|
352
332
|
}
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
333
|
+
|
334
|
+
/* Let's discuss when those functions will be performed. */
|
335
|
+
|
336
|
+
$(document).ready(function(){
|
337
|
+
// Might want to reformat to move if-statement : should also be performed before 'reset_time' so as not to make a blank AJAX request.
|
338
|
+
if ($(".timepiece-analog").length > 0){
|
339
|
+
get_analog()
|
340
|
+
show_analog()
|
358
341
|
}
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
if (clock_running){
|
363
|
-
clearInterval(clock);
|
342
|
+
if ($(".timepiece").length > 0){
|
343
|
+
get_time()
|
344
|
+
show_time()
|
364
345
|
}
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
if (timer_running){
|
369
|
-
clearInterval(timer);
|
346
|
+
if ($(".timepiece-timer").length > 0){
|
347
|
+
set_timer()
|
348
|
+
show_timer()
|
370
349
|
}
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
if ($(".timepiece-countdown").length > 0){
|
375
|
-
if (countdown_running){
|
376
|
-
clearInterval(countdown);
|
350
|
+
if ($(".timepiece-countdown").length > 0){
|
351
|
+
set_countdown()
|
352
|
+
show_countdown()
|
377
353
|
}
|
378
|
-
|
379
|
-
|
380
|
-
|
354
|
+
})
|
355
|
+
$(document).on('page:load', function(){
|
356
|
+
if ($(".timepiece-analog").length > 0){
|
357
|
+
if (analog_running){
|
358
|
+
clearInterval(analog);
|
359
|
+
}
|
360
|
+
reset_analog();
|
361
|
+
}
|
362
|
+
if ($(".timepiece").length > 0){
|
363
|
+
if (clock_running){
|
364
|
+
clearInterval(clock);
|
365
|
+
}
|
366
|
+
reset_time();
|
367
|
+
}
|
368
|
+
if ($(".timepiece-timer").length > 0){
|
369
|
+
if (timer_running){
|
370
|
+
clearInterval(timer);
|
371
|
+
}
|
372
|
+
reset_timer();
|
373
|
+
// FIXME: Some code may be superfluous. We've fixed the interval glitch but we should investigate when $(document).ready is running. How much do we really need our reset functions?
|
374
|
+
}
|
375
|
+
if ($(".timepiece-countdown").length > 0){
|
376
|
+
if (countdown_running){
|
377
|
+
clearInterval(countdown);
|
378
|
+
}
|
379
|
+
reset_countdown();
|
380
|
+
}
|
381
|
+
})
|
381
382
|
|
382
|
-
$(window).focus(function(){
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
})
|
383
|
+
$(window).focus(function(){
|
384
|
+
if ($(".timepiece-analog").length > 0){
|
385
|
+
reset_analog()
|
386
|
+
}
|
387
|
+
if ($(".timepiece").length > 0){
|
388
|
+
reset_time()
|
389
|
+
}
|
390
|
+
})
|
391
|
+
}(jQuery));
|
data/lib/timepiece/version.rb
CHANGED