From 50596e71bf19e435b79b70f5c20f2d949151ae95 Mon Sep 17 00:00:00 2001 From: Marcin Haba Date: Sun, 7 Nov 2021 06:01:26 +0100 Subject: [PATCH] baculum: Add capability to close modal windows on clicking gray shadow --- gui/baculum/protected/Common/JavaScript/misc.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gui/baculum/protected/Common/JavaScript/misc.js b/gui/baculum/protected/Common/JavaScript/misc.js index 0457f3129..feced2b32 100644 --- a/gui/baculum/protected/Common/JavaScript/misc.js +++ b/gui/baculum/protected/Common/JavaScript/misc.js @@ -190,6 +190,17 @@ function set_global_listeners() { } } }); + var modals = document.getElementsByClassName('w3-modal'); + for (var i = 0; i < modals.length; i++) { + modals[i].addEventListener('click', function(e) { + var x = e.clientX; + var y = e.clientY; + var el = document.elementFromPoint(x, y); + if (el.classList.contains('w3-modal')) { + $(this).hide(); // shadow clicked, hide modal + } + }); + }; } -- 2.47.3