From a7130d7fed8a651066419337b34e5af115a9fb53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 5 Apr 2020 23:52:11 +0200 Subject: Made script work better for month view. --- static/script.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/static/script.js b/static/script.js index 7a0fe457..0240a26c 100644 --- a/static/script.js +++ b/static/script.js @@ -85,16 +85,18 @@ function update_current_time_bar () { var event_area = document.getElementById(time_to_date(now)) - if (bar_object) { - bar_object.parentNode.removeChild(bar_object) - } else { - bar_object = document.createElement("div") - bar_object.className = "event current-time" - bar_object.id = "bar" - } + if (event_area) { + if (bar_object) { + bar_object.parentNode.removeChild(bar_object) + } else { + bar_object = document.createElement("div") + bar_object.className = "event current-time" + bar_object.id = "bar" + } - bar_object.style.top = time_to_percent(now) - event_area.append(bar_object) + bar_object.style.top = time_to_percent(now) + event_area.append(bar_object) + } /* */ -- cgit v1.2.3