mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 23:36:16 -04:00
replace "options" with "arguments", invert global hide-icon if needed
This commit is contained in:
parent
3bb6a40f82
commit
ed7baf57f0
5 changed files with 41 additions and 24 deletions
|
@ -215,27 +215,44 @@ class RecipeWaiter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Handler for hide-opt click events.
|
||||
* Handler for hide-args click events.
|
||||
* Updates the icon status.
|
||||
*
|
||||
* @fires Manager#statechange
|
||||
* @param {event} e
|
||||
*/
|
||||
hideOptClick(e) {
|
||||
hideArgsClick(e) {
|
||||
const icon = e.target;
|
||||
|
||||
if (icon.getAttribute("hide-opt") === "false") {
|
||||
icon.setAttribute("hide-opt", "true");
|
||||
if (icon.getAttribute("hide-args") === "false") {
|
||||
icon.setAttribute("hide-args", "true");
|
||||
icon.innerText = "keyboard_arrow_down";
|
||||
icon.classList.add("hide-options-selected");
|
||||
icon.classList.add("hide-args-selected");
|
||||
icon.parentNode.previousElementSibling.style.display = "none";
|
||||
} else {
|
||||
icon.setAttribute("hide-opt", "false");
|
||||
icon.setAttribute("hide-args", "false");
|
||||
icon.innerText = "keyboard_arrow_up";
|
||||
icon.classList.remove("hide-options-selected");
|
||||
icon.classList.remove("hide-args-selected");
|
||||
icon.parentNode.previousElementSibling.style.display = "grid";
|
||||
}
|
||||
|
||||
const icons = Array.from(document.getElementsByClassName("hide-args-icon"));
|
||||
if (icons.length > 1) {
|
||||
// Check if ALL the icons are hidden/shown
|
||||
const uniqueIcons = icons.map(function(item) {
|
||||
return item.getAttribute("hide-args");
|
||||
}).unique();
|
||||
console.log(uniqueIcons)
|
||||
|
||||
const controlsIconStatus = document.getElementById("hide-icon").getAttribute("hide-args");
|
||||
console.log(controlsIconStatus)
|
||||
|
||||
// If all icons are in the same state and the global icon isn't, fix it
|
||||
if (uniqueIcons.length === 1 && icon.getAttribute("hide-args") !== controlsIconStatus) {
|
||||
this.manager.controls.hideRecipeArgsClick()
|
||||
}
|
||||
}
|
||||
|
||||
window.dispatchEvent(this.manager.statechange);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue