From ad07018abf017b81fd2c0874e2216479d2717423 Mon Sep 17 00:00:00 2001 From: Patrick Lekaj Date: Sun, 25 Aug 2019 23:40:12 +0200 Subject: [PATCH] Revert "Add swap inputs feature" This reverts commit 88c78439240f162620978ff044c56c5a4ab7bb03. --- src/core/Operation.mjs | 20 ------------------- src/core/config/scripts/generateConfig.mjs | 17 ++++++++-------- src/core/config/scripts/newOperation.mjs | 9 --------- src/core/operations/ConvertArea.mjs | 1 - src/core/operations/ConvertDataUnits.mjs | 1 - src/core/operations/ConvertDistance.mjs | 1 - src/core/operations/ConvertMass.mjs | 1 - src/core/operations/ConvertSpeed.mjs | 1 - src/web/HTMLOperation.mjs | 20 ++++++++----------- src/web/Manager.mjs | 1 - src/web/stylesheets/components/_operation.css | 5 ----- src/web/waiters/RecipeWaiter.mjs | 17 ---------------- 12 files changed, 16 insertions(+), 78 deletions(-) diff --git a/src/core/Operation.mjs b/src/core/Operation.mjs index d9f0aa93..32ecff07 100755 --- a/src/core/Operation.mjs +++ b/src/core/Operation.mjs @@ -24,7 +24,6 @@ class Operation { this._disabled = false; this._flowControl = false; this._manualBake = false; - this._inputSwapable = false; this._ingList = []; // Public fields @@ -317,25 +316,6 @@ class Operation { this._manualBake = !!value; } - /** - * Returns true if this Operation has swapable input values. - * - * @returns {boolean} - */ - get inputSwapable() { - return this._inputSwapable; - } - - - /** - * Set whether this Operation shoud show swap input icon. - * - * @param {boolean} value - */ - set inputSwapable(value) { - this._inputSwapable = !!value; - } - } export default Operation; diff --git a/src/core/config/scripts/generateConfig.mjs b/src/core/config/scripts/generateConfig.mjs index ea695b51..8ef906e6 100644 --- a/src/core/config/scripts/generateConfig.mjs +++ b/src/core/config/scripts/generateConfig.mjs @@ -35,15 +35,14 @@ for (const opObj in Ops) { const op = new Ops[opObj](); operationConfig[op.name] = { - module: op.module, - description: op.description, - infoURL: op.infoURL, - inputType: op.inputType, - outputType: op.presentType, - flowControl: op.flowControl, - inputSwapable: op.inputSwapable, - manualBake: op.manualBake, - args: op.args + module: op.module, + description: op.description, + infoURL: op.infoURL, + inputType: op.inputType, + outputType: op.presentType, + flowControl: op.flowControl, + manualBake: op.manualBake, + args: op.args }; if ("patterns" in op) { diff --git a/src/core/config/scripts/newOperation.mjs b/src/core/config/scripts/newOperation.mjs index e0c21667..03753fae 100644 --- a/src/core/config/scripts/newOperation.mjs +++ b/src/core/config/scripts/newOperation.mjs @@ -77,14 +77,6 @@ If your operation does not rely on a library, just leave this blank and it will required: true, message: `The output type should be one of: ${ioTypes.join(", ")}.` }, - inputSwapable: { - description: "Input swappable option shows an icon that can swap input values of two ingredients.", - example: "true/false", - prompt: "Show input swaping", - type: "boolean", - default: "false", - message: "Enter true or false to specify if input spawing should be shown." - }, highlight: { description: "If your operation does not change the length of the input in any way, we can enable highlighting. If it does change the length in a predictable way, we may still be able to enable highlighting and calculate the correct offsets. If this is not possible, we will disable highlighting for this operation.", example: "true/false", @@ -158,7 +150,6 @@ class ${moduleName} extends Operation { this.infoURL = "${result.infoURL}"; this.inputType = "${result.inputType}"; this.outputType = "${result.outputType}"; - this.inputSwapable = "${result.inputSwapable}"; this.args = [ /* Example arguments. See the project wiki for full details. { diff --git a/src/core/operations/ConvertArea.mjs b/src/core/operations/ConvertArea.mjs index 5eba73ec..4cce31b1 100644 --- a/src/core/operations/ConvertArea.mjs +++ b/src/core/operations/ConvertArea.mjs @@ -23,7 +23,6 @@ class ConvertArea extends Operation { this.infoURL = "https://wikipedia.org/wiki/Orders_of_magnitude_(area)"; this.inputType = "BigNumber"; this.outputType = "BigNumber"; - this.inputSwapable = true; this.args = [ { "name": "Input units", diff --git a/src/core/operations/ConvertDataUnits.mjs b/src/core/operations/ConvertDataUnits.mjs index 3253fe51..baed9004 100644 --- a/src/core/operations/ConvertDataUnits.mjs +++ b/src/core/operations/ConvertDataUnits.mjs @@ -23,7 +23,6 @@ class ConvertDataUnits extends Operation { this.infoURL = "https://wikipedia.org/wiki/Orders_of_magnitude_(data)"; this.inputType = "BigNumber"; this.outputType = "BigNumber"; - this.inputSwapable = true; this.args = [ { "name": "Input units", diff --git a/src/core/operations/ConvertDistance.mjs b/src/core/operations/ConvertDistance.mjs index 1b3d9a87..1a5fc8af 100644 --- a/src/core/operations/ConvertDistance.mjs +++ b/src/core/operations/ConvertDistance.mjs @@ -23,7 +23,6 @@ class ConvertDistance extends Operation { this.infoURL = "https://wikipedia.org/wiki/Orders_of_magnitude_(length)"; this.inputType = "BigNumber"; this.outputType = "BigNumber"; - this.inputSwapable = true; this.args = [ { "name": "Input units", diff --git a/src/core/operations/ConvertMass.mjs b/src/core/operations/ConvertMass.mjs index 87ed7129..712884ed 100644 --- a/src/core/operations/ConvertMass.mjs +++ b/src/core/operations/ConvertMass.mjs @@ -23,7 +23,6 @@ class ConvertMass extends Operation { this.infoURL = "https://wikipedia.org/wiki/Orders_of_magnitude_(mass)"; this.inputType = "BigNumber"; this.outputType = "BigNumber"; - this.inputSwapable = true; this.args = [ { "name": "Input units", diff --git a/src/core/operations/ConvertSpeed.mjs b/src/core/operations/ConvertSpeed.mjs index db865bfd..7fc6718d 100644 --- a/src/core/operations/ConvertSpeed.mjs +++ b/src/core/operations/ConvertSpeed.mjs @@ -23,7 +23,6 @@ class ConvertSpeed extends Operation { this.infoURL = "https://wikipedia.org/wiki/Orders_of_magnitude_(speed)"; this.inputType = "BigNumber"; this.outputType = "BigNumber"; - this.inputSwapable = true; this.args = [ { "name": "Input units", diff --git a/src/web/HTMLOperation.mjs b/src/web/HTMLOperation.mjs index 9145caa0..fe075c48 100755 --- a/src/web/HTMLOperation.mjs +++ b/src/web/HTMLOperation.mjs @@ -21,16 +21,15 @@ class HTMLOperation { * @param {Manager} manager - The CyberChef event manager. */ constructor(name, config, app, manager) { - this.app = app; - this.manager = manager; + this.app = app; + this.manager = manager; - this.name = name; - this.description = config.description; - this.infoURL = config.infoURL; - this.manualBake = config.manualBake || false; - this.inputSwappable = config.inputSwappable || false; - this.config = config; - this.ingList = []; + this.name = name; + this.description = config.description; + this.infoURL = config.infoURL; + this.manualBake = config.manualBake || false; + this.config = config; + this.ingList = []; for (let i = 0; i < config.args.length; i++) { const ing = new HTMLIngredient(config.args[i], this.app, this.manager); @@ -78,9 +77,6 @@ class HTMLOperation { for (let i = 0; i < this.ingList.length; i++) { html += this.ingList[i].toHtml(); - if (this.inputSwappable && i === 0) { - html += "
swap_horiz
"; - } } html += ` diff --git a/src/web/Manager.mjs b/src/web/Manager.mjs index 5db822db..cb579721 100755 --- a/src/web/Manager.mjs +++ b/src/web/Manager.mjs @@ -137,7 +137,6 @@ class Manager { this.addDynamicListener(".arg[type=checkbox], .arg[type=radio], select.arg", "change", this.recipe.ingChange, this.recipe); this.addDynamicListener(".disable-icon", "click", this.recipe.disableClick, this.recipe); this.addDynamicListener(".breakpoint", "click", this.recipe.breakpointClick, this.recipe); - this.addDynamicListener(".swap-icon", "click", this.recipe.swapInputClick, this.recipe); this.addDynamicListener("#rec-list li.operation", "dblclick", this.recipe.operationDblclick, this.recipe); this.addDynamicListener("#rec-list li.operation > div", "dblclick", this.recipe.operationChildDblclick, this.recipe); this.addDynamicListener("#rec-list .dropdown-menu.toggle-dropdown a", "click", this.recipe.dropdownToggleClick, this.recipe); diff --git a/src/web/stylesheets/components/_operation.css b/src/web/stylesheets/components/_operation.css index affaa03d..a4255fc3 100755 --- a/src/web/stylesheets/components/_operation.css +++ b/src/web/stylesheets/components/_operation.css @@ -240,11 +240,6 @@ div.toggle-string { cursor: pointer; } -.swap-icon { - margin-top: 1.75rem; - cursor: pointer; -} - .disable-icon { color: var(--disable-icon-colour); } diff --git a/src/web/waiters/RecipeWaiter.mjs b/src/web/waiters/RecipeWaiter.mjs index 65a96016..d198098b 100755 --- a/src/web/waiters/RecipeWaiter.mjs +++ b/src/web/waiters/RecipeWaiter.mjs @@ -261,23 +261,6 @@ class RecipeWaiter { window.dispatchEvent(this.manager.statechange); } - /** - * Handler for swap input click event. - * Swaps values of two inputs. - * - * @fires Manager#statechange - * @param {event} e - */ - swapInputClick(e) { - const si = e.target; - const ings = si.parentNode.parentNode.querySelectorAll(".arg"); - - if (ings.length === 2) { - const left = ings[0], right = ings[1]; - [left.value, right.value] = [right.value, left.value]; - this.ingChange(); - } - } /** * Handler for operation doubleclick events.