mirror of
https://github.com/gchq/CyberChef
synced 2025-01-08 10:38:46 +00:00
Only set the input of the active input if the progress has changed.
Autobake when the input loads instead of when all load.
This commit is contained in:
parent
802879ced2
commit
f5442c307a
1 changed files with 7 additions and 11 deletions
|
@ -419,13 +419,17 @@ class InputWaiter {
|
||||||
* Updates the displayed input progress for a file
|
* Updates the displayed input progress for a file
|
||||||
*
|
*
|
||||||
* @param {number} inputNum
|
* @param {number} inputNum
|
||||||
* @param {number} progress
|
* @param {number | string} progress
|
||||||
*/
|
*/
|
||||||
updateFileProgress(inputNum, progress) {
|
updateFileProgress(inputNum, progress) {
|
||||||
const activeTab = this.getActiveTab();
|
const activeTab = this.getActiveTab();
|
||||||
if (inputNum !== activeTab) return;
|
if (inputNum !== activeTab) return;
|
||||||
|
|
||||||
const fileLoaded = document.getElementById("input-file-loaded");
|
const fileLoaded = document.getElementById("input-file-loaded");
|
||||||
|
let oldProgress = fileLoaded.textContent;
|
||||||
|
if (oldProgress !== "Error") {
|
||||||
|
oldProgress = parseInt(oldProgress.replace("%", ""), 10);
|
||||||
|
}
|
||||||
if (progress === "error") {
|
if (progress === "error") {
|
||||||
fileLoaded.textContent = "Error";
|
fileLoaded.textContent = "Error";
|
||||||
fileLoaded.style.color = "#FF0000";
|
fileLoaded.style.color = "#FF0000";
|
||||||
|
@ -434,12 +438,12 @@ class InputWaiter {
|
||||||
fileLoaded.style.color = "";
|
fileLoaded.style.color = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (progress === 100) {
|
if (progress === 100 && progress !== oldProgress) {
|
||||||
this.inputWorker.postMessage({
|
this.inputWorker.postMessage({
|
||||||
action: "setInput",
|
action: "setInput",
|
||||||
data: {
|
data: {
|
||||||
inputNum: inputNum,
|
inputNum: inputNum,
|
||||||
silent: true
|
silent: false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -801,15 +805,7 @@ class InputWaiter {
|
||||||
});
|
});
|
||||||
}.bind(this), 100);
|
}.bind(this), 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loaded === total) {
|
|
||||||
this.app.autoBake();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// displayTabInfo
|
|
||||||
// simple getInput for each tab
|
|
||||||
|
|
||||||
// displayFilePreview
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a tab element for the input tab bar
|
* Create a tab element for the input tab bar
|
||||||
|
|
Loading…
Reference in a new issue