aboutsummaryrefslogtreecommitdiff
path: root/static/script.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/script.js')
-rw-r--r--static/script.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/static/script.js b/static/script.js
index 4fbf160e..6cca186e 100644
--- a/static/script.js
+++ b/static/script.js
@@ -222,6 +222,12 @@ function setVar(str, val) {
document.documentElement.style.setProperty("--" + str, val);
}
+function close_all_popups () {
+ for (let popup of document.getElementsByClassName("popup")) {
+ popup.classList.remove("show");
+ }
+}
+
window.onload = function () {
start_time.setTime(document.querySelector("meta[name='start-time']").content * 1000)
end_time.setTime(document.querySelector("meta[name='end-time']").content * 1000)
@@ -258,6 +264,13 @@ window.onload = function () {
*/
+ document.onkeydown = function (evt) {
+ evt = evt || window.event;
+ if (evt.key.startsWith("Esc")) {
+ close_all_popups();
+ }
+ }
+
}
$(document).ready(function() {