mirror of
https://github.com/gchq/CyberChef.git
synced 2025-06-17 11:45:07 -04:00
Added the ability to cancel bakes
This commit is contained in:
parent
98884d851a
commit
f1ebab0c2d
4 changed files with 57 additions and 11 deletions
|
@ -78,7 +78,11 @@ ControlsWaiter.prototype.setAutoBake = function(value) {
|
|||
* Handler to trigger baking.
|
||||
*/
|
||||
ControlsWaiter.prototype.bakeClick = function() {
|
||||
this.app.bake();
|
||||
if (document.getElementById("bake").textContent.indexOf("Bake") > 0) {
|
||||
this.app.bake();
|
||||
} else {
|
||||
this.app.cancelBake();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -386,4 +390,25 @@ ControlsWaiter.prototype.hideStaleIndicator = function() {
|
|||
staleIndicator.style.visibility = "hidden";
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Switches the Bake button between 'Bake' and 'Cancel' functions.
|
||||
*
|
||||
* @param {boolean} cancel - Whether to change to cancel or not
|
||||
*/
|
||||
ControlsWaiter.prototype.toggleBakeButtonFunction = function(cancel) {
|
||||
const bakeButton = document.getElementById("bake"),
|
||||
btnText = bakeButton.querySelector("span");
|
||||
|
||||
if (cancel) {
|
||||
btnText.innerText = "Cancel";
|
||||
bakeButton.classList.remove("btn-success");
|
||||
bakeButton.classList.add("btn-danger");
|
||||
} else {
|
||||
btnText.innerText = "Bake!";
|
||||
bakeButton.classList.remove("btn-danger");
|
||||
bakeButton.classList.add("btn-success");
|
||||
}
|
||||
};
|
||||
|
||||
export default ControlsWaiter;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue