-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathiOSClock.coffee
executable file
·74 lines (60 loc) · 1.29 KB
/
iOSClock.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
dateOptions =
# display not only 'time' also 'date'
showDate: true
# format of 'date'
date: '%A, %e %B'
format = (->
if dateOptions.showDate
dateOptions.date + '\n' +'%H:%M '
else
'%H:%M:%S'
)()
command: "date +\"#{format}\""
# the refresh frequency in milliseconds
refreshFrequency: 1000
# for update function
dateOptions: dateOptions
render: (output) -> """
<div id='simpleClock'>#{output}</div>
"""
update: (output) ->
if this.dateOptions.showDate
data = output.split('\n')
html = ""
html += "<div class='clock'>"
html += data[1]
html += "</div>"
html += '<div class="date">'
html += data[0]
html += '</div>'
else
html = output
$(simpleClock).html(html)
style: (->
fontSize = '7em'
width = 'auto'
transform = 'auto'
bottom = '3%'
top = 'auto'
return """
color: white
font-family: SF Pro Rounded
width: 100%
height: 33%
#simpleClock
font-size: 7em
font-weight: 200
text-align: center
position: absolute
bottom 0
left 50%
transform: translate(-50%,0)
text-shadow: 0px 0px 20px rgba(0,0,0,0.8)
#simpleClock .clock
margin-bottom: -5px
#simpleClock .date
font-size: 0.20em
font-weight: 300
padding-bottom: 20px
"""
)()