changed key for chat popup exit
This commit is contained in:
parent
9a20e03870
commit
41b8cce793
2 changed files with 12 additions and 4 deletions
|
|
@ -83,9 +83,10 @@ const sendtextbox = document.getElementById(
|
||||||
) as HTMLButtonElement;
|
) as HTMLButtonElement;
|
||||||
const systemWindow = document.getElementById("chat-system-box") as HTMLDivElement;
|
const systemWindow = document.getElementById("chat-system-box") as HTMLDivElement;
|
||||||
|
|
||||||
|
|
||||||
function chatKeyToggle() {
|
function chatKeyToggle() {
|
||||||
let anti_flicker_control = false;
|
let anti_flicker_control = false;
|
||||||
const chat_toggle_key = 'f2';
|
const chat_toggle_key = 'escape';
|
||||||
const chat_toggle_key2 = 'f1';
|
const chat_toggle_key2 = 'f1';
|
||||||
document.addEventListener("keydown", (event) => {
|
document.addEventListener("keydown", (event) => {
|
||||||
if (event.repeat && keysPressed[chat_toggle_key] === true) {
|
if (event.repeat && keysPressed[chat_toggle_key] === true) {
|
||||||
|
|
@ -106,6 +107,8 @@ function chatKeyToggle() {
|
||||||
chatBox.classList.add("hidden");
|
chatBox.classList.add("hidden");
|
||||||
chatMessageIn?.classList.add("hidden");
|
chatMessageIn?.classList.add("hidden");
|
||||||
chatMessageIn!.textContent = '';
|
chatMessageIn!.textContent = '';
|
||||||
|
profilList?.classList.add("hidden");
|
||||||
|
windowStateHidden();
|
||||||
}
|
}
|
||||||
if (keysPressed[chat_toggle_key2] === true) {
|
if (keysPressed[chat_toggle_key2] === true) {
|
||||||
anti_flicker_control = false;
|
anti_flicker_control = false;
|
||||||
|
|
@ -113,7 +116,11 @@ function chatKeyToggle() {
|
||||||
overlay.classList.add("opacity-60");
|
overlay.classList.add("opacity-60");
|
||||||
chatMessageIn?.classList.add("hidden");
|
chatMessageIn?.classList.add("hidden");
|
||||||
chatMessageIn!.textContent = '';
|
chatMessageIn!.textContent = '';
|
||||||
|
let socket = window.__state.chatSock;
|
||||||
|
if (!socket) return;
|
||||||
|
connected(socket);
|
||||||
sendtextbox.focus();
|
sendtextbox.focus();
|
||||||
|
windowStateVisable();
|
||||||
|
|
||||||
}
|
}
|
||||||
}, 1000/10);
|
}, 1000/10);
|
||||||
|
|
@ -181,7 +188,7 @@ function initChatSocket() {
|
||||||
const messageElement = document.createElement("div");
|
const messageElement = document.createElement("div");
|
||||||
messageElement.textContent = `${user}: is connected au server`;
|
messageElement.textContent = `${user}: is connected au server`;
|
||||||
systemWindow.appendChild(messageElement);
|
systemWindow.appendChild(messageElement);
|
||||||
systemWindow.scrollTop = systemWindow.scrollHeight;
|
systemWindow.lastElementChild?.scrollIntoView({ block: "end" });
|
||||||
});
|
});
|
||||||
chatMessageIn?.classList.add("hidden");
|
chatMessageIn?.classList.add("hidden");
|
||||||
|
|
||||||
|
|
@ -231,7 +238,8 @@ function initChatSocket() {
|
||||||
systemWindow.removeChild(systemWindow.firstChild!);
|
systemWindow.removeChild(systemWindow.firstChild!);
|
||||||
}
|
}
|
||||||
systemWindow.appendChild(messageElement);
|
systemWindow.appendChild(messageElement);
|
||||||
systemWindow.scrollTop = systemWindow.scrollHeight;
|
systemWindow.lastElementChild?.scrollIntoView({ block: "end" });
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ export function cmdList() {
|
||||||
addMessage('\'@pong\' - displays your pong match results');
|
addMessage('\'@pong\' - displays your pong match results');
|
||||||
addMessage('\'@ttt\' - displays your ttt match results');
|
addMessage('\'@ttt\' - displays your ttt match results');
|
||||||
addMessage('\'F1\' - chat box display toggles on');
|
addMessage('\'F1\' - chat box display toggles on');
|
||||||
addMessage('\'F2\' - chat box display toggles off');
|
addMessage('\'ESC\' - chat box display toggles off');
|
||||||
addMessage('** *********************************** **');
|
addMessage('** *********************************** **');
|
||||||
addMessage('*');
|
addMessage('*');
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue