]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Close modal windows on pressing ESC key
authorMarcin Haba <marcin.haba@bacula.pl>
Fri, 19 Jun 2020 01:47:46 +0000 (03:47 +0200)
committerMarcin Haba <marcin.haba@bacula.pl>
Fri, 19 Jun 2020 01:47:46 +0000 (03:47 +0200)
gui/baculum/protected/Web/JavaScript/misc.js

index 511ab6f556018210837c969dedd8c4b3748013dd..f43666662c5421dcdc792967ce739d20b29bcc89 100644 (file)
@@ -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();
 });