From de938984f8edbb39ddf1fc8062e836baa9ab4465 Mon Sep 17 00:00:00 2001 From: Christian Heller <c.heller@plomlompom.de> Date: Wed, 25 Nov 2020 05:28:34 +0100 Subject: [PATCH] Display keyboard control hint in web client. --- rogue_chat.html | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/rogue_chat.html b/rogue_chat.html index 636773d..c10f7ca 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -11,12 +11,14 @@ </head><body> <div> terminal rows: <input id="n_rows" type="number" step=4 min=24 value=24 /> -terminal columns: <input id="n_cols" type="number" step=4 min=80 value=80 /> +· terminal columns: <input id="n_cols" type="number" step=4 min=80 value=80 /> +· <a href="https://plomlompom.com/repos/?p=plomrogue2;a=summary">source code</a> (includes proper terminal/ncurses client) </div> <pre id="terminal"></pre> <textarea id="input" style="opacity: 0; width: 0px;"></textarea> <div> -<a href="https://plomlompom.com/repos/?p=plomrogue2;a=summary">source code</a> (includes proper terminal / curses client) +keyboard input/control: <span id="keyboard_control"></span> +</div> <h3>button controls for mouse players</h3> <table style="float: left"> <tr> @@ -1377,6 +1379,15 @@ window.setInterval(function() { tui.log_msg('@ attempting reconnect â¦') } }, 5000); +window.setInterval(function() { + let val = "?"; + if (document.activeElement == tui.inputEl) { + val = "on (click outside terminal to change)"; + } else { + val = "off (click into terminal to change)"; + }; + document.getElementById("keyboard_control").textContent = val; +}, 100); document.getElementById("terminal").onclick = function() { tui.inputEl.focus(); }; -- 2.30.2