mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-26 17:29:27 +00:00
refactor(dom) getSelectedNames: always return array
This commit is contained in:
parent
475633ecc6
commit
6646819746
1 changed files with 18 additions and 13 deletions
|
|
@ -1395,21 +1395,26 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
return lLink;
|
||||
};
|
||||
|
||||
this.getSelectedNames = function(pSelected) {
|
||||
var lSelected = pSelected || this.getSelectedFiles(),
|
||||
lRet = lSelected ? [] : null;
|
||||
this.getSelectedNames = function(selected) {
|
||||
var current, first, name, i, n,
|
||||
ret = [];
|
||||
|
||||
if (!selected)
|
||||
selected = this.getSelectedFiles() || [];
|
||||
|
||||
first = selected[0];
|
||||
name = this.getCurrentName(first);
|
||||
|
||||
if (lRet) {
|
||||
var lFirst = lSelected[0],
|
||||
lName = this.getCurrentName( lFirst );
|
||||
|
||||
if (lName === '..')
|
||||
this.toggleSelectedFile( lFirst );
|
||||
|
||||
for(var i = 0, n = lSelected.length; i < n;i++)
|
||||
lRet[i] = this.getCurrentName( lSelected[i] );
|
||||
if (name === '..')
|
||||
this.toggleSelectedFile(first);
|
||||
|
||||
n = selected.length;
|
||||
for (i = 0; i < n;i++) {
|
||||
current = selected[i];
|
||||
ret[i] = this.getCurrentName(current);
|
||||
}
|
||||
return lRet;
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue