diff --git a/src/web/App.mjs b/src/web/App.mjs index 0cdabe0c..29ec2084 100755 --- a/src/web/App.mjs +++ b/src/web/App.mjs @@ -183,9 +183,10 @@ class App { * Sets the user's input data. * * @param {string} input - The string to set the input to + * @param {boolean} [silent=false] - Suppress statechange event */ - setInput(input) { - this.manager.input.set(input); + setInput(input, silent=false) { + this.manager.input.set(input, silent); } @@ -419,12 +420,12 @@ class App { if (this.uriParams.input) { try { const inputData = fromBase64(this.uriParams.input); - this.setInput(inputData); + this.setInput(inputData, true); } catch (err) {} } this.autoBakePause = false; - this.autoBake(); + window.dispatchEvent(this.manager.statechange); } @@ -504,6 +505,7 @@ class App { resetLayout() { this.columnSplitter.setSizes([20, 30, 50]); this.ioSplitter.setSizes([50, 50]); + this.manager.recipe.adjustWidth(); } diff --git a/src/web/ControlsWaiter.mjs b/src/web/ControlsWaiter.mjs index 260041dc..a3f74e29 100755 --- a/src/web/ControlsWaiter.mjs +++ b/src/web/ControlsWaiter.mjs @@ -355,9 +355,7 @@ ${navigator.userAgent} */ showStaleIndicator() { const staleIndicator = document.getElementById("stale-indicator"); - - staleIndicator.style.visibility = "visible"; - staleIndicator.style.opacity = 1; + staleIndicator.classList.remove("hidden"); } @@ -367,9 +365,7 @@ ${navigator.userAgent} */ hideStaleIndicator() { const staleIndicator = document.getElementById("stale-indicator"); - - staleIndicator.style.opacity = 0; - staleIndicator.style.visibility = "hidden"; + staleIndicator.classList.add("hidden"); } diff --git a/src/web/InputWaiter.mjs b/src/web/InputWaiter.mjs index 73c5c8d9..37f1134a 100755 --- a/src/web/InputWaiter.mjs +++ b/src/web/InputWaiter.mjs @@ -60,10 +60,11 @@ class InputWaiter { * Sets the input in the input area. * * @param {string|File} input + * @param {boolean} [silent=false] - Suppress statechange event * * @fires Manager#statechange */ - set(input) { + set(input, silent=false) { const inputText = document.getElementById("input-text"); if (input instanceof File) { this.setFile(input); @@ -72,7 +73,7 @@ class InputWaiter { } else { inputText.value = input; this.closeFile(); - window.dispatchEvent(this.manager.statechange); + if (!silent) window.dispatchEvent(this.manager.statechange); const lines = input.length < (this.app.options.ioDisplayThreshold * 1024) ? input.count("\n") + 1 : null; this.setInputInfo(input.length, lines); diff --git a/src/web/OutputWaiter.mjs b/src/web/OutputWaiter.mjs index 0ef5b248..4ab13753 100755 --- a/src/web/OutputWaiter.mjs +++ b/src/web/OutputWaiter.mjs @@ -447,8 +447,6 @@ class OutputWaiter { const recipeURL = "#recipe=" + Utils.encodeURIFragment(Utils.generatePrettyRecipe(newRecipeConfig)); const opSequence = options[0].recipe.map(o => o.op).join(", "); - log.log(`Running ${opSequence} will result in "${Utils.truncate(options[0].data, 20)}"`); - this.showMagicButton(opSequence, options[0].data, newRecipeConfig); } @@ -477,10 +475,9 @@ class OutputWaiter { */ showMagicButton(opSequence, result, recipeConfig) { const magicButton = document.getElementById("magic"); - magicButton.setAttribute("data-original-title", `Running ${opSequence} will result in "${Utils.truncate(result, 20)}"`); + magicButton.setAttribute("data-original-title", `Running ${opSequence} will result in "${Utils.truncate(result, 30)}"`); magicButton.setAttribute("data-recipe", JSON.stringify(recipeConfig), null, ""); - magicButton.style.visibility = "visible"; - magicButton.style.opacity = 1; + magicButton.classList.remove("hidden"); } @@ -489,8 +486,7 @@ class OutputWaiter { */ hideMagicButton() { const magicButton = document.getElementById("magic"); - magicButton.style.visibility = "hidden"; - magicButton.style.opacity = 0; + magicButton.classList.add("hidden"); magicButton.setAttribute("data-recipe", ""); magicButton.setAttribute("data-original-title", "Magic!"); } diff --git a/src/web/html/index.html b/src/web/html/index.html index 9cd7a7a7..9999b4b5 100755 --- a/src/web/html/index.html +++ b/src/web/html/index.html @@ -278,12 +278,12 @@
- - + diff --git a/src/web/stylesheets/layout/_io.css b/src/web/stylesheets/layout/_io.css index 24c5db02..5b0433f6 100755 --- a/src/web/stylesheets/layout/_io.css +++ b/src/web/stylesheets/layout/_io.css @@ -126,8 +126,9 @@ } #stale-indicator { - visibility: hidden; - transition: all 0.3s; + opacity: 1; + visibility: visibile; + transition: margin 0s, opacity 0.3s; margin-left: 5px; cursor: help; } @@ -148,12 +149,24 @@ } #magic { - visibility: hidden; - transition: all 0.3s; + opacity: 1; + visibility: visibile; + transition: margin 0s 0.3s, opacity 0.3s 0.3s, visibility 0.3s 0.3s; margin-left: 5px; margin-bottom: 5px; } +#magic.hidden, +#stale-indicator.hidden { + visibility: hidden; + transition: opacity 0.3s, margin 0.3s 0.3s, visibility 0.3s; + opacity: 0; +} + +#magic.hidden { + margin-left: -32px; +} + #magic svg path { fill: var(--primary-font-colour); } diff --git a/src/web/stylesheets/utils/_general.css b/src/web/stylesheets/utils/_general.css index af985c25..5c899769 100755 --- a/src/web/stylesheets/utils/_general.css +++ b/src/web/stylesheets/utils/_general.css @@ -20,6 +20,10 @@ body { color: var(--subtext-font-colour); } +.data-text { + font-family: var(--fixed-width-font-family); +} + .word-wrap { white-space: pre !important; word-wrap: normal !important;