mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
chore(dom) getPanel: es2015-ify
This commit is contained in:
parent
ce8b075f46
commit
0803780a30
1 changed files with 12 additions and 12 deletions
|
|
@ -849,22 +849,23 @@ function CmdProto() {
|
|||
* @param options = {active: true}
|
||||
*/
|
||||
this.getPanel = (options) => {
|
||||
var files, panel, isLeft,
|
||||
dataName = 'js-',
|
||||
current = DOM.getCurrentFile();
|
||||
let files, panel, isLeft;
|
||||
let dataName = 'js-';
|
||||
|
||||
const current = DOM.getCurrentFile();
|
||||
|
||||
if (!current) {
|
||||
panel = DOM.getByDataName('js-left');
|
||||
panel = DOM.getByDataName('js-left');
|
||||
} else {
|
||||
files = current.parentElement,
|
||||
panel = files.parentElement,
|
||||
isLeft = panel.getAttribute('data-name') === 'js-left';
|
||||
files = current.parentElement,
|
||||
panel = files.parentElement,
|
||||
isLeft = panel.getAttribute('data-name') === 'js-left';
|
||||
}
|
||||
|
||||
|
||||
/* if {active : false} getting passive panel */
|
||||
if (options && !options.active) {
|
||||
dataName += isLeft ? 'right' : 'left';
|
||||
panel = DOM.getByDataName(dataName);
|
||||
dataName += isLeft ? 'right' : 'left';
|
||||
panel = DOM.getByDataName(dataName);
|
||||
}
|
||||
|
||||
/* if two panels showed
|
||||
|
|
@ -873,11 +874,10 @@ function CmdProto() {
|
|||
*/
|
||||
if (window.innerWidth < CloudCmd.MIN_ONE_PANEL_WIDTH)
|
||||
panel = DOM.getByDataName('js-left');
|
||||
|
||||
|
||||
if (!panel)
|
||||
throw Error('can not find Active Panel!');
|
||||
|
||||
|
||||
return panel;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue