From 3a77e5fd21e6bc0f9062fbfd734d5dcc5fda8f1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 5 Apr 2020 23:04:41 +0200 Subject: Fix JS for current time. --- module/output/html.scm | 5 ++--- static/script.js | 10 +--------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/module/output/html.scm b/module/output/html.scm index 80a5798b..64621e54 100644 --- a/module/output/html.scm +++ b/module/output/html.scm @@ -222,7 +222,7 @@ (fix-event-widths! short-events event-length-key: (lambda (e) (event-length/day day-date e))) - `(div (@ (class "events")) + `(div (@ (class "events") (id ,(date-link day-date))) ,@(map (lambda (time) `(div (@ (class "clock clock-" ,time)) "")) (iota 12 0 2)) @@ -286,8 +286,7 @@ ,@(lay-out-long-events start-date end-date long-events)) ,@(map (lambda (day-date) `(div (@ (class "meta")) - ,(let ((str (date-link day-date))) - `(span (@ (id ,str) (class "daydate")) ,str)) + (span (@ (class "daydate")) ,(date->string day-date "~Y-~m-~d")) (span (@ (class "dayname")) ,(string-titlecase (date->string day-date "~a")))) ) range) ,@(stream->list diff --git a/static/script.js b/static/script.js index dcc7285f..7f7a235b 100644 --- a/static/script.js +++ b/static/script.js @@ -76,12 +76,7 @@ var bar_object = false function update_current_time_bar () { var now = new Date() - var today = document - .getElementById(time_to_date(now)) - .parentElement - .parentElement - - var event_area = today.getElementsByClassName("events")[0] + var event_area = document.getElementById(time_to_date(now)) if (bar_object) { bar_object.parentNode.removeChild(bar_object) @@ -101,9 +96,7 @@ function toggle_event_pupup () { } window.onload = function () { - console.log("Running"); - /* update_current_time_bar() // once a minute for now, could probably be slowed to every 10 minutes window.setInterval(update_current_time_bar, 1000 * 60) @@ -113,7 +106,6 @@ window.onload = function () { c.onmouseup = onmouseuphandler; c.onmousemove = onmousemovehandler; } - */ for (let e of document.getElementsByClassName("event-inner")) { e.onclick = toggle_event_pupup; -- cgit v1.2.3