</div>
<pre id="terminal"></pre>
<textarea id="input" style="opacity: 0; width: 0px;"></textarea>
-<div>
-keyboard input/control: <span id="keyboard_control"></span>
-</div>
<h3>button controls for hard-to-remember keybindings</h3>
<table id="move_table" style="float: left">
<tr>
tui.full_refresh();
}, false);
document.onclick = function() {
- tui.show_help = false;
+ if (!tui.mode.is_single_char_entry) {
+ tui.show_help = false;
+ }
};
tui.inputEl.addEventListener('keydown', (event) => {
tui.show_help = false;
}
}, 1000);
window.setInterval(function() {
- let val = "?";
- let span_decoration = "none";
- if (document.activeElement == tui.inputEl) {
- val = "on (click outside terminal to change)";
- } else {
- val = "off (click into terminal to change)";
- span_decoration = "line-through";
+ if (document.activeElement.tagName.toLowerCase() != 'input') {
+ tui.inputEl.focus();
};
- document.getElementById("keyboard_control").textContent = val;
- for (const span of document.querySelectorAll('.keyboard_controlled')) {
- span.style.textDecoration = span_decoration;
- }
}, 100);
document.getElementById("terminal").onclick = function() {
tui.inputEl.focus();
continue;
};
let direction = move_button.id.split('_')[2].toUpperCase();
- move_button.onclick = function() {
- if (tui.mode.available_actions.includes("move")) {
- server.send(['TASK:MOVE', direction]);
- } else if (tui.mode.available_actions.includes("move_explorer")) {
- explorer.move(direction);
- tui.full_refresh();
- };
+ let move_repeat;
+ move_button.onmousedown = function() {
+ move_repeat = window.setInterval(function() {
+ if (tui.mode.available_actions.includes("move")) {
+ server.send(['TASK:MOVE', direction]);
+ } else if (tui.mode.available_actions.includes("move_explorer")) {
+ explorer.move(direction);
+ tui.full_refresh();
+ };
+ }, 100);
};
+ move_button.onmouseup = function() {
+ window.clearInterval(move_repeat);
+ }
};
</script>
</body></html>