aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-04-05 23:52:11 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-04-05 23:52:11 +0200
commita7130d7fed8a651066419337b34e5af115a9fb53 (patch)
treedab91422262bf632f9ecb2575fed24a06ce8f23e
parentUpdate JS to only try to mark today if posible. (diff)
downloadcalp-a7130d7fed8a651066419337b34e5af115a9fb53.tar.gz
calp-a7130d7fed8a651066419337b34e5af115a9fb53.tar.xz
Made script work better for month view.
-rw-r--r--static/script.js20
1 files 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)
+ }
/* */