From: Marcin Haba Date: Fri, 19 Jun 2020 01:47:46 +0000 (+0200) Subject: baculum: Close modal windows on pressing ESC key X-Git-Tag: Release-9.6.6~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04a604c16c267ead8b1d46cd89295720992e7d68;p=thirdparty%2Fbacula.git baculum: Close modal windows on pressing ESC key --- diff --git a/gui/baculum/protected/Web/JavaScript/misc.js b/gui/baculum/protected/Web/JavaScript/misc.js index 511ab6f55..f43666662 100644 --- a/gui/baculum/protected/Web/JavaScript/misc.js +++ b/gui/baculum/protected/Web/JavaScript/misc.js @@ -1221,8 +1221,21 @@ function get_table_toolbar(table, actions, txt) { return table_toolbar; } +function set_global_listeners() { + document.addEventListener('keydown', function(e) { + var key_code = e.keyCode || e.which; + switch (key_code) { + case 27: { // escape + $('.w3-modal').filter(':visible').hide(); // hide modals + break; + } + } + }); +} + $(function() { W3SideBar.init(); set_sbbr_compatibility(); set_icon_css(); + set_global_listeners(); });