mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
chore: lint
This commit is contained in:
parent
fcce26d4e1
commit
1bef0d4381
13 changed files with 54 additions and 61 deletions
|
|
@ -23,13 +23,13 @@ function BufferProto() {
|
|||
function showMessage(msg) {
|
||||
DOM.Dialog.alert(msg);
|
||||
}
|
||||
|
||||
|
||||
function getNames() {
|
||||
const files = DOM.getActiveFiles();
|
||||
|
||||
return DOM.getFilenames(files);
|
||||
}
|
||||
|
||||
|
||||
function addCutClass() {
|
||||
const files = DOM.getActiveFiles();
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ function BufferProto() {
|
|||
element.classList.add(CLASS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function rmCutClass() {
|
||||
const files = DOM.getByClassAll(CLASS);
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ function BufferProto() {
|
|||
element.classList.remove(CLASS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function callIfEnabled(callback) {
|
||||
const is = CloudCmd.config('buffer');
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ function BufferProto() {
|
|||
|
||||
showMessage('Buffer disabled in config!');
|
||||
}
|
||||
|
||||
|
||||
async function readBuffer() {
|
||||
const [e, cp, ct] = await tryToPromiseAll([
|
||||
Storage.getJson(COPY),
|
||||
|
|
@ -67,7 +67,7 @@ function BufferProto() {
|
|||
ct,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
async function copy() {
|
||||
const names = getNames();
|
||||
const from = Info.dirPath;
|
||||
|
|
@ -83,7 +83,7 @@ function BufferProto() {
|
|||
names,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async function cut() {
|
||||
const names = getNames();
|
||||
const from = Info.dirPath;
|
||||
|
|
@ -100,14 +100,14 @@ function BufferProto() {
|
|||
names,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async function clear() {
|
||||
await Storage.remove(COPY);
|
||||
await Storage.remove(CUT);
|
||||
|
||||
rmCutClass();
|
||||
}
|
||||
|
||||
|
||||
async function paste() {
|
||||
const [error, cp, ct] = await readBuffer();
|
||||
|
||||
|
|
@ -130,6 +130,6 @@ function BufferProto() {
|
|||
|
||||
await clear();
|
||||
}
|
||||
|
||||
|
||||
return Buffer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ module.exports.setCurrentFile = (currentFile, options) => {
|
|||
name,
|
||||
path,
|
||||
}));
|
||||
|
||||
|
||||
/* history could be present
|
||||
* but it should be false
|
||||
* to prevent default behavior
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ function EventsProto() {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* safe add event listener
|
||||
*
|
||||
|
|
@ -95,7 +95,7 @@ function EventsProto() {
|
|||
|
||||
return Events;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* safe add event listener
|
||||
*
|
||||
|
|
@ -118,7 +118,7 @@ function EventsProto() {
|
|||
|
||||
return Events;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* safe remove event listener
|
||||
*
|
||||
|
|
@ -135,7 +135,7 @@ function EventsProto() {
|
|||
|
||||
return Events;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* remove all added event listeners
|
||||
*
|
||||
|
|
@ -149,7 +149,7 @@ function EventsProto() {
|
|||
|
||||
EventStore.clear();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* safe add event keydown listener
|
||||
*
|
||||
|
|
@ -164,7 +164,7 @@ function EventsProto() {
|
|||
|
||||
return Events.add(...args);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* safe remove event click listener
|
||||
*
|
||||
|
|
@ -179,7 +179,7 @@ function EventsProto() {
|
|||
|
||||
return Events.remove(...args);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* safe add event click listener
|
||||
*
|
||||
|
|
@ -194,7 +194,7 @@ function EventsProto() {
|
|||
|
||||
return Events.add(...args);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* safe remove event click listener
|
||||
*
|
||||
|
|
@ -219,7 +219,7 @@ function EventsProto() {
|
|||
|
||||
return Events.add(...args);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* safe add event click listener
|
||||
*
|
||||
|
|
@ -234,7 +234,7 @@ function EventsProto() {
|
|||
|
||||
return Events.add(...args);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* safe add load click listener
|
||||
*
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@ module.exports = (name, options, callback = options) => {
|
|||
.then(async (modules) => {
|
||||
const online = config('online') && navigator.onLine;
|
||||
const module = findObjByNameInArr(modules.remote, name);
|
||||
|
||||
|
||||
const isArray = itype.array(module.local);
|
||||
const {version} = module;
|
||||
|
||||
|
||||
let remoteTmpls;
|
||||
let local;
|
||||
|
||||
|
||||
if (isArray) {
|
||||
remoteTmpls = module.remote;
|
||||
local = module.local;
|
||||
|
|
@ -36,22 +36,22 @@ module.exports = (name, options, callback = options) => {
|
|||
remoteTmpls = [module.remote];
|
||||
local = [module.local];
|
||||
}
|
||||
|
||||
|
||||
const localURL = local.map((url) => prefix + url);
|
||||
|
||||
|
||||
const remoteURL = remoteTmpls.map((tmpl) => {
|
||||
return rendy(tmpl, {
|
||||
version,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
if (online) {
|
||||
const [e] = await tryToCatch(load.parallel, remoteURL);
|
||||
|
||||
|
||||
if (!e)
|
||||
return callback();
|
||||
}
|
||||
|
||||
|
||||
const [e] = await tryToCatch(load.parallel, localURL);
|
||||
callback(e);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ function _loadFile(dir, n, file, callback) {
|
|||
.on('progress', (count) => {
|
||||
const max = step(n);
|
||||
const value = (i - 1) * max + percent(count, 100, max);
|
||||
|
||||
|
||||
Images.show.load('top');
|
||||
Images.setProgress(Math.round(value));
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue