departr 0.4 → 0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/README.md +8 -2
- data/bin/departr-images +78 -0
- data/chrome/logo.png +0 -0
- data/chrome/manifest.json +17 -0
- data/chrome/newtab.html +85 -0
- data/chrome/newtab.js +19 -0
- data/departr.gemspec +9 -8
- data/lib/departr/commands.rb +1 -9
- data/lib/departr/config.rb +1 -7
- data/lib/departr/server.rb +48 -42
- data/lib/departr/settings.rb +7 -5
- data/public/javascripts/2_autocomplete.js +6 -2
- data/public/javascripts/{5_appliction.js → 4_appliction.js} +0 -24
- data/public/javascripts/{6_command.js → 5_command.js} +26 -9
- data/public/javascripts/9_run.js +11 -0
- data/screenshot.jpg +0 -0
- data/views/help.haml +9 -6
- data/views/index.haml +3 -54
- data/views/layout.haml +1 -0
- data/views/settings.haml +0 -32
- data/views/style.sass +74 -147
- metadata +58 -51
- data/Gemfile.lock +0 -30
- data/public/javascripts/4_coolclock.js +0 -325
- data/screenshot.png +0 -0
metadata
CHANGED
@@ -1,80 +1,86 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: departr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
5
|
-
prerelease:
|
4
|
+
version: '0.6'
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Florent Solt
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-02-20 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement:
|
17
|
-
none: false
|
14
|
+
name: haml
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
19
|
+
version: '4.0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: tzinfo
|
27
|
-
requirement: &68379620 !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
29
23
|
requirements:
|
30
|
-
- - ~>
|
24
|
+
- - "~>"
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version: '0
|
33
|
-
type: :runtime
|
34
|
-
prerelease: false
|
35
|
-
version_requirements: *68379620
|
26
|
+
version: '4.0'
|
36
27
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
38
|
-
requirement:
|
39
|
-
none: false
|
28
|
+
name: sass
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
40
30
|
requirements:
|
41
|
-
- - ~>
|
31
|
+
- - "~>"
|
42
32
|
- !ruby/object:Gem::Version
|
43
|
-
version: '3.
|
33
|
+
version: '3.2'
|
44
34
|
type: :runtime
|
45
35
|
prerelease: false
|
46
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.2'
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
49
|
-
requirement:
|
50
|
-
none: false
|
42
|
+
name: sinatra
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
51
44
|
requirements:
|
52
|
-
- - ~>
|
45
|
+
- - "~>"
|
53
46
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
47
|
+
version: '1.4'
|
55
48
|
type: :runtime
|
56
49
|
prerelease: false
|
57
|
-
version_requirements:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.4'
|
58
55
|
- !ruby/object:Gem::Dependency
|
59
|
-
name:
|
60
|
-
requirement:
|
61
|
-
none: false
|
56
|
+
name: oauth
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
62
58
|
requirements:
|
63
|
-
- - ~>
|
59
|
+
- - "~>"
|
64
60
|
- !ruby/object:Gem::Version
|
65
|
-
version: '
|
61
|
+
version: '0.4'
|
66
62
|
type: :runtime
|
67
63
|
prerelease: false
|
68
|
-
version_requirements:
|
69
|
-
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.4'
|
69
|
+
description: Departr is a smart and fast startpage to help you reach other web sites.
|
70
70
|
email: florent@solt.biz
|
71
|
-
executables:
|
71
|
+
executables:
|
72
|
+
- departr-images
|
72
73
|
extensions: []
|
73
74
|
extra_rdoc_files: []
|
74
75
|
files:
|
76
|
+
- ".gitignore"
|
75
77
|
- Gemfile
|
76
|
-
- Gemfile.lock
|
77
78
|
- README.md
|
79
|
+
- bin/departr-images
|
80
|
+
- chrome/logo.png
|
81
|
+
- chrome/manifest.json
|
82
|
+
- chrome/newtab.html
|
83
|
+
- chrome/newtab.js
|
78
84
|
- config.ru.example
|
79
85
|
- departr.gemspec
|
80
86
|
- lib/departr.rb
|
@@ -89,10 +95,10 @@ files:
|
|
89
95
|
- public/javascripts/1_mootools.js
|
90
96
|
- public/javascripts/2_autocomplete.js
|
91
97
|
- public/javascripts/3_simple-modal.js
|
92
|
-
- public/javascripts/
|
93
|
-
- public/javascripts/
|
94
|
-
- public/javascripts/
|
95
|
-
- screenshot.
|
98
|
+
- public/javascripts/4_appliction.js
|
99
|
+
- public/javascripts/5_command.js
|
100
|
+
- public/javascripts/9_run.js
|
101
|
+
- screenshot.jpg
|
96
102
|
- views/help.haml
|
97
103
|
- views/index.haml
|
98
104
|
- views/layout.haml
|
@@ -100,27 +106,28 @@ files:
|
|
100
106
|
- views/settings.haml
|
101
107
|
- views/style.sass
|
102
108
|
homepage: https://github.com/florentsolt/departr
|
103
|
-
licenses:
|
109
|
+
licenses:
|
110
|
+
- MIT
|
111
|
+
metadata: {}
|
104
112
|
post_install_message:
|
105
113
|
rdoc_options: []
|
106
114
|
require_paths:
|
107
115
|
- lib
|
108
116
|
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
-
none: false
|
110
117
|
requirements:
|
111
|
-
- -
|
118
|
+
- - ">="
|
112
119
|
- !ruby/object:Gem::Version
|
113
120
|
version: '0'
|
114
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
-
none: false
|
116
122
|
requirements:
|
117
|
-
- -
|
123
|
+
- - ">="
|
118
124
|
- !ruby/object:Gem::Version
|
119
125
|
version: '0'
|
120
126
|
requirements: []
|
121
127
|
rubyforge_project:
|
122
|
-
rubygems_version:
|
128
|
+
rubygems_version: 2.2.0
|
123
129
|
signing_key:
|
124
|
-
specification_version:
|
125
|
-
summary: Departr
|
130
|
+
specification_version: 4
|
131
|
+
summary: Departr!
|
126
132
|
test_files: []
|
133
|
+
has_rdoc:
|
data/Gemfile.lock
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
departr (0.1)
|
5
|
-
haml (~> 3.1)
|
6
|
-
json (~> 1.6)
|
7
|
-
sass (~> 3.1)
|
8
|
-
sinatra (~> 1.3)
|
9
|
-
tzinfo (~> 0.3)
|
10
|
-
|
11
|
-
GEM
|
12
|
-
specs:
|
13
|
-
haml (3.1.4)
|
14
|
-
json (1.6.5)
|
15
|
-
rack (1.4.0)
|
16
|
-
rack-protection (1.2.0)
|
17
|
-
rack
|
18
|
-
sass (3.1.12)
|
19
|
-
sinatra (1.3.2)
|
20
|
-
rack (~> 1.3, >= 1.3.6)
|
21
|
-
rack-protection (~> 1.2)
|
22
|
-
tilt (~> 1.3, >= 1.3.3)
|
23
|
-
tilt (1.3.3)
|
24
|
-
tzinfo (0.3.31)
|
25
|
-
|
26
|
-
PLATFORMS
|
27
|
-
ruby
|
28
|
-
|
29
|
-
DEPENDENCIES
|
30
|
-
departr!
|
@@ -1,325 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* CoolClock 2.1.4
|
3
|
-
* Copyright 2010, Simon Baird
|
4
|
-
* Released under the BSD License.
|
5
|
-
*
|
6
|
-
* Display an analog clock using canvas.
|
7
|
-
* http://randomibis.com/coolclock/
|
8
|
-
*
|
9
|
-
*/
|
10
|
-
|
11
|
-
// Constructor for CoolClock objects
|
12
|
-
window.CoolClock = function(options) {
|
13
|
-
return this.init(options);
|
14
|
-
}
|
15
|
-
|
16
|
-
// Config contains some defaults, and clock skins
|
17
|
-
CoolClock.config = {
|
18
|
-
tickDelay: 1000,
|
19
|
-
longTickDelay: 15000,
|
20
|
-
defaultRadius: 85,
|
21
|
-
renderRadius: 100,
|
22
|
-
defaultSkin: "solt",
|
23
|
-
// Should be in skin probably...
|
24
|
-
// (TODO: allow skinning of digital display)
|
25
|
-
showSecs: true,
|
26
|
-
showAmPm: true,
|
27
|
-
|
28
|
-
skins: {
|
29
|
-
solt: {
|
30
|
-
outerBorder: { lineWidth: 4, radius:97, color: "#ccc", alpha: 1 },
|
31
|
-
smallIndicator: { lineWidth: 4, startAt: 89, endAt: 93, color: "#ccc", alpha: 1 },
|
32
|
-
largeIndicator: { lineWidth: 8, startAt: 80, endAt: 93, color: "#ccc", alpha: 1 },
|
33
|
-
hourHand: { lineWidth: 12, startAt: -15, endAt: 60, color: "black", alpha: 1 },
|
34
|
-
minuteHand: { lineWidth: 10, startAt: -15, endAt: 85, color: "black", alpha: 1 },
|
35
|
-
secondHand: { lineWidth: 4, startAt: -20, endAt: 85, color: "#54ACFF", alpha: 1 },
|
36
|
-
secondDecoration: { lineWidth: 2, startAt: 70, radius: 8, fillColor: "#54ACFF", color: "red", alpha: 1 }
|
37
|
-
}/*,
|
38
|
-
swissRail: {
|
39
|
-
outerBorder: { lineWidth: 2, radius:95, color: "black", alpha: 1 },
|
40
|
-
smallIndicator: { lineWidth: 2, startAt: 88, endAt: 92, color: "black", alpha: 1 },
|
41
|
-
largeIndicator: { lineWidth: 4, startAt: 79, endAt: 92, color: "black", alpha: 1 },
|
42
|
-
hourHand: { lineWidth: 8, startAt: -15, endAt: 50, color: "black", alpha: 1 },
|
43
|
-
minuteHand: { lineWidth: 7, startAt: -15, endAt: 75, color: "black", alpha: 1 },
|
44
|
-
secondHand: { lineWidth: 1, startAt: -20, endAt: 85, color: "red", alpha: 1 },
|
45
|
-
secondDecoration: { lineWidth: 1, startAt: 70, radius: 4, fillColor: "red", color: "red", alpha: 1 }
|
46
|
-
},
|
47
|
-
chunkySwiss: {
|
48
|
-
outerBorder: { lineWidth: 4, radius:97, color: "black", alpha: 1 },
|
49
|
-
smallIndicator: { lineWidth: 4, startAt: 89, endAt: 93, color: "black", alpha: 1 },
|
50
|
-
largeIndicator: { lineWidth: 8, startAt: 80, endAt: 93, color: "black", alpha: 1 },
|
51
|
-
hourHand: { lineWidth: 12, startAt: -15, endAt: 60, color: "black", alpha: 1 },
|
52
|
-
minuteHand: { lineWidth: 10, startAt: -15, endAt: 85, color: "black", alpha: 1 },
|
53
|
-
secondHand: { lineWidth: 4, startAt: -20, endAt: 85, color: "red", alpha: 1 },
|
54
|
-
secondDecoration: { lineWidth: 2, startAt: 70, radius: 8, fillColor: "red", color: "red", alpha: 1 }
|
55
|
-
},
|
56
|
-
chunkySwissOnBlack: {
|
57
|
-
outerBorder: { lineWidth: 4, radius:97, color: "white", alpha: 1 },
|
58
|
-
smallIndicator: { lineWidth: 4, startAt: 89, endAt: 93, color: "white", alpha: 1 },
|
59
|
-
largeIndicator: { lineWidth: 8, startAt: 80, endAt: 93, color: "white", alpha: 1 },
|
60
|
-
hourHand: { lineWidth: 12, startAt: -15, endAt: 60, color: "white", alpha: 1 },
|
61
|
-
minuteHand: { lineWidth: 10, startAt: -15, endAt: 85, color: "white", alpha: 1 },
|
62
|
-
secondHand: { lineWidth: 4, startAt: -20, endAt: 85, color: "red", alpha: 1 },
|
63
|
-
secondDecoration: { lineWidth: 2, startAt: 70, radius: 8, fillColor: "red", color: "red", alpha: 1 }
|
64
|
-
}
|
65
|
-
*/
|
66
|
-
},
|
67
|
-
|
68
|
-
// Test for IE so we can nurse excanvas in a couple of places
|
69
|
-
isIE: !!document.all,
|
70
|
-
|
71
|
-
// Will store (a reference to) each clock here, indexed by the id of the canvas element
|
72
|
-
clockTracker: {},
|
73
|
-
|
74
|
-
// For giving a unique id to coolclock canvases with no id
|
75
|
-
noIdCount: 0
|
76
|
-
};
|
77
|
-
|
78
|
-
// Define the CoolClock object's methods
|
79
|
-
CoolClock.prototype = {
|
80
|
-
|
81
|
-
// Initialise using the parameters parsed from the colon delimited class
|
82
|
-
init: function(options) {
|
83
|
-
// Parse and store the options
|
84
|
-
this.canvasId = options.canvasId;
|
85
|
-
this.skinId = options.skinId || CoolClock.config.defaultSkin;
|
86
|
-
this.displayRadius = options.displayRadius || CoolClock.config.defaultRadius;
|
87
|
-
this.showSecondHand = typeof options.showSecondHand == "boolean" ? options.showSecondHand : true;
|
88
|
-
this.gmtOffset = (options.gmtOffset !== null && options.gmtOffset !== '') ? parseFloat(options.gmtOffset) : null;
|
89
|
-
this.showDigital = typeof options.showDigital == "boolean" ? options.showDigital : true;
|
90
|
-
this.logClock = typeof options.logClock == "boolean" ? options.logClock : false;
|
91
|
-
this.logClockRev = typeof options.logClock == "boolean" ? options.logClockRev : false;
|
92
|
-
|
93
|
-
this.tickDelay = CoolClock.config[ this.showSecondHand ? "tickDelay" : "longTickDelay" ];
|
94
|
-
this.label = options.label || false;
|
95
|
-
this.fontSize = options.fontSize || "15px";
|
96
|
-
|
97
|
-
// Get the canvas element
|
98
|
-
this.canvas = document.getElementById(this.canvasId);
|
99
|
-
|
100
|
-
// Make the canvas the requested size. It's always square.
|
101
|
-
this.width = this.displayRadius*2;
|
102
|
-
this.height = this.displayRadius*2 + parseInt(this.fontSize) * 2;
|
103
|
-
this.canvas.setAttribute("width",this.width);
|
104
|
-
this.canvas.setAttribute("height",this.height);
|
105
|
-
this.canvas.style.width = this.width + "px";
|
106
|
-
this.canvas.style.height = this.height + "px";
|
107
|
-
|
108
|
-
// Explain me please...?
|
109
|
-
this.renderRadius = CoolClock.config.renderRadius;
|
110
|
-
this.scale = this.displayRadius / this.renderRadius;
|
111
|
-
|
112
|
-
// Initialise canvas context
|
113
|
-
this.ctx = this.canvas.getContext("2d");
|
114
|
-
this.ctx.scale(this.scale,this.scale);
|
115
|
-
|
116
|
-
// Keep track of this object
|
117
|
-
CoolClock.config.clockTracker[this.canvasId] = this;
|
118
|
-
|
119
|
-
// should we be running the clock?
|
120
|
-
this.active = true;
|
121
|
-
this.tickTimeout = null;
|
122
|
-
|
123
|
-
// Start the clock going
|
124
|
-
this.tick();
|
125
|
-
|
126
|
-
return this;
|
127
|
-
},
|
128
|
-
|
129
|
-
// Draw a circle at point x,y with params as defined in skin
|
130
|
-
fullCircleAt: function(x,y,skin) {
|
131
|
-
this.ctx.save();
|
132
|
-
this.ctx.globalAlpha = skin.alpha;
|
133
|
-
this.ctx.lineWidth = skin.lineWidth;
|
134
|
-
|
135
|
-
if (!CoolClock.config.isIE) {
|
136
|
-
this.ctx.beginPath();
|
137
|
-
}
|
138
|
-
|
139
|
-
if (CoolClock.config.isIE) {
|
140
|
-
// excanvas doesn't scale line width so we will do it here
|
141
|
-
this.ctx.lineWidth = this.ctx.lineWidth * this.scale;
|
142
|
-
}
|
143
|
-
|
144
|
-
this.ctx.arc(x, y, skin.radius, 0, 2*Math.PI, false);
|
145
|
-
|
146
|
-
if (CoolClock.config.isIE) {
|
147
|
-
// excanvas doesn't close the circle so let's fill in the tiny gap
|
148
|
-
this.ctx.arc(x, y, skin.radius, -0.1, 0.1, false);
|
149
|
-
}
|
150
|
-
|
151
|
-
if (skin.fillColor) {
|
152
|
-
this.ctx.fillStyle = skin.fillColor
|
153
|
-
this.ctx.fill();
|
154
|
-
}
|
155
|
-
else {
|
156
|
-
// XXX why not stroke and fill
|
157
|
-
this.ctx.strokeStyle = skin.color;
|
158
|
-
this.ctx.stroke();
|
159
|
-
}
|
160
|
-
this.ctx.restore();
|
161
|
-
},
|
162
|
-
|
163
|
-
// Draw some text centered vertically and horizontally
|
164
|
-
drawTextAt: function(theText,x,y,bold) {
|
165
|
-
this.ctx.save();
|
166
|
-
this.ctx.font = (bold?'bold ':'') + this.fontSize + ' sans-serif';
|
167
|
-
var tSize = this.ctx.measureText(theText);
|
168
|
-
if (!tSize.height) tSize.height = 15; // no height in firefox.. :(
|
169
|
-
this.ctx.fillText(theText,x - tSize.width/2,y - tSize.height/2);
|
170
|
-
this.ctx.restore();
|
171
|
-
},
|
172
|
-
|
173
|
-
lpad2: function(num) {
|
174
|
-
return (num < 10 ? '0' : '') + num;
|
175
|
-
},
|
176
|
-
|
177
|
-
tickAngle: function(second) {
|
178
|
-
// Log algorithm by David Bradshaw
|
179
|
-
var tweak = 3; // If it's lower the one second mark looks wrong (?)
|
180
|
-
if (this.logClock) {
|
181
|
-
return second == 0 ? 0 : (Math.log(second*tweak) / Math.log(60*tweak));
|
182
|
-
}
|
183
|
-
else if (this.logClockRev) {
|
184
|
-
// Flip the seconds then flip the angle (trickiness)
|
185
|
-
second = (60 - second) % 60;
|
186
|
-
return 1.0 - (second == 0 ? 0 : (Math.log(second*tweak) / Math.log(60*tweak)));
|
187
|
-
}
|
188
|
-
else {
|
189
|
-
return second/60.0;
|
190
|
-
}
|
191
|
-
},
|
192
|
-
|
193
|
-
timeText: function(hour,min,sec) {
|
194
|
-
var c = CoolClock.config;
|
195
|
-
return '' +
|
196
|
-
(c.showAmPm ? ((hour%12)==0 ? 12 : (hour%12)) : hour) + ':' +
|
197
|
-
this.lpad2(min) +
|
198
|
-
(c.showSecs ? ':' + this.lpad2(sec) : '') +
|
199
|
-
(c.showAmPm ? (hour < 12 ? ' am' : ' pm') : '')
|
200
|
-
;
|
201
|
-
},
|
202
|
-
|
203
|
-
// Draw a radial line by rotating then drawing a straight line
|
204
|
-
// Ha ha, I think I've accidentally used Taus, (see http://tauday.com/)
|
205
|
-
radialLineAtAngle: function(angleFraction,skin) {
|
206
|
-
this.ctx.save();
|
207
|
-
this.ctx.translate(this.renderRadius,this.renderRadius);
|
208
|
-
this.ctx.rotate(Math.PI * (2.0 * angleFraction - 0.5));
|
209
|
-
this.ctx.globalAlpha = skin.alpha;
|
210
|
-
this.ctx.strokeStyle = skin.color;
|
211
|
-
this.ctx.lineWidth = skin.lineWidth;
|
212
|
-
|
213
|
-
if (CoolClock.config.isIE)
|
214
|
-
// excanvas doesn't scale line width so we will do it here
|
215
|
-
this.ctx.lineWidth = this.ctx.lineWidth * this.scale;
|
216
|
-
|
217
|
-
if (skin.radius) {
|
218
|
-
this.fullCircleAt(skin.startAt,0,skin)
|
219
|
-
}
|
220
|
-
else {
|
221
|
-
this.ctx.beginPath();
|
222
|
-
this.ctx.moveTo(skin.startAt,0)
|
223
|
-
this.ctx.lineTo(skin.endAt,0);
|
224
|
-
this.ctx.stroke();
|
225
|
-
}
|
226
|
-
this.ctx.restore();
|
227
|
-
},
|
228
|
-
|
229
|
-
render: function(hour,min,sec) {
|
230
|
-
// Get the skin
|
231
|
-
var skin = CoolClock.config.skins[this.skinId];
|
232
|
-
if (!skin) skin = CoolClock.config.skins[CoolClock.config.defaultSkin];
|
233
|
-
|
234
|
-
// Clear
|
235
|
-
this.ctx.clearRect(0,0,this.renderRadius*2,this.renderRadius*2+2*(parseInt(this.fontSize)+10));
|
236
|
-
|
237
|
-
// Draw the outer edge of the clock
|
238
|
-
if (skin.outerBorder)
|
239
|
-
this.fullCircleAt(this.renderRadius,this.renderRadius,skin.outerBorder);
|
240
|
-
|
241
|
-
// Draw the tick marks. Every 5th one is a big one
|
242
|
-
for (var i=0;i<60;i++) {
|
243
|
-
(i%5) && skin.smallIndicator && this.radialLineAtAngle(this.tickAngle(i),skin.smallIndicator);
|
244
|
-
!(i%5) && skin.largeIndicator && this.radialLineAtAngle(this.tickAngle(i),skin.largeIndicator);
|
245
|
-
}
|
246
|
-
|
247
|
-
// Write the time
|
248
|
-
if (this.showDigital) {
|
249
|
-
this.drawTextAt(
|
250
|
-
this.timeText(hour,min,sec),
|
251
|
-
this.renderRadius,
|
252
|
-
this.renderRadius*2+parseInt(this.fontSize)+15
|
253
|
-
);
|
254
|
-
}
|
255
|
-
|
256
|
-
if (this.label) {
|
257
|
-
this.drawTextAt(
|
258
|
-
this.label,
|
259
|
-
this.renderRadius,
|
260
|
-
this.renderRadius*2+2*(parseInt(this.fontSize)+10),
|
261
|
-
true
|
262
|
-
);
|
263
|
-
}
|
264
|
-
|
265
|
-
// Draw the hands
|
266
|
-
if (skin.hourHand)
|
267
|
-
this.radialLineAtAngle(this.tickAngle(((hour%12)*5 + min/12.0)),skin.hourHand);
|
268
|
-
|
269
|
-
if (skin.minuteHand)
|
270
|
-
this.radialLineAtAngle(this.tickAngle((min + sec/60.0)),skin.minuteHand);
|
271
|
-
|
272
|
-
if (this.showSecondHand && skin.secondHand)
|
273
|
-
this.radialLineAtAngle(this.tickAngle(sec),skin.secondHand);
|
274
|
-
|
275
|
-
// Second hand decoration doesn't render right in IE so lets turn it off
|
276
|
-
if (!CoolClock.config.isIE && this.showSecondHand && skin.secondDecoration)
|
277
|
-
this.radialLineAtAngle(this.tickAngle(sec),skin.secondDecoration);
|
278
|
-
},
|
279
|
-
|
280
|
-
// Check the time and display the clock
|
281
|
-
refreshDisplay: function() {
|
282
|
-
var now = new Date();
|
283
|
-
if (this.gmtOffset !== null) {
|
284
|
-
// Use GMT + gmtOffset
|
285
|
-
var offsetNow = new Date(now.valueOf() + (this.gmtOffset * 1000 * 60 * 60));
|
286
|
-
this.render(offsetNow.getUTCHours(),offsetNow.getUTCMinutes(),offsetNow.getUTCSeconds());
|
287
|
-
}
|
288
|
-
else {
|
289
|
-
// Use local time
|
290
|
-
this.render(now.getHours(),now.getMinutes(),now.getSeconds());
|
291
|
-
}
|
292
|
-
},
|
293
|
-
|
294
|
-
// Set timeout to trigger a tick in the future
|
295
|
-
nextTick: function() {
|
296
|
-
this.tickTimeout = setTimeout("CoolClock.config.clockTracker['"+this.canvasId+"'].tick()",this.tickDelay);
|
297
|
-
},
|
298
|
-
|
299
|
-
// Check the canvas element hasn't been removed
|
300
|
-
stillHere: function() {
|
301
|
-
return document.getElementById(this.canvasId) != null;
|
302
|
-
},
|
303
|
-
|
304
|
-
// Stop this clock
|
305
|
-
stop: function() {
|
306
|
-
this.active = false;
|
307
|
-
clearTimeout(this.tickTimeout);
|
308
|
-
},
|
309
|
-
|
310
|
-
// Start this clock
|
311
|
-
start: function() {
|
312
|
-
if (!this.active) {
|
313
|
-
this.active = true;
|
314
|
-
this.tick();
|
315
|
-
}
|
316
|
-
},
|
317
|
-
|
318
|
-
// Main tick handler. Refresh the clock then setup the next tick
|
319
|
-
tick: function() {
|
320
|
-
if (this.stillHere() && this.active) {
|
321
|
-
this.refreshDisplay()
|
322
|
-
this.nextTick();
|
323
|
-
}
|
324
|
-
}
|
325
|
-
};
|