trickster 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2cbd32e7bfd1f9179242368244df932da57a3e0f
4
- data.tar.gz: 321ce664454f8351575baeee7fd82e1f193bdbb8
3
+ metadata.gz: c02a949789bfb2e5ab9c23ffc1d210121b3dc983
4
+ data.tar.gz: 27b1d7483269c9ab884c2010223f0b9d3dbbc22a
5
5
  SHA512:
6
- metadata.gz: a5901ea211e0282e9b50a0dbd3ad54097246050b6e0d9b411ed109b070326285c963c5aeaeae5f47622154f66315689d73834c3895c8fd995d1fd01eee8cfc58
7
- data.tar.gz: b2de674a15470b8ac4cc5098111683cc0fddaabc1952dc1d07e512425fd5eb58931baa0f033312f22c01f33e3b746a4487541e02dc14fd7ab579594ba1e8ddb4
6
+ metadata.gz: 0be42836b625f4c93ee09fa61741e26a53180b0a47da1f0062d1427428948f911d0546f88847f31f3bbbde31dd7c17941ea4d3c418dbf6fb208ba94a20433796
7
+ data.tar.gz: e8892bfa7c41467235842f148415bd88ba5e727033cd966945887104fbca311b37a52af57a09030a356af9b590d0e3383c14c544effa35603fbd2dc5cad1a0d2
data/css/styles.css CHANGED
@@ -77,7 +77,9 @@ li {
77
77
  }
78
78
 
79
79
  #timer .seconds {
80
+ /*
80
81
  display: none; /* remove this to show seconds elapsing */
82
+ */
81
83
  }
82
84
 
83
85
  #timer .hours {
@@ -95,6 +97,21 @@ li {
95
97
  letter-spacing: -0.2em;
96
98
  }
97
99
 
100
+ #timer.time-ok {
101
+ background: green;
102
+ }
103
+
104
+ #timer.time-warn {
105
+ background: yellow;
106
+ }
107
+
108
+ #timer.time-alert {
109
+ background: red;
110
+ }
111
+
112
+ #timer.time-over {
113
+ background: red;
114
+ }
98
115
  #timer #controls {
99
116
  /* Uncomment this if you want to hide the timer controls
100
117
  display: none;
data/js/timer.js CHANGED
@@ -19,15 +19,33 @@ var TricksterTimer = function(config,functions) {
19
19
 
20
20
  function tick() {
21
21
  if (!paused) {
22
- var now = (new Date()).getTime();
23
- var diff = (now - start) / 1000;
24
- var hour = Math.floor(diff / (60 * 60));
25
- var minute = pad((Math.floor(diff / 60) % 60));
26
- var second = pad(Math.floor(diff % 60));
22
+ var now = (new Date()).getTime();
23
+ var diff = (now - start) / 1000;
24
+ var diffMins = diff / 60;
25
+ var hour = Math.floor(diff / (60 * 60));
26
+ var minute = pad((Math.floor(diff / 60) % 60));
27
+ var second = pad(Math.floor(diff % 60));
27
28
 
28
29
  $("#hour").text(hour);
29
30
  $("#minute").text(minute);
30
31
  $("#second").text(second);
32
+
33
+ $("#timer").removeClass("time-ok");
34
+ $("#timer").removeClass("time-over");
35
+ $("#timer").removeClass("time-alert");
36
+ $("#timer").removeClass("time-warn");
37
+ if (diffMins >= config.lengthMinutes) {
38
+ $("#timer").addClass("time-over");
39
+ }
40
+ else if (diffMins >= config.lengthAlertAt) {
41
+ $("#timer").addClass("time-alert");
42
+ }
43
+ else if (diffMins >= config.lengthWarnAt) {
44
+ $("#timer").addClass("time-warn");
45
+ }
46
+ else {
47
+ $("#timer").addClass("time-ok");
48
+ }
31
49
  }
32
50
 
33
51
  if (running) {
@@ -63,6 +81,7 @@ var TricksterTimer = function(config,functions) {
63
81
  $("#play").hide();
64
82
  $("#pause").show();
65
83
  if (!running) {
84
+ start = (new Date()).getTime();
66
85
  running = true;
67
86
  tick();
68
87
  }
data/js/trickster.js CHANGED
@@ -26,7 +26,10 @@ var TricksterDefaultConfig = {
26
26
  /** These keycodes, if encountered, will not be sent along
27
27
  to the browser. Useful if there might be some vertical
28
28
  scrolling and 32/33/34 would otherwise scroll */
29
- keyCodesPreventingDefault: [ 34, 32, 33 ]
29
+ keyCodesPreventingDefault: [ 34, 32, 33 ],
30
+ lengthMinutes: 3,
31
+ lengthWarnAt: 1,
32
+ lengthAlertAt: 2
30
33
  };
31
34
  /** Loads Trickster.
32
35
  * config: configuration, or TricksterDefaultConfig to get the defaults
@@ -157,9 +160,6 @@ var TricksterLoader = function(config,functions) {
157
160
  else if (direction == config.backSwipe) {
158
161
  Trickster.back();
159
162
  }
160
- else {
161
- alert("Swiped " + direction);
162
- }
163
163
  },
164
164
  });
165
165
  }
@@ -1,3 +1,3 @@
1
1
  module Trickster
2
- VERSION = '1.2.0'
2
+ VERSION = '1.3.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trickster
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Copeland