From: Marcin Haba Date: Sun, 7 Nov 2021 05:01:26 +0000 (+0100) Subject: baculum: Add capability to close modal windows on clicking gray shadow X-Git-Tag: Release-11.0.6~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50596e71bf19e435b79b70f5c20f2d949151ae95;p=thirdparty%2Fbacula.git baculum: Add capability to close modal windows on clicking gray shadow --- 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 + } + }); + }; }