mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 14:56:19 -04:00
added deselect and select of checkbox by Enter key
This commit is contained in:
parent
61d587a4a5
commit
68a8d4328f
2 changed files with 22 additions and 0 deletions
|
@ -129,6 +129,7 @@ class Manager {
|
|||
// Controls
|
||||
document.getElementById("bake").addEventListener("click", this.controls.bakeClick.bind(this.controls));
|
||||
document.getElementById("auto-bake").addEventListener("change", this.controls.autoBakeChange.bind(this.controls));
|
||||
document.getElementById("auto-bake").addEventListener("keydown", this.controls.keyboardCheckAutoBake.bind(this.controls));
|
||||
document.getElementById("step").addEventListener("click", this.controls.stepClick.bind(this.controls));
|
||||
document.getElementById("clr-recipe").addEventListener("click", this.controls.clearRecipeClick.bind(this.controls));
|
||||
document.getElementById("save").addEventListener("click", this.controls.saveClick.bind(this.controls));
|
||||
|
|
|
@ -51,6 +51,27 @@ class ControlsWaiter {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the Auto Bake checkbox based on keyboard.
|
||||
*
|
||||
*/
|
||||
keyboardCheckAutoBake() {
|
||||
const autoBakeId = document.getElementById("auto-bake");
|
||||
autoBakeId.addEventListener("keydown", this.autoBakeKeyboardHandler, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks or unchecks the Auto Bake checkbox with "Enter"
|
||||
* @param {Event} ev
|
||||
*/
|
||||
autoBakeKeyboardHandler(ev) {
|
||||
const checkBox = document.getElementById("auto-bake");
|
||||
ev.preventDefault();
|
||||
if (ev.key === "Enter" || ev.key === " ") {
|
||||
checkBox.checked = !checkBox.checked;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handler to trigger baking.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue