mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
36 lines
867 B
JavaScript
36 lines
867 B
JavaScript
'use strict';
|
|
|
|
/* global DOM */
|
|
module.exports.selectFileNotParent = selectFileNotParent;
|
|
function selectFileNotParent(current, {getCurrentName, selectFile} = DOM) {
|
|
const name = getCurrentName(current);
|
|
|
|
if (name === '..')
|
|
return;
|
|
|
|
selectFile(current);
|
|
}
|
|
|
|
module.exports.setCurrent = (sibling, {count, isVisual, isDelete}, {Info, setCurrentFile, unselectFiles, Operation}) => {
|
|
let current = Info.element;
|
|
const select = isVisual ? selectFileNotParent : unselectFiles;
|
|
|
|
select(current);
|
|
|
|
const position = `${sibling}Sibling`;
|
|
|
|
for (let i = 0; i < count; i++) {
|
|
const next = current[position];
|
|
|
|
if (!next)
|
|
break;
|
|
|
|
current = next;
|
|
select(current);
|
|
}
|
|
|
|
setCurrentFile(current);
|
|
|
|
if (isDelete)
|
|
Operation.show('delete');
|
|
};
|