timepiece 0.1.13 → 0.1.14
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 +19 -9
- data/lib/timepiece/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 960f646557b7dd2720cc2036019f04eaead7e5c6
|
4
|
+
data.tar.gz: ef5bc790d40e916e59e6bc1c30c49fec517544d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88f1909545d0a7567254631f6216e4e68772b2b48f835ab377311a00c8d23c827bae3f40960407e84ed73c8e9b43b1448ffd008ff016eddca324649a84f4b67e
|
7
|
+
data.tar.gz: 5de42a9cb66c49adfb1ba3f2d201a77c81fd790ddf938b99d9c8a112f69f403f854c2bc36fae486c1b6985ec9ce551ac637acc877e512bab7ec6bbb48bcf0e45
|
@@ -20,6 +20,7 @@ function get_time(){
|
|
20
20
|
|
21
21
|
function show_time(){
|
22
22
|
clock = setInterval(function(){
|
23
|
+
clock_running = true;
|
23
24
|
for(i = 0; i < hours.length; i++){
|
24
25
|
if (seconds[i] < 59){
|
25
26
|
seconds[i] += 1
|
@@ -103,6 +104,7 @@ function set_timer(){
|
|
103
104
|
|
104
105
|
function show_timer(){
|
105
106
|
timer = setInterval(function(){
|
107
|
+
timer_running = true;
|
106
108
|
for(i = 0; i < timer_hours.length; i++){
|
107
109
|
if (timer_seconds[i] < 59){
|
108
110
|
timer_seconds[i] += 1
|
@@ -152,6 +154,7 @@ function set_countdown(){
|
|
152
154
|
|
153
155
|
function show_countdown(){
|
154
156
|
countdown = setInterval(function(){
|
157
|
+
countdown_running = true;
|
155
158
|
for(i = 0; i < countdown_hours.length; i++){
|
156
159
|
if (countdown_seconds[i] > 0){
|
157
160
|
countdown_seconds[i] -= 1
|
@@ -211,6 +214,8 @@ function reset_countdown(){
|
|
211
214
|
set_countdown()
|
212
215
|
}
|
213
216
|
|
217
|
+
/* Let's discuss when those functions will be performed. */
|
218
|
+
|
214
219
|
$(document).ready(function(){
|
215
220
|
// Might want to reformat to move if-statement : should also be performed before 'reset_time' so as not to make a blank AJAX request.
|
216
221
|
if ($(".timepiece").length > 0){
|
@@ -228,23 +233,28 @@ $(document).ready(function(){
|
|
228
233
|
})
|
229
234
|
$(document).on('page:load', function(){
|
230
235
|
if ($(".timepiece").length > 0){
|
231
|
-
|
236
|
+
if (clock_running){
|
237
|
+
clearInterval(clock);
|
238
|
+
}
|
232
239
|
reset_time();
|
233
240
|
}
|
234
241
|
if ($(".timepiece-timer").length > 0){
|
235
|
-
|
242
|
+
if (timer_running){
|
243
|
+
clearInterval(timer);
|
244
|
+
}
|
236
245
|
reset_timer();
|
246
|
+
// 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?
|
237
247
|
}
|
238
248
|
if ($(".timepiece-countdown").length > 0){
|
239
|
-
|
249
|
+
if (countdown_running){
|
250
|
+
clearInterval(countdown);
|
251
|
+
}
|
240
252
|
reset_countdown();
|
241
253
|
}
|
242
|
-
// Quickfix for Turbolinks. We should revisit this.
|
243
|
-
// Note we also need jquery-turbolinks to be installed (should at least make users aware of this)
|
244
|
-
// And currently navigation via browser history buttons will break our clocks. FIXME:
|
245
|
-
// quick solution - 'onhashchange' . Why we're not using it: Covers more events than we need to refresh for - AJAX cost too high.
|
246
|
-
// We're going to need something a little more custom.
|
247
254
|
})
|
255
|
+
|
248
256
|
$(window).focus(function(){
|
249
|
-
|
257
|
+
if ($(".timepiece").length > 0){
|
258
|
+
reset_time()
|
259
|
+
}
|
250
260
|
})
|
data/lib/timepiece/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timepiece
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thom Bruce
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jquery-rails
|