From 6c4b85226a119b1e5e95e0f10ea507ff3c1778f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 5 Nov 2020 23:32:34 +0100 Subject: Introduce event_from_popup and vice versa. --- static/script.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/static/script.js b/static/script.js index e55780f6..8445c715 100644 --- a/static/script.js +++ b/static/script.js @@ -650,6 +650,14 @@ window.onload = function () { } +function event_from_popup(popup) { + return document.getElementById(popup.id.substr(5)) +} + +function popup_from_event(event) { + return document.getElementById("popup" + event.id); +} + function close_popup(popup) { popup.classList.remove("visible"); } @@ -662,7 +670,7 @@ function close_all_popups () { function open_popup(popup) { popup.classList.add("visible"); - let element = document.getElementById(popup.id.substr(5)) + let element = event_from_popup(popup); // let root = document.body; let root; switch (VIEW) { @@ -766,7 +774,7 @@ class vcomponent { function bind_properties (el, wide_event=false) { el.properties = {} - let popup = document.getElementById("popup" + el.id); + let popup = popup_from_event(el); // let children = el.getElementsByTagName("properties")[0].children; /* actual component (not popup) */ -- cgit v1.2.3