|
|
@ -65,6 +65,12 @@ function showKeyboardShortcutsPanel(show) { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
let _shortcuts = {}; |
|
|
|
let _shortcuts = {}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* True if the keyboard shortcuts are enabled and false if not. |
|
|
|
|
|
|
|
* @type {boolean} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
let enabled = true; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Maps keycode to character, id of popover for given function and function. |
|
|
|
* Maps keycode to character, id of popover for given function and function. |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -74,6 +80,9 @@ var KeyboardShortcut = { |
|
|
|
|
|
|
|
|
|
|
|
var self = this; |
|
|
|
var self = this; |
|
|
|
window.onkeyup = function(e) { |
|
|
|
window.onkeyup = function(e) { |
|
|
|
|
|
|
|
if(!enabled) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
var key = self._getKeyboardKey(e).toUpperCase(); |
|
|
|
var key = self._getKeyboardKey(e).toUpperCase(); |
|
|
|
var num = parseInt(key, 10); |
|
|
|
var num = parseInt(key, 10); |
|
|
|
if(!($(":focus").is("input[type=text]") || |
|
|
|
if(!($(":focus").is("input[type=text]") || |
|
|
@ -93,6 +102,9 @@ var KeyboardShortcut = { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
window.onkeydown = function(e) { |
|
|
|
window.onkeydown = function(e) { |
|
|
|
|
|
|
|
if(!enabled) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
if(!($(":focus").is("input[type=text]") || |
|
|
|
if(!($(":focus").is("input[type=text]") || |
|
|
|
$(":focus").is("input[type=password]") || |
|
|
|
$(":focus").is("input[type=password]") || |
|
|
|
$(":focus").is("textarea"))) { |
|
|
|
$(":focus").is("textarea"))) { |
|
|
@ -105,6 +117,14 @@ var KeyboardShortcut = { |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Enables/Disables the keyboard shortcuts. |
|
|
|
|
|
|
|
* @param {boolean} value - the new value. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
enable: function (value) { |
|
|
|
|
|
|
|
enabled = value; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Registers a new shortcut. |
|
|
|
* Registers a new shortcut. |
|
|
|
* |
|
|
|
* |
|
|
|