Fix some more autobake weirdness.

Input passed in the URL is now set on load.
Added a new progress bar.
This commit is contained in:
j433866 2019-05-02 15:44:31 +01:00
parent 8e9717906f
commit e9d60f73f4
5 changed files with 16 additions and 10 deletions

View File

@ -198,7 +198,10 @@ class App {
* @param {boolean} [silent=false] - Suppress statechange event
*/
setInput(input, silent=false) {
this.manager.input.set(input, silent);
// Assume that there aren't any inputs
let inputNum = this.manager.input.getActiveTab();
if (inputNum === -1) inputNum = 1;
this.manager.input.updateInputValue(inputNum, input);
}
@ -446,7 +449,7 @@ class App {
if (this.uriParams.input) {
try {
const inputData = fromBase64(this.uriParams.input);
this.setInput(inputData, true);
this.setInput(inputData, false);
} catch (err) {}
}

View File

@ -387,19 +387,19 @@ ${navigator.userAgent}
const bakeButton = document.getElementById("bake"),
btnText = bakeButton.querySelector("span");
bakeButton.style.background = "";
if (cancel) {
btnText.innerText = "Cancel";
bakeButton.classList.remove("btn-success");
bakeButton.classList.remove("btn-warning");
bakeButton.classList.add("btn-danger");
} else if (loading) {
bakeButton.style.background = "";
btnText.innerText = "Loading...";
bakeButton.classList.remove("btn-success");
bakeButton.classList.remove("btn-danger");
bakeButton.classList.add("btn-warning");
} else {
bakeButton.style.background = "";
btnText.innerText = "Bake!";
bakeButton.classList.remove("btn-danger");
bakeButton.classList.remove("btn-warning");

View File

@ -745,6 +745,14 @@ class InputWaiter {
this.updateFileProgress(loadedData.activeProgress.inputNum, loadedData.activeProgress.progress);
const inputTitle = document.getElementById("input").firstElementChild;
if (loaded < total) {
const percentComplete = (loaded + loading) / total * 100;
inputTitle.style.background = `linear-gradient(to right, var(--title-background-colour) ${percentComplete}%, var(--primary-background-colour) ${percentComplete}%)`;
} else {
inputTitle.style.background = "";
}
if (loaded < total && autoRefresh) {
setTimeout(function() {
this.inputWorker.postMessage({

View File

@ -127,7 +127,7 @@ self.autoBake = function(inputNum) {
data: {
input: inputData,
inputNum: parseInt(inputNum, 10),
override: true
override: false
}
});
self.postMessage({

View File

@ -322,7 +322,6 @@ class WorkerWaiter {
if (typeof nextInput.inputNum === "string") nextInput.inputNum = parseInt(nextInput.inputNum, 10);
log.debug(`Baking input ${nextInput.inputNum}.`);
this.setBakingStatus(true);
this.manager.output.updateOutputStatus("baking", nextInput.inputNum);
this.manager.output.updateOutputMessage(`Baking input ${nextInput.inputNum}...`, nextInput.inputNum);
@ -404,12 +403,8 @@ class WorkerWaiter {
if (inputData.override) {
for (let i = this.chefWorkers.length - 1; i >= 0; i--) {
this.removeChefWorker(this.chefWorkers[i]);
}
this.totalOutputs = 1;
this.inputs = [inputData];
this.bakeNextInput(this.addChefWorker());
} else {
this.totalOutputs++;
this.inputs.push(inputData);