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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 29753600532c93645ad077cf5e97280983fdd478
4
- data.tar.gz: f4b43874df409cadb0e110cfd513cb2a2d9f0e7d
3
+ metadata.gz: 55a219b78a6927f763181f5700c4f28bf1ce0f2a
4
+ data.tar.gz: 30e46491727c80469d98eafb218936c875643eb7
5
5
  SHA512:
6
- metadata.gz: eedbde663b7c1d3f5d124515855f65eadcc9e76564aafd4e549a71fccd337431c2bf80229343c0b8ce2540714b629d92b71f7e298eaddf5963601e37f6b9cee5
7
- data.tar.gz: 301639cb6c0a76ce2ddedb0853edb91e850c5cfe7569fe150b3b2bc84eb2e82669bbe6199c05e8e8bd015287132212712f18b4b8f3860b7c2899dfbcbe6dde92
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
- if (timer_hours[i] < 23){
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('&nbsp;day ');
207
- } else {
208
- $('.tp-descriptor-days', $(e)).html('&nbsp;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('&nbsp;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-days'>#{days.to_s}</span>"\
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-days' => days, 'data-hours' => hours, 'data-minutes' => minutes, 'data-seconds' => seconds, 'id' => (id unless id.blank?))
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
- def timer_in_words(time_since = Time.now, id: '')
94
- seconds_diff = (Time.now - time_since).to_i
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
- days = seconds_diff / 86400
97
- seconds_diff -= days * 86400
92
+ days = seconds_diff / 86400
93
+ seconds_diff -= days * 86400
98
94
 
99
- hours = seconds_diff / 3600
100
- seconds_diff -= hours * 3600
95
+ hours = seconds_diff / 3600
96
+ seconds_diff -= hours * 3600
101
97
 
102
- minutes = seconds_diff / 60
103
- seconds_diff -= minutes * 60
98
+ minutes = seconds_diff / 60
99
+ seconds_diff -= minutes * 60
104
100
 
105
- seconds = seconds_diff
101
+ seconds = seconds_diff
106
102
 
107
- time = "<span class='timepiece-days'>#{days.to_s}</span>"\
108
- "<span class='timepiece-descriptor tp-descriptor-days'> days </span>"\
109
- "<span class='timepiece-hours'>#{hours.to_s}</span>"\
110
- "<span class='timepiece-descriptor tp-descriptor-hours'> hours </span>"\
111
- "<span class='timepiece-minutes'>#{minutes.to_s}</span>"\
112
- "<span class='timepiece-descriptor tp-descriptor-minutes'> minutes </span>"\
113
- "<span class='timepiece-seconds'>#{seconds.to_s}</span>"\
114
- "<span class='timepiece-descriptor tp-descriptor-seconds'> seconds </span>"
115
- # "<span class='timepiece-seconds'>#{seconds.to_s.rjust(2, '0')}</span>" # Note: rjust; it might be useful.
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
- 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?))
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: '')
@@ -1,3 +1,3 @@
1
1
  module Timepiece
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
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.3.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-02-12 00:00:00.000000000 Z
11
+ date: 2016-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jquery-rails