diff options
Diffstat (limited to 'planed.html')
-rw-r--r-- | planed.html | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/planed.html b/planed.html new file mode 100644 index 0000000..6e685b8 --- /dev/null +++ b/planed.html @@ -0,0 +1,62 @@ +<html> + <head> + <title> + Plane + </title> + <style> +body { + background-color: #111; +} + +div#overlay { + background-image: linear-gradient(0deg, #000 75%, #666 25%); + background-size: 1em 1em; + opacity: 0.1; + position: absolute; + width: 100%; + height: 100%; + top: 0; + left: 0; +} + +div.msg { + margin-bottom: 0.5em; + color: #0D0; + font-family: monospace; + font-size: 2em; + font-weight: bold; +} + </style> + </head> + <body> + <div id="overlay"></div> + <div id="log"></div> + <script> + let ws = new WebSocket("ws://localhost:3000"); + let div = document.getElementById("log"); + let loglen = 0; + const logmax = 18; + const timemax = 5000; + + ws.onmessage = function(ev) { + loglen += 1; + div.innerHTML += "<div class=\"msg\" id=\"msg" + loglen + "\">" + ev.data + "</div>"; + if (loglen > logmax) + document.getElementById("msg" + (loglen - logmax)).remove(); + }; + + function rantime() { + return Math.random() * timemax + 1000; + } + + function msgloop() { + ws.send("any"); + setTimeout(msgloop, rantime()); + } + + ws.onopen = function(ev) { + setTimeout(msgloop, rantime()); + } + </script> + </body> +</html> |