From fc2b4c269d5ebb99f5d86eabbed0fade67aa3513 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 23 Mar 2016 21:52:54 +0100 Subject: simpler interface for clock 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 @@ 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'); -- cgit v0.10.2