feature(key) add Ctrl + \ -> go to root

This commit is contained in:
coderaiser 2014-01-22 08:51:51 -05:00
parent 67d03c3b65
commit 65d3b61668
2 changed files with 17 additions and 8 deletions

View file

@ -94,6 +94,7 @@ Hot keys
- **Alt + s** - get all key bindings back
- **Ctrl + a** - select all files in a panel
- **up, down, enter** - filesystem navigation
- **Ctrl + \** - go to the root directory
- **Tab** - move via panels
- **Page Up** - up on one page
- **Page Down** - down on one page

View file

@ -51,7 +51,8 @@ var CloudCmd, Util, DOM;
F10 : 121,
SLASH : 191,
TRA : 192 /* Typewritten Reverse Apostrophe (`) */
TRA : 192, /* Typewritten Reverse Apostrophe (`) */
BACKSLASH : 220
};
KeyProto.prototype = KEY;
@ -83,10 +84,10 @@ var CloudCmd, Util, DOM;
var i, n,
lKeyCode = pEvent.keyCode,
lAlt = pEvent.altKey,
lCtrl = pEvent.ctrlKey;
ctrl = pEvent.ctrlKey;
/* если клавиши можно обрабатывать*/
if (Binded) {
if (!lAlt && !lCtrl && lKeyCode >= KEY.A && lKeyCode <= KEY.Z)
if (!lAlt && !ctrl && lKeyCode >= KEY.A && lKeyCode <= KEY.Z)
setCurrentByLetter(lKeyCode);
else {
Chars = [];
@ -172,7 +173,7 @@ var CloudCmd, Util, DOM;
lKeyCode = pEvent.keyCode,
shift = pEvent.shiftKey,
lAlt = pEvent.altKey,
lCtrl = pEvent.ctrlKey;
ctrl = pEvent.ctrlKey;
switch (lKeyCode) {
case Key.TAB:
@ -400,11 +401,18 @@ var CloudCmd, Util, DOM;
DOM.preventDefault(pEvent);
break;
case Key.BACKSLASH:
if (ctrl) {
path = '/';
Util.exec(CloudCmd.loadDir(path));
}
break;
case Key.A:
if (pEvent.ctrlKey) {
if (ctrl)
DOM .toggleAllSelectedFiles()
.preventDefault(pEvent);
}
break;
/*
@ -415,7 +423,7 @@ var CloudCmd, Util, DOM;
* (обновляем кэш)
*/
case Key.R:
if (lCtrl) {
if (ctrl) {
Util.log('<ctrl>+r pressed\n' +
'reloading page...\n' +
'press <alt>+q to remove all key-handlers');
@ -427,7 +435,7 @@ var CloudCmd, Util, DOM;
/* чистим кэш */
case Key.D:
if (lCtrl) {
if (ctrl) {
Util.log('<ctrl>+d pressed\n' +
'clearing Storage...\n' +
'press <alt>+q to remove all key-handlers');