summaryrefslogtreecommitdiff
path: root/widgets/clock
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2016-07-13 20:07:09 +0200
committervarac <varacanero@zeromail.org>2016-07-13 20:07:09 +0200
commit5d01197cf893d4a8c9a57f7c963f47393d34e157 (patch)
tree860e97c0af1ad8c7d4bd1aecb0b7e6658b312846 /widgets/clock
initial commit, import from pixelated_dashboard
Diffstat (limited to 'widgets/clock')
-rw-r--r--widgets/clock/clock.coffee18
-rw-r--r--widgets/clock/clock.html2
-rw-r--r--widgets/clock/clock.scss13
3 files changed, 33 insertions, 0 deletions
diff --git a/widgets/clock/clock.coffee b/widgets/clock/clock.coffee
new file mode 100644
index 0000000..cd6b116
--- /dev/null
+++ b/widgets/clock/clock.coffee
@@ -0,0 +1,18 @@
+class Dashing.Clock extends Dashing.Widget
+
+ ready: ->
+ setInterval(@startTime, 500)
+
+ startTime: =>
+ today = new Date()
+
+ h = today.getHours()
+ m = today.getMinutes()
+ s = today.getSeconds()
+ m = @formatTime(m)
+ s = @formatTime(s)
+ @set('time', h + ":" + m + ":" + s)
+ @set('date', today.toDateString())
+
+ formatTime: (i) ->
+ if i < 10 then "0" + i else i \ No newline at end of file
diff --git a/widgets/clock/clock.html b/widgets/clock/clock.html
new file mode 100644
index 0000000..06759d4
--- /dev/null
+++ b/widgets/clock/clock.html
@@ -0,0 +1,2 @@
+<h1 data-bind="date"></h1>
+<h2 data-bind="time"></h2> \ No newline at end of file
diff --git a/widgets/clock/clock.scss b/widgets/clock/clock.scss
new file mode 100644
index 0000000..19e91bf
--- /dev/null
+++ b/widgets/clock/clock.scss
@@ -0,0 +1,13 @@
+// ----------------------------------------------------------------------------
+// Sass declarations
+// ----------------------------------------------------------------------------
+$background-color: #dc5945;
+
+// ----------------------------------------------------------------------------
+// Widget-clock styles
+// ----------------------------------------------------------------------------
+.widget-clock {
+
+ background-color: $background-color;
+
+}