summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-03-23 20:52:54 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-03-23 20:52:54 (GMT)
commitfc2b4c269d5ebb99f5d86eabbed0fade67aa3513 (patch)
tree2edfc9fed49be9ca26ed9a168b2845f1a665af8c
parent035e2574f4deb438199d72c3b3b3e255331440a8 (diff)
simpler interface for clock
-rw-r--r--www/index.html2
-rw-r--r--www/js/clock.js12
2 files changed, 3 insertions, 11 deletions
diff --git a/www/index.html b/www/index.html
index 9042849..61c228a 100644
--- a/www/index.html
+++ b/www/index.html
@@ -25,8 +25,6 @@
<script type="text/javascript">
clock_init();
- drawClock('Do, 1.1.1970', '00:00:00', 0);
- clock_add_callback(drawClock);
</script>
</body>
diff --git a/www/js/clock.js b/www/js/clock.js
index a99b5f8..59f53de 100644
--- a/www/js/clock.js
+++ b/www/js/clock.js
@@ -43,10 +43,6 @@ function Clock() {
this.draw_callbacks.fireWith(window, [date_str, time_str, get_rd_week(rdtime_ms)]);
}
- this.addCallback = function(cb) {
- this.draw_callbacks.add(cb);
- }
-
this.ntp_update = function(event) {
var t4 = (+new Date());
@@ -110,13 +106,11 @@ var clock = new Clock();
function clock_init() {
clock.start();
+ clock_draw('Do, 1.1.1970', '00:00:00', 0);
+ clock.addCallback(clock_draw);
}
-function clock_add_callback(cb) {
- clock.addCallback(cb);
-}
-
-function drawClock(date, time, week) {
+function clock_draw(date, time, week) {
$('#clock span.clock-date').text(date);
$('#clock span.clock-time').text(time);
var weekspan = $('#clock span.current-week').removeClass().addClass('current-week').addClass('label');