From 6b76b7004a9d832acd4f19803c9990b18288b846 Mon Sep 17 00:00:00 2001 From: thezero Date: Sun, 14 Apr 2019 15:08:10 +0200 Subject: [PATCH 01/10] add button to hide recipe's options --- src/web/HTMLOperation.mjs | 1 + src/web/Manager.mjs | 1 + src/web/waiters/RecipeWaiter.mjs | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/src/web/HTMLOperation.mjs b/src/web/HTMLOperation.mjs index fe075c48..f46b3ba8 100755 --- a/src/web/HTMLOperation.mjs +++ b/src/web/HTMLOperation.mjs @@ -83,6 +83,7 @@ class HTMLOperation {
pause not_interested + keyboard_arrow_up
 
`; diff --git a/src/web/Manager.mjs b/src/web/Manager.mjs index e1e07dfd..64dc3a35 100755 --- a/src/web/Manager.mjs +++ b/src/web/Manager.mjs @@ -135,6 +135,7 @@ class Manager { // Recipe this.addDynamicListener(".arg:not(select)", "input", this.recipe.ingChange, this.recipe); this.addDynamicListener(".arg[type=checkbox], .arg[type=radio], select.arg", "change", this.recipe.ingChange, this.recipe); + this.addDynamicListener(".hide-options", "click", this.recipe.hideOptClick, this.recipe); this.addDynamicListener(".disable-icon", "click", this.recipe.disableClick, this.recipe); this.addDynamicListener(".breakpoint", "click", this.recipe.breakpointClick, this.recipe); this.addDynamicListener("#rec-list li.operation", "dblclick", this.recipe.operationDblclick, this.recipe); diff --git a/src/web/waiters/RecipeWaiter.mjs b/src/web/waiters/RecipeWaiter.mjs index ba0e7b11..afa3e72b 100755 --- a/src/web/waiters/RecipeWaiter.mjs +++ b/src/web/waiters/RecipeWaiter.mjs @@ -214,6 +214,30 @@ class RecipeWaiter { window.dispatchEvent(this.manager.statechange); } + /** + * Handler for hide-opt click events. + * Updates the icon status. + * + * @fires Manager#statechange + * @param {event} e + */ + hideOptClick(e) { + const icon = e.target; + + if (icon.getAttribute("hide-opt") === "false") { + icon.setAttribute("hide-opt", "true"); + icon.innerText = "keyboard_arrow_down"; + icon.classList.add("hide-options-selected"); + icon.parentNode.previousElementSibling.style.display = "none"; + } else { + icon.setAttribute("hide-opt", "false"); + icon.innerText = "keyboard_arrow_up"; + icon.classList.remove("hide-options-selected"); + icon.parentNode.previousElementSibling.style.display = "grid"; + } + + window.dispatchEvent(this.manager.statechange); + } /** * Handler for disable click events. From 3bb6a40f82e98fbc4cf45c82f75c033725862282 Mon Sep 17 00:00:00 2001 From: thezero Date: Mon, 22 Apr 2019 00:18:52 +0200 Subject: [PATCH 02/10] add button to hide all recipe options --- src/web/Manager.mjs | 1 + src/web/html/index.html | 3 +++ src/web/waiters/ControlsWaiter.mjs | 30 ++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/src/web/Manager.mjs b/src/web/Manager.mjs index 64dc3a35..493d3a19 100755 --- a/src/web/Manager.mjs +++ b/src/web/Manager.mjs @@ -120,6 +120,7 @@ class Manager { document.getElementById("load-delete-button").addEventListener("click", this.controls.loadDeleteClick.bind(this.controls)); document.getElementById("load-name").addEventListener("change", this.controls.loadNameChange.bind(this.controls)); document.getElementById("load-button").addEventListener("click", this.controls.loadButtonClick.bind(this.controls)); + document.getElementById("hide-icon").addEventListener("click", this.controls.hideRecipeOptClick.bind(this.recipe)); document.getElementById("support").addEventListener("click", this.controls.supportButtonClick.bind(this.controls)); this.addMultiEventListeners("#save-texts textarea", "keyup paste", this.controls.saveTextChange, this.controls); diff --git a/src/web/html/index.html b/src/web/html/index.html index 121f0780..ad940040 100755 --- a/src/web/html/index.html +++ b/src/web/html/index.html @@ -177,6 +177,9 @@
Recipe + diff --git a/src/web/waiters/ControlsWaiter.mjs b/src/web/waiters/ControlsWaiter.mjs index 2f2705aa..b051e3ce 100755 --- a/src/web/waiters/ControlsWaiter.mjs +++ b/src/web/waiters/ControlsWaiter.mjs @@ -333,6 +333,36 @@ class ControlsWaiter { } + /** + * Hides the options for all the operations in the current recipe. + */ + hideRecipeOptClick() { + const icon = document.getElementById("hide-icon"); + + if (icon.getAttribute("hide-opt") === "false") { + icon.setAttribute("hide-opt", "true"); + icon.setAttribute("data-original-title", "Show options"); + icon.children[0].innerText = "keyboard_arrow_down"; + Array.from(document.getElementsByClassName("hide-options")).forEach(function(item){ + item.setAttribute("hide-opt", "true"); + item.innerText = "keyboard_arrow_down"; + item.classList.add("hide-options-selected"); + item.parentNode.previousElementSibling.style.display = "none"; + }); + } else { + icon.setAttribute("hide-opt", "false"); + icon.setAttribute("data-original-title", "Hide options"); + icon.children[0].innerText = "keyboard_arrow_up"; + Array.from(document.getElementsByClassName("hide-options")).forEach(function(item){ + item.setAttribute("hide-opt", "false"); + item.innerText = "keyboard_arrow_up"; + item.classList.remove("hide-options-selected"); + item.parentNode.previousElementSibling.style.display = "grid"; + }); + } + } + + /** * Populates the bug report information box with useful technical info. * From ed7baf57f0dbc04e07b1479b1e045b7c307d60c1 Mon Sep 17 00:00:00 2001 From: thezero Date: Wed, 21 Oct 2020 00:17:06 +0200 Subject: [PATCH 03/10] replace "options" with "arguments", invert global hide-icon if needed --- src/web/HTMLOperation.mjs | 2 +- src/web/Manager.mjs | 4 ++-- src/web/html/index.html | 2 +- src/web/waiters/ControlsWaiter.mjs | 26 ++++++++++++------------- src/web/waiters/RecipeWaiter.mjs | 31 +++++++++++++++++++++++------- 5 files changed, 41 insertions(+), 24 deletions(-) diff --git a/src/web/HTMLOperation.mjs b/src/web/HTMLOperation.mjs index f46b3ba8..285fe10e 100755 --- a/src/web/HTMLOperation.mjs +++ b/src/web/HTMLOperation.mjs @@ -83,7 +83,7 @@ class HTMLOperation {
pause not_interested - keyboard_arrow_up + keyboard_arrow_up
 
`; diff --git a/src/web/Manager.mjs b/src/web/Manager.mjs index 493d3a19..f7e08aa6 100755 --- a/src/web/Manager.mjs +++ b/src/web/Manager.mjs @@ -120,7 +120,7 @@ class Manager { document.getElementById("load-delete-button").addEventListener("click", this.controls.loadDeleteClick.bind(this.controls)); document.getElementById("load-name").addEventListener("change", this.controls.loadNameChange.bind(this.controls)); document.getElementById("load-button").addEventListener("click", this.controls.loadButtonClick.bind(this.controls)); - document.getElementById("hide-icon").addEventListener("click", this.controls.hideRecipeOptClick.bind(this.recipe)); + document.getElementById("hide-icon").addEventListener("click", this.controls.hideRecipeArgsClick.bind(this.recipe)); document.getElementById("support").addEventListener("click", this.controls.supportButtonClick.bind(this.controls)); this.addMultiEventListeners("#save-texts textarea", "keyup paste", this.controls.saveTextChange, this.controls); @@ -136,7 +136,7 @@ class Manager { // Recipe this.addDynamicListener(".arg:not(select)", "input", this.recipe.ingChange, this.recipe); this.addDynamicListener(".arg[type=checkbox], .arg[type=radio], select.arg", "change", this.recipe.ingChange, this.recipe); - this.addDynamicListener(".hide-options", "click", this.recipe.hideOptClick, this.recipe); + this.addDynamicListener(".hide-args-icon", "click", this.recipe.hideArgsClick, this.recipe); this.addDynamicListener(".disable-icon", "click", this.recipe.disableClick, this.recipe); this.addDynamicListener(".breakpoint", "click", this.recipe.breakpointClick, this.recipe); this.addDynamicListener("#rec-list li.operation", "dblclick", this.recipe.operationDblclick, this.recipe); diff --git a/src/web/html/index.html b/src/web/html/index.html index ad940040..b5cff9f0 100755 --- a/src/web/html/index.html +++ b/src/web/html/index.html @@ -177,7 +177,7 @@
Recipe -