diff --git a/www/index.html b/www/index.html index 0aff389..f80e6a4 100644 --- a/www/index.html +++ b/www/index.html @@ -8,12 +8,25 @@ - + + + + MOTH Dashboard -
+
+ 🎃 +
+
+ 💾 +
+
+ 🌮 +
+
+ 🎩
diff --git a/www/res/brown-lines.jpg b/www/res/brown-lines.jpg new file mode 100644 index 0000000..63d30ac Binary files /dev/null and b/www/res/brown-lines.jpg differ diff --git a/www/res/main.js b/www/res/main.js new file mode 100644 index 0000000..3179348 --- /dev/null +++ b/www/res/main.js @@ -0,0 +1,40 @@ +var main_proc; + +function Main(element) { + console.log(element); + var term = new Terminal(element); + + this.start = function() { + console.log(element); + term.clear(); + term.par("Main terminal"); + term.par("Main terminal"); + term.par("Main terminal"); + term.par("Main terminal"); + term.par("Main terminal"); + term.par("Main terminal"); + term.par("Main terminal"); + term.par("Main terminal"); + term.par("Main terminal"); + term.par("Main terminal"); + term.par("Main terminal"); + term.par("Main terminal"); + term.par("Main terminal"); + term.par("Main terminal"); + term.par("Main terminal"); + term.par("Main terminal"); + term.par("Main terminal"); + term.par("Main terminal"); + term.par("Main terminal"); + term.par("Main terminal"); + term.par("Main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main main terminal"); + } +} + + +function main_start() { + main_proc = new Main(document.getElementById("main")); + setTimeout(main_proc.start, 2500); +} + +window.addEventListener("load", main_start); diff --git a/www/res/messages.js b/www/res/messages.js new file mode 100644 index 0000000..186e291 --- /dev/null +++ b/www/res/messages.js @@ -0,0 +1,18 @@ +var messages_proc; + +function Messages(element) { + var term = new Terminal(element); + + this.start = function() { + term.clear(); + term.par("Messages terminal"); + } +} + + +function messages_start() { + messages_proc = new Messages(document.getElementById("messages")); + setTimeout(messages_proc.start, 500); +} + +window.addEventListener("load", messages_start); diff --git a/www/res/moth.js b/www/res/moth.js deleted file mode 100644 index dc6430e..0000000 --- a/www/res/moth.js +++ /dev/null @@ -1,12 +0,0 @@ -// Moth dashboard -// requires: terminal.js - -function start() { - var t = new Terminal(document.getElementById("output")); - - t.par("This is a paragraph, bitches!"); - t.pre("This is pre"); - t.par("Another par"); -} - -window.addEventListener("load", start); diff --git a/www/res/overview.js b/www/res/overview.js new file mode 100644 index 0000000..192980c --- /dev/null +++ b/www/res/overview.js @@ -0,0 +1,18 @@ +var overview_proc; + +function Overview(element) { + var term = new Terminal(element); + + this.start = function() { + term.clear(); + term.par("Overview terminal"); + } +} + + +function overview_start() { + overview_proc = new Overview(document.getElementById("overview")); + setTimeout(overview_proc.start, 4000); +} + +window.addEventListener("load", overview_start); diff --git a/www/res/puzzles.js b/www/res/puzzles.js new file mode 100644 index 0000000..0aa4f84 --- /dev/null +++ b/www/res/puzzles.js @@ -0,0 +1,18 @@ +var puzzles_proc; + +function Puzzles(element) { + var term = new Terminal(element); + + this.start = function() { + term.clear(); + term.par("Puzzles terminal"); + } +} + + +function puzzles_start() { + puzzles_proc = new Puzzles(document.getElementById("puzzles")); + setTimeout(puzzles_proc.start, 3000); +} + +window.addEventListener("load", puzzles_start); diff --git a/www/res/style.css b/www/res/style.css index 8b13789..d38d3bf 100644 --- a/www/res/style.css +++ b/www/res/style.css @@ -1 +1,39 @@ +html { + background: rgba(61, 50, 44, 0) url(brown-lines.jpg) no-repeat center center fixed; + background-size: cover; + color: #ccb; + height: 100%; +} +body { + margin: 0; + height: 100% +} + +.terminal { + background: rgba(80, 70, 60, 0.9); + display: inline-block; + margin: 1%; + border: solid black 0.2em; + border-radius: 1em 0.25em 1em 1em; + overflow: auto; +} + +.terminal p { + padding: 0.25em 0.5em; +} + +#overview, #messages { + width: 47%; + height: 20%; +} + +#puzzles { + width: 24%; + height: 70%; +} + +#main { + width: 70%; + height: 70%; +} diff --git a/www/res/terminal.js b/www/res/terminal.js index cf2a8ac..8967889 100644 --- a/www/res/terminal.js +++ b/www/res/terminal.js @@ -1,22 +1,19 @@ function tx(element, text, bps) { var drawTimer; - var sp = false; + var displayed = ""; function draw() { c = text[0]; - if ((c == " ") || (c == "\n")) { - sp = true; - c = " "; - } else if (sp) { - c = " " + c; - sp = false; - } - element.textContent += c; + displayed += c; + element.textContent = displayed; text = text.substr(1); - if (text == "") { + if (text.length == 0) { clearInterval(drawTimer); return; } + if (element.parentNode.lastChild == element) { + element.scrollIntoView(); + } } // N81 uses 1 stop bit, and 1 parity bit. @@ -40,11 +37,18 @@ function Terminal(target, bps) { target.appendChild(out); tx(out, next[1], bps); + console.log(outq.length); if (outq.length == 0) { clearInterval(outTimer); } } + this.clear = function() { + while (target.firstChild) { + target.removeChild(target.firstChild); + } + } + this.enqueue = function(tag, txt) { outq.push([tag, txt]); if (! outTimer) {