diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-05-01 13:10:19 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-05-01 13:10:19 +0200 |
commit | b0f51a25df76316c1cd6aa8ea97d3eb213c72cb3 (patch) | |
tree | f3efafe4bb0a80075d4bc2915a6d25586b6a28ea /static | |
parent | Note in README about TippedJS. (diff) | |
parent | Merge branch 'app'. (diff) | |
download | calp-b0f51a25df76316c1cd6aa8ea97d3eb213c72cb3.tar.gz calp-b0f51a25df76316c1cd6aa8ea97d3eb213c72cb3.tar.xz |
Merge branch 'master' into tooltip
Diffstat (limited to 'static')
-rw-r--r-- | static/script.js | 13 |
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() { |