diff --git a/src/web/App.mjs b/src/web/App.mjs index 453fba22..e203b85c 100755 --- a/src/web/App.mjs +++ b/src/web/App.mjs @@ -124,6 +124,9 @@ class App { // Reset attemptHighlight flag this.options.attemptHighlight = true; + // Remove all current indicators + this.manager.recipe.updateBreakpointIndicator(false); + this.manager.worker.bake( this.getInput(), // The user's input this.getRecipeConfig(), // The configuration of the recipe diff --git a/src/web/OutputWaiter.mjs b/src/web/OutputWaiter.mjs index 39d6e51b..5e7ae7e8 100755 --- a/src/web/OutputWaiter.mjs +++ b/src/web/OutputWaiter.mjs @@ -334,12 +334,11 @@ class OutputWaiter { /** - * Save bombe object before it is removed so that it can be used later + * Save bombe object then remove it from the DOM so that it does not cause performance issues. */ saveBombe() { - this.bombeEl = document.getElementById("bombe").cloneNode(); - this.bombeEl.setAttribute("width", "100%"); - this.bombeEl.setAttribute("height", "100%"); + this.bombeEl = document.getElementById("bombe"); + this.bombeEl.parentNode.removeChild(this.bombeEl); } @@ -358,7 +357,7 @@ class OutputWaiter { const outputLoader = document.getElementById("output-loader"), outputElement = document.getElementById("output-text"), - loader = outputLoader.querySelector(".loader"); + animation = document.getElementById("output-loader-animation"); if (value) { this.manager.controls.hideStaleIndicator(); @@ -366,7 +365,7 @@ class OutputWaiter { // Start a timer to add the Bombe to the DOM just before we make it // visible so that there is no stuttering this.appendBombeTimeout = setTimeout(function() { - loader.appendChild(this.bombeEl); + animation.appendChild(this.bombeEl); }.bind(this), 150); // Show the loading screen @@ -380,7 +379,7 @@ class OutputWaiter { // Remove the Bombe from the DOM to save resources this.outputLoaderTimeout = setTimeout(function () { try { - loader.removeChild(this.bombeEl); + animation.removeChild(this.bombeEl); } catch (err) {} }.bind(this), 500); outputElement.disabled = false; diff --git a/src/web/RecipeWaiter.mjs b/src/web/RecipeWaiter.mjs index b913fede..a8326b27 100755 --- a/src/web/RecipeWaiter.mjs +++ b/src/web/RecipeWaiter.mjs @@ -340,10 +340,11 @@ class RecipeWaiter { /** * Moves or removes the breakpoint indicator in the recipe based on the position. * - * @param {number} position + * @param {number|boolean} position - If boolean, turn off all indicators */ updateBreakpointIndicator(position) { const operations = document.querySelectorAll("#rec-list li.operation"); + if (typeof position === "boolean") position = operations.length; for (let i = 0; i < operations.length; i++) { if (i === position) { operations[i].classList.add("break"); diff --git a/src/web/html/index.html b/src/web/html/index.html index a1f915b6..478d2bb3 100755 --- a/src/web/html/index.html +++ b/src/web/html/index.html @@ -142,9 +142,7 @@