From eb9b623aae822af554f1b87ba390faa09c9034af Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Mon, 4 Apr 2016 03:23:16 +0000 Subject: [PATCH] Responsive CSS --- www/res/style.css | 8 +++++++- www/res/terminal.js | 16 ++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/www/res/style.css b/www/res/style.css index d38d3bf..12ed521 100644 --- a/www/res/style.css +++ b/www/res/style.css @@ -11,7 +11,7 @@ body { } .terminal { - background: rgba(80, 70, 60, 0.9); + background: rgba(80, 70, 60, 0.96); display: inline-block; margin: 1%; border: solid black 0.2em; @@ -37,3 +37,9 @@ body { width: 70%; height: 70%; } + +@media (max-width: 52em) { + #overview, #messages, #puzzles, #main { + width: 96%; + } +} \ No newline at end of file diff --git a/www/res/terminal.js b/www/res/terminal.js index 8967889..fec7de5 100644 --- a/www/res/terminal.js +++ b/www/res/terminal.js @@ -2,18 +2,19 @@ function tx(element, text, bps) { var drawTimer; var displayed = ""; + var idx = 0; function draw() { - c = text[0]; - displayed += c; + displayed += text[idx]; element.textContent = displayed; - text = text.substr(1); - if (text.length == 0) { - clearInterval(drawTimer); - return; - } + + idx += 1; if (element.parentNode.lastChild == element) { element.scrollIntoView(); } + if (text.length == idx) { + clearInterval(drawTimer); + return; + } } // N81 uses 1 stop bit, and 1 parity bit. @@ -37,7 +38,6 @@ function Terminal(target, bps) { target.appendChild(out); tx(out, next[1], bps); - console.log(outq.length); if (outq.length == 0) { clearInterval(outTimer); }