Skip to content

Commit 9de155a

Browse files
authored
Merge pull request #4 from joecreighton/master
Hide seconds
2 parents df8ad1d + 4968b21 commit 9de155a

File tree

4 files changed

+50
-7
lines changed

4 files changed

+50
-7
lines changed

README.md

+19-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
11
roundClock
22
==========
33

4-
a twist on the traditional analogue clock, widget for Übersicht
4+
A twist on the traditional analogue clock created by [Evan Bovie](https://github.com/phaseOne).
55

6-
![](https://github.com/phaseOne/roundClock/raw/master/screenshot.jpg)
6+
A widget for [Übersicht](http://tracesof.net/uebersicht/).
7+
8+
![](screenshot.jpg)
9+
10+
## Options
11+
12+
Options by [Joe Creighton](https://github.com/joecreighton).
13+
14+
Set the appropriate variables at the top of `index.coffee`. By default, the `seconds` indicators (digits and hand marker) are both visible (`true`) and the time is presented in a 24-hour format (`milTime` or military time); if a 12-hour format is chosen, you have the option to show an am/pm indicator.
15+
16+
```
17+
appearance =
18+
secDigit: true
19+
secHand : true
20+
milTime : true
21+
showAMPM: false
22+
```
723

824
## License
25+
926
* [Mozilla Public License 2.0](https://www.mozilla.org/MPL/2.0/)

roundClock.widget.zip

1.11 KB
Binary file not shown.

roundClock.widget/index.coffee

+31-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
# Read style section for settings (e.g. retina scaling, colors)
22

3-
# replace command with "date +%-H,%M,%-S" to display in 24hr mode
4-
command: "date +%-I,%M,%-S"
3+
# options to set
4+
appearance =
5+
secDigit: true
6+
secHand : true
7+
milTime : true
8+
showAMPM: false
9+
10+
appearance: appearance
11+
12+
command: "date +%H,%M,%S"
513

614
refreshFrequency: 1000
715

@@ -23,7 +31,7 @@ render: (output) -> """
2331
</svg>
2432
2533
<div id="digits">
26-
<span id="hr-dig">0</span><span id="min-dig">00</span><div id="sec-dig">0</div>
34+
<span id="hr-dig"></span><span id="min-dig"></span><span id="ampm"></span><div id="sec-dig"></div>
2735
</div>
2836
"""
2937

@@ -32,9 +40,19 @@ update: (output) ->
3240

3341
circ = Math.PI*2*100
3442

43+
if ! @appearance.milTime
44+
if @appearance.showAMPM then $('#ampm').text "pm"
45+
if time[0] > 12
46+
time[0] = time[0] - 12
47+
else if time[0] < 12
48+
if time[0] < 1 then time[0] = 12
49+
if @appearance.showAMPM then $('#ampm').text "am"
50+
time[0] = Number(time[0])
51+
3552
$('#hr-dig').text time[0]
3653
$('#min-dig').text time[1]
37-
$('#sec-dig').text time[2]
54+
if @appearance.secDigit
55+
$('#sec-dig').text time[2]
3856

3957
$('#min-ln').css('stroke-dashoffset',circ - ( ( parseInt(time[1]) + ( time[2] / 60 ) ) / 60 ) * circ)
4058
$('#sec-ln').css('-webkit-transform','rotate('+( time[2] / 60 ) * 360+'deg)')
@@ -70,7 +88,10 @@ style: """
7088
#hr-mk polygon
7189
fill: main
7290
#sec-mk polygon
73-
fill: second
91+
if #{appearance.secHand}
92+
fill: second
93+
else
94+
fill: none
7495
.line
7596
-webkit-transform-origin: 100% 100% // centers the ticks
7697
@@ -107,8 +128,13 @@ style: """
107128
#min-dig
108129
font-size: 48px * scale
109130
letter-spacing: -2px * scale
131+
#ampm
132+
font-family: HelveticaNeue-Light
133+
font-size: 25px * scale
134+
margin-left: 3px * scale
110135
#sec-dig
111136
font-family: HelveticaNeue-Light
112137
font-size: 24px * scale
113138
color: second
114139
"""
140+

screenshot-dark.jpg

20.2 KB
Loading

0 commit comments

Comments
 (0)