Add shortcut key for deleting selected torrents

Added processing of pressing 'Delete' key on keyboard.
This commit is contained in:
buinsky 2015-01-29 22:29:28 +03:00
parent 28b976bdb8
commit 0fee2216d0
2 changed files with 16 additions and 5 deletions

View file

@ -352,11 +352,20 @@ window.addEvent('load', function () {
function closeWindows() {
MochaUI.closeAll();
}
};
window.addEvent('keydown', function (event) {
if (event.key == 'a' && event.control) {
event.stop();
myTable.selectAll();
var keyboardEvents = new Keyboard({
defaultEventType: 'keydown',
events: {
'ctrl+a': function(event) {
myTable.selectAll();
event.preventDefault();
},
'delete': function(event) {
deleteFN();
event.preventDefault();
}
}
});
keyboardEvents.activate();

View file

@ -29,6 +29,8 @@ function getLocalStorageItem(name, defaultVal) {
return val;
}
var deleteFN = function() {};
initializeWindows = function() {
function addClickEvent(el, fn) {