mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 23:06:16 -04:00
Reduced extraneous auto bakes
This commit is contained in:
parent
e2a35ea844
commit
db98e56e72
6 changed files with 18 additions and 14 deletions
|
@ -122,7 +122,12 @@ App.prototype.bake = function(step) {
|
||||||
* Runs Auto Bake if it is set.
|
* Runs Auto Bake if it is set.
|
||||||
*/
|
*/
|
||||||
App.prototype.autoBake = function() {
|
App.prototype.autoBake = function() {
|
||||||
if (this.autoBake_ && !this.autoBakePause && !this.baking) {
|
// 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.autoBake_ && !this.baking) {
|
||||||
this.bake();
|
this.bake();
|
||||||
} else {
|
} else {
|
||||||
this.manager.controls.showStaleIndicator();
|
this.manager.controls.showStaleIndicator();
|
||||||
|
@ -369,10 +374,6 @@ App.prototype.loadURIParams = function() {
|
||||||
window.location.hash;
|
window.location.hash;
|
||||||
this.uriParams = Utils.parseURIParams(params);
|
this.uriParams = Utils.parseURIParams(params);
|
||||||
|
|
||||||
// Pause auto-bake while loading but don't modify `this.autoBake_`
|
|
||||||
// otherwise `manualBake` cannot trigger.
|
|
||||||
this.autoBakePause = true;
|
|
||||||
|
|
||||||
// Read in recipe from URI params
|
// Read in recipe from URI params
|
||||||
if (this.uriParams.recipe) {
|
if (this.uriParams.recipe) {
|
||||||
try {
|
try {
|
||||||
|
@ -407,8 +408,6 @@ App.prototype.loadURIParams = function() {
|
||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unpause auto-bake
|
|
||||||
this.autoBakePause = false;
|
|
||||||
this.autoBake();
|
this.autoBake();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -441,6 +440,10 @@ App.prototype.getRecipeConfig = function() {
|
||||||
App.prototype.setRecipeConfig = function(recipeConfig) {
|
App.prototype.setRecipeConfig = function(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);
|
||||||
|
|
||||||
|
@ -473,6 +476,9 @@ App.prototype.setRecipeConfig = function(recipeConfig) {
|
||||||
|
|
||||||
this.progress = 0;
|
this.progress = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Unpause auto bake
|
||||||
|
this.autoBakePause = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -361,6 +361,7 @@ ControlsWaiter.prototype.loadButtonClick = function() {
|
||||||
try {
|
try {
|
||||||
const recipeConfig = Utils.parseRecipeConfig(document.getElementById("load-text").value);
|
const recipeConfig = Utils.parseRecipeConfig(document.getElementById("load-text").value);
|
||||||
this.app.setRecipeConfig(recipeConfig);
|
this.app.setRecipeConfig(recipeConfig);
|
||||||
|
this.app.autoBake();
|
||||||
|
|
||||||
$("#rec-list [data-toggle=popover]").popover();
|
$("#rec-list [data-toggle=popover]").popover();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -158,13 +158,11 @@ InputWaiter.prototype.inputDrop = function(e) {
|
||||||
const CHUNK_SIZE = 20480; // 20KB
|
const CHUNK_SIZE = 20480; // 20KB
|
||||||
|
|
||||||
const setInput = function() {
|
const setInput = function() {
|
||||||
this.app.autoBakePause = true;
|
|
||||||
const recipeConfig = this.app.getRecipeConfig();
|
const recipeConfig = this.app.getRecipeConfig();
|
||||||
if (!recipeConfig[0] || recipeConfig[0].op !== "From Hex") {
|
if (!recipeConfig[0] || recipeConfig[0].op !== "From Hex") {
|
||||||
recipeConfig.unshift({op: "From Hex", args: ["Space"]});
|
recipeConfig.unshift({op: "From Hex", args: ["Space"]});
|
||||||
this.app.setRecipeConfig(recipeConfig);
|
this.app.setRecipeConfig(recipeConfig);
|
||||||
}
|
}
|
||||||
this.app.autoBakePause = false;
|
|
||||||
|
|
||||||
this.set(inputCharcode);
|
this.set(inputCharcode);
|
||||||
|
|
||||||
|
|
|
@ -119,9 +119,8 @@ Manager.prototype.initialiseEventListeners = function() {
|
||||||
this.addDynamicListener("li.operation", "operationadd", this.recipe.opAdd.bind(this.recipe));
|
this.addDynamicListener("li.operation", "operationadd", this.recipe.opAdd.bind(this.recipe));
|
||||||
|
|
||||||
// Recipe
|
// Recipe
|
||||||
this.addDynamicListener(".arg", "keyup", this.recipe.ingChange, this.recipe);
|
this.addDynamicListener(".arg:not(select)", "input", this.recipe.ingChange, this.recipe);
|
||||||
this.addDynamicListener(".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(".arg", "input", this.recipe.ingChange, this.recipe);
|
|
||||||
this.addDynamicListener(".disable-icon", "click", this.recipe.disableClick, 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 li.operation", "dblclick", this.recipe.operationDblclick, this.recipe);
|
this.addDynamicListener("#rec-list li.operation", "dblclick", this.recipe.operationDblclick, this.recipe);
|
||||||
|
|
|
@ -191,7 +191,7 @@ RecipeWaiter.prototype.favDrop = function(e) {
|
||||||
*
|
*
|
||||||
* @fires Manager#statechange
|
* @fires Manager#statechange
|
||||||
*/
|
*/
|
||||||
RecipeWaiter.prototype.ingChange = function() {
|
RecipeWaiter.prototype.ingChange = function(e) {
|
||||||
window.dispatchEvent(this.manager.statechange);
|
window.dispatchEvent(this.manager.statechange);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue