diff --git a/ui/keybindings.js b/ui/keybindings.js index b294b3ff..919ec38d 100755 --- a/ui/keybindings.js +++ b/ui/keybindings.js @@ -40,6 +40,21 @@ function directionImage(reverse){ /*********************************************************************/ var KEYBOARD_CONFIG = { + // Global bindings... + '*': { + title: 'Global bindings', + + F4: { + alt: doc('Close viewer', + function(){ + closeWindow() + return false + }), + }, + F5: doc('Reload viewer', function(){ reload() }), + F12: doc('Show devTools', function(){ showDevTools() }), + }, + // info overlay... // // NOTE: this is here to prevent selecting images while trying to @@ -69,6 +84,7 @@ var KEYBOARD_CONFIG = { } }, + // dialogs... // '.viewer.overlay .overlay-block.dialog': { @@ -109,7 +125,6 @@ var KEYBOARD_CONFIG = { }, - // help mode... // // NOTE: need to keep all info modes before the rest so as to give @@ -301,8 +316,8 @@ var KEYBOARD_CONFIG = { // general setup... // '.viewer:not(.overlay)': { - title: 'Global', - doc: 'These key bindings work in most other modes.'+ + title: 'Viewer', + doc: 'These key bindings work in most other viewer modes.'+ '
NOTE: shifting all marked images from different ribbons will '+ 'perform the operations on ALL marked images but relative '+ @@ -632,11 +647,7 @@ var KEYBOARD_CONFIG = { E: doc('Open image in external software', openImage), // XXX make F4 a default editor and E a default viewer... - F4: { - default: 'E', - alt: doc('Close viewer', function(){ closeWindow() }), - }, - + F4: 'E', // info... I: { @@ -681,8 +692,8 @@ var KEYBOARD_CONFIG = { // XXX DEBUG MODE... // ...remove these in production... - F12: doc('Show devTools', function(){ showDevTools() }), - F5: doc('Reload app', function(){ reload() }), + //F12: doc('Show devTools', function(){ showDevTools() }), + //F5: doc('Reload app', function(){ reload() }), /* testing the shift-key feature... '~': { diff --git a/ui/lib/keyboard.js b/ui/lib/keyboard.js index 5ac38d68..a141ff91 100755 --- a/ui/lib/keyboard.js +++ b/ui/lib/keyboard.js @@ -186,12 +186,16 @@ function getKeyHandlers(key, modifiers, keybindings, modes, shifted_keys){ for(var mode in keybindings){ - // test for mode compatibility... - // XXX this fails for explicitly given mode... - if(modes != 'all' - && (modes != 'any' - && modes != mode - || $(mode).length == 0)){ + // check if we need to skip this mode... + if( !(modes == 'all' + // explicit mode match... + || modes == mode + // 'any' means we need to check the mode... + || (modes == 'any' + // '*' allways matches... + && mode == '*' + // match the mode... + || $(mode).length != 0))){ continue }