in-the-zone 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +1 -1
- data/lib/in_the_zone.rb +3 -0
- data/lib/in_the_zone/version.rb +1 -1
- data/static_assets/javascripts/in_the_zone.js +13 -17
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45a46caa46971175205becd39c8a61a922d11e70
|
4
|
+
data.tar.gz: 9c3b65ab914fc6ef6aa3af625d2a3b55c36870e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20e778fc2af793598a2843ba843d3f8d87e01ad9ef90941fac9b2cb48b3e9ee0edd65f6b8675f053744bcd8f83a518f76c5ae6811e3eb080232c6e3bab20f59e
|
7
|
+
data.tar.gz: a0807b3c124a13527d1022a7795789c4a09d1e03e317f13f23499534339c15eed4f43c3851b236694fff519f102cf7c242d045ecb94a74f9e7979078f948ff07
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
�
|
1
|
+
4���i3�Ŏ�0����QF?c��|���2*�>����T�q��z�X}(Ao?���D�.'�_`���G H��JF�I����]�<'[�t��J;� $��[ū���a���z�Z���Y�N��D1�SSX���ڨ� ���7X7��H$52�A;��/y�d��c���ҁAI���Q$˦_��6E�$�=?U�DI�3�7���e۸a)@�C�i�1hT��.�����&��e�ϙ�ѠrB��r�$w3�;1�
|
data/lib/in_the_zone.rb
CHANGED
@@ -55,6 +55,9 @@ module InTheZone
|
|
55
55
|
if opts[ :from_now ]
|
56
56
|
data[ :options ][ :from_now ] = true
|
57
57
|
end
|
58
|
+
if opts[ :format_method ]
|
59
|
+
data[ :options ][ :format_method ] = opts[ :format_method ].to_s
|
60
|
+
end
|
58
61
|
if opts[ :live_update ]
|
59
62
|
data[ :options ][ :live_update ] = true
|
60
63
|
end
|
data/lib/in_the_zone/version.rb
CHANGED
@@ -2,12 +2,17 @@ define('inthezone',
|
|
2
2
|
['ko', 'moment'],
|
3
3
|
function(ko, moment) {
|
4
4
|
|
5
|
+
var options = {
|
6
|
+
format_methods: {}
|
7
|
+
};
|
8
|
+
|
5
9
|
var InTheZone = function(element, opts) {
|
6
10
|
this.element = element;
|
7
11
|
this.format = ko.observable(opts.format);
|
8
12
|
this.current_time = ko.observable(moment.unix(opts.timestamp));
|
9
13
|
this.from_now = ko.observable(opts.from_now);
|
10
14
|
this.live_update = ko.observable(opts.live_update);
|
15
|
+
this.format_method = ko.observable(opts.format_method);
|
11
16
|
if(this.from_now() && this.live_update()) {
|
12
17
|
this.start_interval();
|
13
18
|
};
|
@@ -33,25 +38,14 @@ define('inthezone',
|
|
33
38
|
return(60*60*24*interval_base);
|
34
39
|
};
|
35
40
|
|
36
|
-
// A Cozy-style time_from_now function...
|
37
|
-
// InTheZone.prototype.time_from_now = function(time) {
|
38
|
-
// if(time.diff(moment(),'days')==0) {
|
39
|
-
// return(time.format('LT'));
|
40
|
-
// } else if(time.diff(moment(),'days')==-1){
|
41
|
-
// return('Yesterday');
|
42
|
-
// } else {
|
43
|
-
// return(time.format('l'));
|
44
|
-
// };
|
45
|
-
// };
|
46
|
-
|
47
|
-
InTheZone.prototype.time_from_now = function(time) {
|
48
|
-
return(time.fromNow());
|
49
|
-
};
|
50
|
-
|
51
41
|
InTheZone.prototype.update_time = function(new_time) {
|
52
42
|
if(new_time) this.current_time(moment(new_time));
|
53
|
-
|
54
|
-
|
43
|
+
var meth;
|
44
|
+
if(this.format_method() && (meth = options.format_methods[ this.format_method() ])) {
|
45
|
+
this.element.innerHTML = meth(this.current_time());
|
46
|
+
}
|
47
|
+
else if(this.from_now()) {
|
48
|
+
this.element.innerHTML = this.current_time().fromNow();
|
55
49
|
} else {
|
56
50
|
this.element.innerHTML = this.current_time().format(this.format());
|
57
51
|
};
|
@@ -72,4 +66,6 @@ define('inthezone',
|
|
72
66
|
element.timeHandler.update_time();
|
73
67
|
}
|
74
68
|
}
|
69
|
+
|
70
|
+
return(options)
|
75
71
|
});
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: in-the-zone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Bragg
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
TlaAvFdgPdUIydKBhAeUZA4ACyA9QT6EKa2WlkZoV/nVD6N3UfTzj/2Em2EP1lfm
|
31
31
|
dSlv1HCMhSbE8y64mkOubGxyu9V3eM99rqEGwSNo7zMu/cb1
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2014-05-
|
33
|
+
date: 2014-05-27 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: bundler
|
metadata.gz.sig
CHANGED
Binary file
|