mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 14:56:19 -04:00
Removed autoBakePause flag and statechange trigger in InputWaiter.set() as they are redundant.
This commit is contained in:
parent
0a709acafe
commit
a79be1e3ef
2 changed files with 4 additions and 26 deletions
|
@ -39,7 +39,6 @@ class App {
|
||||||
|
|
||||||
this.baking = false;
|
this.baking = false;
|
||||||
this.autoBake_ = false;
|
this.autoBake_ = false;
|
||||||
this.autoBakePause = false;
|
|
||||||
this.progress = 0;
|
this.progress = 0;
|
||||||
this.ingId = 0;
|
this.ingId = 0;
|
||||||
|
|
||||||
|
@ -155,11 +154,6 @@ class App {
|
||||||
* Runs Auto Bake if it is set.
|
* Runs Auto Bake if it is set.
|
||||||
*/
|
*/
|
||||||
autoBake() {
|
autoBake() {
|
||||||
// If autoBakePause is set, we are loading a full recipe (and potentially input), so there is no
|
|
||||||
// need to set the staleness indicator. Just exit and wait until auto bake is called after loading
|
|
||||||
// has completed.
|
|
||||||
if (this.autoBakePause) return false;
|
|
||||||
|
|
||||||
if (this.baking) {
|
if (this.baking) {
|
||||||
this.manager.worker.cancelBakeForAutoBake();
|
this.manager.worker.cancelBakeForAutoBake();
|
||||||
this.baking = false;
|
this.baking = false;
|
||||||
|
@ -241,7 +235,7 @@ class App {
|
||||||
action: "setInput",
|
action: "setInput",
|
||||||
data: {
|
data: {
|
||||||
inputNum: inputNum,
|
inputNum: inputNum,
|
||||||
silent: false
|
silent: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -478,7 +472,6 @@ class App {
|
||||||
* @fires Manager#statechange
|
* @fires Manager#statechange
|
||||||
*/
|
*/
|
||||||
loadURIParams(params=this.getURIParams()) {
|
loadURIParams(params=this.getURIParams()) {
|
||||||
this.autoBakePause = true;
|
|
||||||
this.uriParams = params;
|
this.uriParams = params;
|
||||||
|
|
||||||
// Read in recipe from URI params
|
// Read in recipe from URI params
|
||||||
|
@ -545,13 +538,8 @@ class App {
|
||||||
this.manager.options.changeTheme(Utils.escapeHtml(this.uriParams.theme));
|
this.manager.options.changeTheme(Utils.escapeHtml(this.uriParams.theme));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.autoBakePause = false;
|
|
||||||
|
|
||||||
// Dispatch stateChange only if not done by setInput
|
|
||||||
if (this.uriParams.input) {
|
|
||||||
window.dispatchEvent(this.manager.statechange);
|
window.dispatchEvent(this.manager.statechange);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -583,10 +571,6 @@ class App {
|
||||||
setRecipeConfig(recipeConfig) {
|
setRecipeConfig(recipeConfig) {
|
||||||
document.getElementById("rec-list").innerHTML = null;
|
document.getElementById("rec-list").innerHTML = null;
|
||||||
|
|
||||||
// Pause auto-bake while loading but don't modify `this.autoBake_`
|
|
||||||
// otherwise `manualBake` cannot trigger.
|
|
||||||
this.autoBakePause = true;
|
|
||||||
|
|
||||||
for (let i = 0; i < recipeConfig.length; i++) {
|
for (let i = 0; i < recipeConfig.length; i++) {
|
||||||
const item = this.manager.recipe.addOperation(recipeConfig[i].op);
|
const item = this.manager.recipe.addOperation(recipeConfig[i].op);
|
||||||
|
|
||||||
|
@ -621,9 +605,6 @@ class App {
|
||||||
|
|
||||||
this.progress = 0;
|
this.progress = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unpause auto bake
|
|
||||||
this.autoBakePause = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -215,7 +215,8 @@ class InputWaiter {
|
||||||
* Handler for Chr Enc change events
|
* Handler for Chr Enc change events
|
||||||
* Sets the input character encoding
|
* Sets the input character encoding
|
||||||
* @param {number} chrEncVal
|
* @param {number} chrEncVal
|
||||||
* @param {boolean} [manual=false]
|
* @param {boolean} [manual=false] - Flag to indicate the encoding was set by the user
|
||||||
|
* @param {boolean} [internal=false] - Flag to indicate this was set internally, i.e. by loading from URI
|
||||||
*/
|
*/
|
||||||
chrEncChange(chrEncVal, manual=false, internal=false) {
|
chrEncChange(chrEncVal, manual=false, internal=false) {
|
||||||
if (typeof chrEncVal !== "number") return;
|
if (typeof chrEncVal !== "number") return;
|
||||||
|
@ -641,10 +642,6 @@ class InputWaiter {
|
||||||
const inputStr = toBase64(inputVal, "A-Za-z0-9+/");
|
const inputStr = toBase64(inputVal, "A-Za-z0-9+/");
|
||||||
this.app.updateURL(true, inputStr);
|
this.app.updateURL(true, inputStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trigger a state change
|
|
||||||
if (!silent) window.dispatchEvent(this.manager.statechange);
|
|
||||||
|
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue