diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-04-27 00:40:48 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-04-27 00:40:48 +0200 |
commit | 22170810b718ed67fddeb0a94be4ef013fdc6068 (patch) | |
tree | 5e3d76635d10e0c1e4c221bbc860ba4bdd5ceb50 /static | |
parent | Made btn shadow-height variable. (diff) | |
download | calp-22170810b718ed67fddeb0a94be4ef013fdc6068.tar.gz calp-22170810b718ed67fddeb0a94be4ef013fdc6068.tar.xz |
Made script finding of elements more stable.
Diffstat (limited to 'static')
-rw-r--r-- | static/script.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/static/script.js b/static/script.js index 6bb55c2f..7cd99bef 100644 --- a/static/script.js +++ b/static/script.js @@ -151,9 +151,12 @@ function new_popup (event) { // if (event.target !== this) return; /* popup = this.children[0].children[0] */ - popup = this.parentElement.parentElement.getElementsByClassName("popup")[0]; + let ev = parents_until(this, {class: "event"}) + popup = ev.getElementsByClassName("popup")[0]; popup.classList.toggle("show") + return; + /* x-axis fix */ /* Popup should neven be wider than viewport */ @@ -218,7 +221,9 @@ window.onload = function () { // } days = document.getElementsByClassName("days")[0] - for (let e of days.getElementsByClassName("body")) { + for (let popup of document.getElementsByClassName("popup")) { + ev = parents_until(popup, {class: "event"}) + e = ev.getElementsByClassName("body")[0] e.onclick = new_popup; e.parentElement.href = "#"; } |