aboutsummaryrefslogtreecommitdiff
path: root/static/script.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/script.js')
-rw-r--r--static/script.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/static/script.js b/static/script.js
index 494b6266..6bb55c2f 100644
--- a/static/script.js
+++ b/static/script.js
@@ -12,6 +12,16 @@ function time_to_percent (time) {
return hour_to_part(time.getHours() + (time.getMinutes() / 60)) + "%"
}
+function parents_until (element, obj) {
+ if (element === null) {
+ return null;
+ } else if (element.id == obj.id || element.classList.contains(obj.class)) {
+ return element;
+ } else {
+ return parents_until (element.parentElement, obj);
+ }
+}
+
let start_time = new Date();
let end_time = new Date();
@@ -125,6 +135,12 @@ function max(a, b) {
a > b ? a : b;
}
+function close_popup (btn) {
+ o = { class: "popup" }
+ var popup = parents_until (btn, o);
+ popup.classList.toggle("show");
+}
+
/*
https://stackoverflow.com/questions/21064101/understanding-offsetwidth-clientwidth-scrollwidth-and-height-respectively
*/