refactor(key) switchKey

This commit is contained in:
coderaiser 2014-01-21 03:28:58 -05:00
parent 0402bbb127
commit 070d89bad0

View file

@ -160,6 +160,7 @@ var CloudCmd, Util, DOM;
function switchKey(pEvent) {
var i, n,
lCurrent = Info.element,
panel = Info.panel,
prev = lCurrent.previousSibling,
next = lCurrent.nextSibling,
lKeyCode = pEvent.keyCode,
@ -169,21 +170,20 @@ var CloudCmd, Util, DOM;
switch (lKeyCode) {
case Key.TAB:
var lFirstFileOnList,
lPanel = Info.panel,
lId = lPanel.id;
var lFirstFileOnList, id;
lTabPanel[lId] = lCurrent;
id = panel.id;
lTabPanel[id] = lCurrent;
lPanel = Info.panelPassive;
lId = lPanel.id;
panel = Info.panelPassive;
id = panel.id;
lCurrent = lTabPanel[lId];
lCurrent = lTabPanel[id];
if (lCurrent && lCurrent.parentElement)
DOM.setCurrentFile(lCurrent);
else {
lFirstFileOnList = DOM.getByTag('li', lPanel)[2];
lFirstFileOnList = DOM.getByTag('li', panel)[2];
DOM.setCurrentFile(lFirstFileOnList);
}
@ -335,7 +335,7 @@ var CloudCmd, Util, DOM;
/* если нажали клавишу page down проматываем экран */
case Key.PAGE_DOWN:
DOM.scrollByPages( DOM.getPanel(), 1 );
DOM.scrollByPages(panel, 1);
for (i = 0; i < 30; i++) {
@ -350,7 +350,7 @@ var CloudCmd, Util, DOM;
/* если нажали клавишу page up проматываем экран */
case Key.PAGE_UP:
DOM.scrollByPages(DOM.getPanel(), -1);
DOM.scrollByPages(panel, -1);
var tryCatch = function(pCurrentFile) {
Util.tryCatch(function() {