timepiece 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/timepiece.js +1 -15
- data/app/helpers/timepiece_helper.rb +23 -26
- 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: 55a219b78a6927f763181f5700c4f28bf1ce0f2a
|
4
|
+
data.tar.gz: 30e46491727c80469d98eafb218936c875643eb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b2776cc30157401fd2d4eb5ba21e2d86aa9563641ac8f5f0cd7c1ea5da4bb78c0f3f70d59353479ab6a3538d5ebbeb85b1cb45675bb0768731a9293b07e6935
|
7
|
+
data.tar.gz: b0a8d915526a887cc1d7fce98e5bc3ab414a685d5b913d0206da5613eef607ac12aba6072a9b94379726f9d7d73c80f074d34943a68ebe42ebad8ec92ab9e753
|
@@ -160,18 +160,15 @@
|
|
160
160
|
}, 1000)
|
161
161
|
}
|
162
162
|
|
163
|
-
get_timer_days = []
|
164
163
|
get_timer_hours = []
|
165
164
|
get_timer_minutes = []
|
166
165
|
get_timer_seconds = []
|
167
166
|
|
168
167
|
function set_timer(){
|
169
168
|
$(".timepiece-timer").each(function(){
|
170
|
-
get_timer_days.push(parseInt($(this).attr('data-days'),10))
|
171
169
|
get_timer_hours.push(parseInt($(this).attr('data-hours'),10))
|
172
170
|
get_timer_minutes.push(parseInt($(this).attr('data-minutes'),10))
|
173
171
|
get_timer_seconds.push(parseInt($(this).attr('data-seconds'),10))
|
174
|
-
timer_days = get_timer_days
|
175
172
|
timer_hours = get_timer_hours
|
176
173
|
timer_minutes = get_timer_minutes
|
177
174
|
timer_seconds = get_timer_seconds
|
@@ -190,23 +187,12 @@
|
|
190
187
|
timer_minutes[i] += 1
|
191
188
|
} else {
|
192
189
|
timer_minutes[i] = 0
|
193
|
-
|
194
|
-
timer_hours[i] += 1
|
195
|
-
} else {
|
196
|
-
timer_hours[i] = 0
|
197
|
-
timer_days[i] += 1
|
198
|
-
}
|
190
|
+
timer_hours[i] += 1
|
199
191
|
}
|
200
192
|
}
|
201
193
|
}
|
202
194
|
$(".timepiece-timer").each(function(i, e){
|
203
195
|
$(e).html(function(){
|
204
|
-
$('.timepiece-days', $(e)).html(timer_days[i]);
|
205
|
-
if (timer_days[i] == 1){
|
206
|
-
$('.tp-descriptor-days', $(e)).html(' day ');
|
207
|
-
} else {
|
208
|
-
$('.tp-descriptor-days', $(e)).html(' days ');
|
209
|
-
}
|
210
196
|
$('.timepiece-hours', $(e)).html(( timer_hours[i] < 10 ? "0" : "" ) + timer_hours[i]);
|
211
197
|
if (timer_hours[i] == 1){
|
212
198
|
$('.tp-descriptor-hours', $(e)).html(' hour ');
|
@@ -68,9 +68,6 @@ module TimepieceHelper
|
|
68
68
|
def timer(time_since = Time.now, id: '')
|
69
69
|
seconds_diff = (Time.now - time_since).to_i
|
70
70
|
|
71
|
-
days = seconds_diff / 86400
|
72
|
-
seconds_diff -= days * 86400
|
73
|
-
|
74
71
|
hours = seconds_diff / 3600
|
75
72
|
seconds_diff -= hours * 3600
|
76
73
|
|
@@ -79,42 +76,42 @@ module TimepieceHelper
|
|
79
76
|
|
80
77
|
seconds = seconds_diff
|
81
78
|
|
82
|
-
time = "<span class='timepiece-
|
83
|
-
"<span class='timepiece-separator tp-separator-days-hours'>:</span>"\
|
84
|
-
"<span class='timepiece-hours'>#{"%02d" % hours}</span>"\
|
79
|
+
time = "<span class='timepiece-hours'>#{"%02d" % hours}</span>"\
|
85
80
|
"<span class='timepiece-separator tp-separator-hours-minutes'>:</span>"\
|
86
81
|
"<span class='timepiece-minutes'>#{"%02d" % minutes}</span>"\
|
87
82
|
"<span class='timepiece-separator tp-separator-minutes-seconds'>:</span>"\
|
88
83
|
"<span class='timepiece-seconds'>#{"%02d" % seconds}</span>"
|
89
84
|
# "<span class='timepiece-seconds'>#{seconds.to_s.rjust(2, '0')}</span>" # Note: rjust; it might be useful.
|
90
85
|
|
91
|
-
content_tag(:span, time.html_safe, class: 'timepiece-timer', 'data-
|
86
|
+
content_tag(:span, time.html_safe, class: 'timepiece-timer', 'data-hours' => hours, 'data-minutes' => minutes, 'data-seconds' => seconds, 'id' => (id unless id.blank?))
|
92
87
|
end
|
93
|
-
|
94
|
-
|
88
|
+
if false
|
89
|
+
def timer_in_words(time_since = Time.now, id: '')
|
90
|
+
seconds_diff = (Time.now - time_since).to_i
|
95
91
|
|
96
|
-
|
97
|
-
|
92
|
+
days = seconds_diff / 86400
|
93
|
+
seconds_diff -= days * 86400
|
98
94
|
|
99
|
-
|
100
|
-
|
95
|
+
hours = seconds_diff / 3600
|
96
|
+
seconds_diff -= hours * 3600
|
101
97
|
|
102
|
-
|
103
|
-
|
98
|
+
minutes = seconds_diff / 60
|
99
|
+
seconds_diff -= minutes * 60
|
104
100
|
|
105
|
-
|
101
|
+
seconds = seconds_diff
|
106
102
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
103
|
+
time = "<span class='timepiece-days'>#{days.to_s}</span>"\
|
104
|
+
"<span class='timepiece-descriptor tp-descriptor-days'> days </span>"\
|
105
|
+
"<span class='timepiece-hours'>#{hours.to_s}</span>"\
|
106
|
+
"<span class='timepiece-descriptor tp-descriptor-hours'> hours </span>"\
|
107
|
+
"<span class='timepiece-minutes'>#{minutes.to_s}</span>"\
|
108
|
+
"<span class='timepiece-descriptor tp-descriptor-minutes'> minutes </span>"\
|
109
|
+
"<span class='timepiece-seconds'>#{seconds.to_s}</span>"\
|
110
|
+
"<span class='timepiece-descriptor tp-descriptor-seconds'> seconds </span>"
|
111
|
+
# "<span class='timepiece-seconds'>#{seconds.to_s.rjust(2, '0')}</span>" # Note: rjust; it might be useful.
|
116
112
|
|
117
|
-
|
113
|
+
content_tag(:span, time.html_safe, class: 'timepiece-timer', 'data-days' => days, 'data-hours' => hours, 'data-minutes' => minutes, 'data-seconds' => seconds, 'id' => (id unless id.blank?))
|
114
|
+
end
|
118
115
|
end
|
119
116
|
|
120
117
|
def countdown(time_until = Time.new(2016), id: '')
|
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.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thom Bruce
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jquery-rails
|