From 50e4daeaf228988bfb34c51ba17800975e4caef0 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Wed, 27 Dec 2017 23:05:32 +0000 Subject: [PATCH] Output info tidied up for file outputs --- src/web/OutputWaiter.js | 22 +++++++++++++--------- src/web/stylesheets/layout/_io.css | 2 ++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/web/OutputWaiter.js b/src/web/OutputWaiter.js index 51def0b4..06379b94 100755 --- a/src/web/OutputWaiter.js +++ b/src/web/OutputWaiter.js @@ -63,8 +63,9 @@ OutputWaiter.prototype.set = function(data, type, duration, preserveBuffer) { outputText.value = ""; outputHtml.innerHTML = data; - length = data.length; this.dishStr = Utils.stripHtmlTags(data, true); + length = data.length; + lines = this.dishStr.count("\n") + 1; // Execute script sections scriptElements = outputHtml.querySelectorAll("script"); @@ -84,8 +85,8 @@ OutputWaiter.prototype.set = function(data, type, duration, preserveBuffer) { outputText.value = ""; outputHtml.innerHTML = ""; - length = data.byteLength; this.dishStr = ""; + length = data.byteLength; this.setFile(data); break; @@ -177,6 +178,7 @@ OutputWaiter.prototype.showFileOverlayClick = function(e) { outputFile.style.display = "block"; showFileOverlay.style.display = "none"; + this.setOutputInfo(this.dishBuffer.byteLength, null, 0); }; @@ -191,15 +193,17 @@ OutputWaiter.prototype.setOutputInfo = function(length, lines, duration) { let width = length.toString().length; width = width < 4 ? 4 : width; - lines = typeof lines === "number" ? lines : ""; - const lengthStr = Utils.pad(length.toString(), width, " ").replace(/ /g, " "); - const linesStr = Utils.pad(lines.toString(), width, " ").replace(/ /g, " "); - const timeStr = Utils.pad(duration.toString() + "ms", width, " ").replace(/ /g, " "); + const timeStr = Utils.pad(duration.toString() + "ms", width, " ").replace(/ /g, " "); - document.getElementById("output-info").innerHTML = "time: " + timeStr + - "
length: " + lengthStr + - "
lines: " + linesStr; + let msg = "time: " + timeStr + "
length: " + lengthStr; + + if (typeof lines === "number") { + const linesStr = Utils.pad(lines.toString(), width, " ").replace(/ /g, " "); + msg += "
lines: " + linesStr; + } + + document.getElementById("output-info").innerHTML = msg; document.getElementById("input-selection-info").innerHTML = ""; document.getElementById("output-selection-info").innerHTML = ""; }; diff --git a/src/web/stylesheets/layout/_io.css b/src/web/stylesheets/layout/_io.css index 370c2235..c93c800b 100644 --- a/src/web/stylesheets/layout/_io.css +++ b/src/web/stylesheets/layout/_io.css @@ -111,6 +111,8 @@ font-family: var(--fixed-width-font-family); font-weight: normal; font-size: 8pt; + display: flex; + align-items: center; } #input-info {