diff --git a/client/input.js b/client/input.js index e475e77fa3..a8737df8f6 100644 --- a/client/input.js +++ b/client/input.js @@ -26,19 +26,15 @@ module.exports.getName = (element) => { }; module.exports.convert = (config) => { - const result = { - ...config, - }; + const result = {}; + const array = Object.keys(config); - const array = Object.keys(result); + const filtered = array.filter(isBool(config)); - array - .filter(isBool(result)) - .forEach((name) => { - const item = result[name]; - - result[name] = setState(item); - }); + for (const name of filtered) { + const item = config[name]; + result[name] = setState(item); + } return result; }; diff --git a/client/listeners/index.js b/client/listeners/index.js index 54d9d0c2b5..d2170b5da1 100644 --- a/client/listeners/index.js +++ b/client/listeners/index.js @@ -44,9 +44,8 @@ const unselect = (event) => { }; const execAll = currify((funcs, event) => { - funcs.forEach((fn) => { + for (const fn of funcs) fn(event); - }); }); const Info = DOM.CurrentInfo; @@ -260,7 +259,7 @@ function toggleSelect(key, files) { return DOM.toggleSelectedFile(file); if (key.shift) - return files.forEach(DOM.selectFile); + return files.map(DOM.selectFile); } function changePanel(element) { @@ -404,16 +403,12 @@ function contextMenu() { function dragndrop() { const panels = DOM.getByClassAll('panel'); - const select = () => { - [...panels].forEach((panel) => { - panel.classList.add('selected-panel'); - }); + const select = ({target}) => { + target.classList.add('selected-panel'); }; - const unselect = () => { - [...panels].forEach((panel) => { - panel.classList.remove('selected-panel'); - }); + const unselect = ({target}) => { + target.classList.remove('selected-panel'); }; const onDrop = (event) => { @@ -458,13 +453,12 @@ function dragndrop() { event.preventDefault(); }; - Events.add('dragenter', select); - Events.add(['dragleave', 'drop'], unselect); - - [...panels].forEach((panel) => { - Events.add('dragover', panel, onDragOver) - .add('drop', panel, onDrop); - }); + for (const panel of panels) + Events + .add('dragover', panel, onDragOver) + .add('drop', panel, onDrop) + .add('dragenter', select) + .add(['dragleave', 'drop'], unselect); } function unload() { diff --git a/client/modules/edit-file.js b/client/modules/edit-file.js index a91f901c68..a80129701e 100644 --- a/client/modules/edit-file.js +++ b/client/modules/edit-file.js @@ -79,6 +79,7 @@ module.exports.show = (options) => { setMsgChanged(name); CloudCmd.Edit + .setInfo(name) .getEditor() .setValueFirst(path, data) .setModeForPath(name) diff --git a/client/modules/edit.js b/client/modules/edit.js index e3e75d8149..e8b65126f6 100644 --- a/client/modules/edit.js +++ b/client/modules/edit.js @@ -21,8 +21,15 @@ let Loading = true; let Element; let editor; +let InfoElement; + const ConfigView = { + beforeClose: () => { + document.body.removeChild(InfoElement); + }, afterShow: () => { + document.body.appendChild(InfoElement); + editor .moveCursorTo(0, 0) .focus(); diff --git a/client/modules/terminal.js b/client/modules/terminal.js index ee33f4aeb0..d9bd8e4d6b 100644 --- a/client/modules/terminal.js +++ b/client/modules/terminal.js @@ -51,7 +51,6 @@ module.exports.init = async () => { await CloudCmd.View(); await loadAll(); - await create(); }; module.exports.show = show; @@ -86,6 +85,8 @@ function create() { fontFamily: 'Droid Sans Mono', }; + delete window.IntersectionObserver; + const {socket, terminal} = gritty(document.body, options); Socket = socket; @@ -94,10 +95,13 @@ function create() { Terminal.on('key', (char, {keyCode, shiftKey}) => { if (shiftKey && keyCode === Key.ESC) { hide(); + CloudCmd.refresh(); } }); - Socket.on('connect', exec.with(authCheck, socket)); + socket.on('connect', exec.with(authCheck, socket)); + socket.on('exit', function() { hide(); CloudCmd.refresh(); }); + } function authCheck(spawn) { @@ -114,6 +118,8 @@ function show() { if (!config('terminal')) return; + + create(); CloudCmd.View.show(Terminal.element, { afterShow: () => { diff --git a/client/modules/user-menu/default-menu.js b/client/modules/user-menu/default-menu.js index d2b4009710..ceaf37d26c 100644 --- a/client/modules/user-menu/default-menu.js +++ b/client/modules/user-menu/default-menu.js @@ -16,7 +16,6 @@ module.exports = { 'C - Create User Menu File': async ({DOM, CloudCmd, tryToCatch}) => { const { - Dialog, RESTful, CurrentInfo, } = DOM; diff --git a/client/modules/view.js b/client/modules/view.js index 8c52a83015..e2db1116a0 100644 --- a/client/modules/view.js +++ b/client/modules/view.js @@ -168,21 +168,22 @@ function initConfig(Config, options) { if (!options) return config; - Object.keys(options).forEach((name) => { + const names = Object.keys(options); + for (const name of names) { const isConfig = !!config[name]; const item = options[name]; const isFunc = itype.function(item); if (!isFunc || !isConfig) { config[name] = options[name]; - return; + continue; } const func = config[name]; config[name] = () => { exec.series([func, item]); }; - }); + } return config; } diff --git a/help-compile.sh b/help-compile.sh new file mode 100644 index 0000000000..9445a8709a --- /dev/null +++ b/help-compile.sh @@ -0,0 +1,7 @@ +export NODE_PATH="$(pwd)/node_modules:/usr/lib/node_modules" +alias redrun="node $(pwd)/node_modules/redrun/bin/redrun.js" +alias rimraf="node $(pwd)/node_modules/rimraf/rimraf.js" +#alias webpack="node $(pwd)/node_modules/webpack/bin/webpack.js" +#alias webpack-cli="node $(pwd)/node_modules/webpack-cli/bin/cli.js" +#alias webpack-cli="node $(pwd)/node_modules/webpack-merge/bin/cli.js" +# now we can call yarn diff --git a/help-install.sh b/help-install.sh new file mode 100644 index 0000000000..ec18b82c0a --- /dev/null +++ b/help-install.sh @@ -0,0 +1,11 @@ +npm i gritty +npm i rimraf +npm i madrun +#npm install webpack +#npm install webpack-cli +#npm install webpack-cli +#npm install webpack-merge +#npm install html-webpack-plugin +#npm install extract-text-webpack-plugin +#npm install optimize-css-assets-webpack-plugin +#npm install serviceworker-webpack-plugin diff --git a/html/index.html b/html/index.html index 7f6edac541..2c91834f77 100644 --- a/html/index.html +++ b/html/index.html @@ -31,7 +31,7 @@ - + diff --git a/tmpl/config.hbs b/tmpl/config.hbs index 742c2b24a9..9bd6b55c1a 100644 --- a/tmpl/config.hbs +++ b/tmpl/config.hbs @@ -157,6 +157,12 @@