mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-08 07:21:02 -04:00
move disable-icon click functionality to c-recipe-li
This commit is contained in:
parent
b7e0518cc7
commit
5d876fb09a
3 changed files with 22 additions and 29 deletions
|
@ -153,7 +153,6 @@ class Manager {
|
||||||
// Recipe
|
// Recipe
|
||||||
this.addDynamicListener(".arg:not(select)", "input", this.recipe.ingChange, this.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(".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(".breakpoint", "click", this.recipe.breakpointClick, this.recipe);
|
||||||
this.addDynamicListener("#rec-list .dropdown-menu.toggle-dropdown a", "click", this.recipe.dropdownToggleClick, this.recipe);
|
this.addDynamicListener("#rec-list .dropdown-menu.toggle-dropdown a", "click", this.recipe.dropdownToggleClick, this.recipe);
|
||||||
this.addDynamicListener("textarea.arg", "dragover", this.recipe.textArgDragover, this.recipe);
|
this.addDynamicListener("textarea.arg", "dragover", this.recipe.textArgDragover, this.recipe);
|
||||||
|
|
|
@ -45,12 +45,31 @@ export class CRecipeLi extends HTMLElement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle click
|
* Handle click
|
||||||
|
* @fires Manager#statechange
|
||||||
* @param {Event} e
|
* @param {Event} e
|
||||||
*/
|
*/
|
||||||
handleClick(e) {}
|
handleClick(e) {
|
||||||
|
const disableIcon = this.querySelector("i.disable-icon");
|
||||||
|
|
||||||
|
if (e.target === disableIcon) {
|
||||||
|
if (disableIcon.getAttribute("disabled") === "false") {
|
||||||
|
disableIcon.setAttribute("disabled", "true");
|
||||||
|
disableIcon.classList.add("disable-icon-selected");
|
||||||
|
this.querySelector("li.operation").classList.add("disabled");
|
||||||
|
} else {
|
||||||
|
disableIcon.setAttribute("disabled", "false");
|
||||||
|
disableIcon.classList.remove("disable-icon-selected");
|
||||||
|
this.querySelector("li.operation").classList.remove("disabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.app.progress = 0;
|
||||||
|
window.dispatchEvent(this.app.manager.statechange);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle double click
|
* Handle double click
|
||||||
|
*
|
||||||
* @param {Event} e
|
* @param {Event} e
|
||||||
*/
|
*/
|
||||||
handleDoubleClick(e) {
|
handleDoubleClick(e) {
|
||||||
|
@ -62,13 +81,13 @@ export class CRecipeLi extends HTMLElement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove this operation from the recipe list
|
* Remove this operation from the recipe list
|
||||||
|
*
|
||||||
|
* @fires Manager#statechange
|
||||||
*/
|
*/
|
||||||
removeOperation(){
|
removeOperation(){
|
||||||
this.remove();
|
this.remove();
|
||||||
log.debug("Operation removed from recipe");
|
log.debug("Operation removed from recipe");
|
||||||
window.dispatchEvent(this.app.manager.statechange);
|
window.dispatchEvent(this.app.manager.statechange);
|
||||||
|
|
||||||
// @TODO: this func can be moved to c-operation-list
|
|
||||||
this.app.manager.ops.updateListItemsClasses("#rec-list", "selected");
|
this.app.manager.ops.updateListItemsClasses("#rec-list", "selected");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -161,31 +161,6 @@ class RecipeWaiter {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handler for disable click events.
|
|
||||||
* Updates the icon status.
|
|
||||||
*
|
|
||||||
* @fires Manager#statechange
|
|
||||||
* @param {Event} e
|
|
||||||
*/
|
|
||||||
disableClick(e) {
|
|
||||||
const icon = e.target;
|
|
||||||
|
|
||||||
if (icon.getAttribute("disabled") === "false") {
|
|
||||||
icon.setAttribute("disabled", "true");
|
|
||||||
icon.classList.add("disable-icon-selected");
|
|
||||||
icon.parentNode.parentNode.classList.add("disabled");
|
|
||||||
} else {
|
|
||||||
icon.setAttribute("disabled", "false");
|
|
||||||
icon.classList.remove("disable-icon-selected");
|
|
||||||
icon.parentNode.parentNode.classList.remove("disabled");
|
|
||||||
}
|
|
||||||
|
|
||||||
this.app.progress = 0;
|
|
||||||
window.dispatchEvent(this.manager.statechange);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler for breakpoint click events.
|
* Handler for breakpoint click events.
|
||||||
* Updates the icon status.
|
* Updates the icon status.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue