added proper server connection dialog

This commit is contained in:
ari melody 2023-10-03 01:21:34 +01:00
parent d3c35e7b8c
commit 6ced824e1c
No known key found for this signature in database
GPG key ID: 12A070A0ACDCA45F
4 changed files with 134 additions and 2 deletions

View file

@ -10,6 +10,7 @@ var client;
var my_colour = false;
var pre_buffer_chars = 0;
var server_url = "";
var enable_input = true;
const DATA_TYPES = {
ping: 0,
@ -223,11 +224,22 @@ function new_caret() {
content.appendChild(new_caret);
}
/**
* sets whether or not the terminal should accept user input
* (handy for not interfering with dialogs)
* @param {value} boolean
*/
export function set_enable_input(value) {
enable_input = value;
}
/**
* the input handler for the document.
* automatically scrolls to the bottom of the page on valid key presses.
*/
function handle_input(event) {
if (!enable_input) return;
if (event.key == "'") {
event.preventDefault();
}