fix(dom) CurrentInfo: prev, next not updates

This commit is contained in:
coderaiser 2013-12-24 09:57:42 +00:00
parent a5d6f4a623
commit 48106b93d4
2 changed files with 18 additions and 16 deletions

View file

@ -1089,6 +1089,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
},
CmdProto = function() {
var Cmd = this,
CurrentInfo = {},
CURRENT_FILE = 'current-file',
SELECTED_FILE = 'selected-file',
Title;
@ -1252,7 +1253,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
if (lCurrent || lSelected)
RESTful.delete(lUrl, lSelected, function() {
var dirPath = CurrentInfo.dirPath;
var dirPath = CurrentInfo.dirPath,
dir = CloudFunc.rmLastSlash(dirPath);
if (n > 1)
@ -1864,14 +1865,15 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
* @param pPanel_o = {active: true}
*/
this.getPanel = function(pActive) {
var lCurrent = this.getCurrentFile(),
files = lCurrent.parentElement,
lPanel = files.parentElement;
var files, panel, id,
current = this.getCurrentFile();
files = current.parentElement;
panel = files.parentElement;
/* if {active : false} getting passive panel */
if (pActive && !pActive.active) {
var lId = lPanel.id === 'left' ? 'right' : 'left';
lPanel = this.getById(lId);
id = panel.id === 'left' ? 'right' : 'left';
panel = this.getById(id);
}
/* if two panels showed
@ -1879,13 +1881,13 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
* panel
*/
if (window.innerWidth < CloudCmd.MIN_ONE_PANEL_WIDTH)
lPanel = this.getById('left');
panel = this.getById('left');
if (!lPanel)
if (!panel)
Util.log('Error can not find Active Panel');
return lPanel;
return panel;
};
this.getFiles = function(panel) {
@ -2148,7 +2150,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
Util.exec(callback, ext);
});
};
this.CurrentInfo = {},
this.CurrentInfo = CurrentInfo,
this.updateCurrentInfo = function(pCurrent) {
var info = Cmd.CurrentInfo,
current = pCurrent || Cmd.getCurrentFile(),
@ -2164,13 +2166,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
info.getData = Cmd.getCurrentData;
info.last = current.parentElement.lastChild;
info.link = Cmd.getCurrentLink(current);
info.next = current.nextSibling;
info.mode = Cmd.getCurrentMode(current);
info.name = name;
info.path = Cmd.getCurrentPath(current);
info.panel = panel;
info.panelPassive = Cmd.getPanel({active:false});
info.prev = current.previousSibling;
info.size = Cmd.getCurrentSize(current);
info.isDir = Cmd.isCurrentIsDir();
info.isSelected = Cmd.isSelected(current);

View file

@ -156,6 +156,8 @@ var CloudCmd, Util, DOM;
function switchKey(pEvent) {
var i, n,
lCurrent = Info.element,
prev = lCurrent.previousSibling,
next = lCurrent.nextSibling,
lKeyCode = pEvent.keyCode,
lShift = pEvent.shiftKey,
lAlt = pEvent.altKey,
@ -287,7 +289,7 @@ var CloudCmd, Util, DOM;
if (lShift)
DOM.toggleSelectedFile(lCurrent);
DOM.setCurrentFile(Info.prev);
DOM.setCurrentFile(prev);
DOM.preventDefault(pEvent);
break;
@ -296,7 +298,7 @@ var CloudCmd, Util, DOM;
if (lShift)
DOM.toggleSelectedFile(lCurrent);
DOM.setCurrentFile(Info.next);
DOM.setCurrentFile(next);
DOM.preventDefault(pEvent);
break;