From 41b8cce793a3fd35e363bc53390d6d7778661544 Mon Sep 17 00:00:00 2001 From: NigeParis Date: Thu, 15 Jan 2026 12:58:24 +0100 Subject: [PATCH] changed key for chat popup exit --- frontend/src/chat/chat.ts | 14 +++++++++++--- frontend/src/chat/chatHelperFunctions/cmdList.ts | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/frontend/src/chat/chat.ts b/frontend/src/chat/chat.ts index 7bb011f..9a1d9c1 100644 --- a/frontend/src/chat/chat.ts +++ b/frontend/src/chat/chat.ts @@ -83,9 +83,10 @@ const sendtextbox = document.getElementById( ) as HTMLButtonElement; const systemWindow = document.getElementById("chat-system-box") as HTMLDivElement; + function chatKeyToggle() { let anti_flicker_control = false; - const chat_toggle_key = 'f2'; + const chat_toggle_key = 'escape'; const chat_toggle_key2 = 'f1'; document.addEventListener("keydown", (event) => { if (event.repeat && keysPressed[chat_toggle_key] === true) { @@ -106,6 +107,8 @@ function chatKeyToggle() { chatBox.classList.add("hidden"); chatMessageIn?.classList.add("hidden"); chatMessageIn!.textContent = ''; + profilList?.classList.add("hidden"); + windowStateHidden(); } if (keysPressed[chat_toggle_key2] === true) { anti_flicker_control = false; @@ -113,7 +116,11 @@ function chatKeyToggle() { overlay.classList.add("opacity-60"); chatMessageIn?.classList.add("hidden"); chatMessageIn!.textContent = ''; + let socket = window.__state.chatSock; + if (!socket) return; + connected(socket); sendtextbox.focus(); + windowStateVisable(); } }, 1000/10); @@ -181,7 +188,7 @@ function initChatSocket() { const messageElement = document.createElement("div"); messageElement.textContent = `${user}: is connected au server`; systemWindow.appendChild(messageElement); - systemWindow.scrollTop = systemWindow.scrollHeight; + systemWindow.lastElementChild?.scrollIntoView({ block: "end" }); }); chatMessageIn?.classList.add("hidden"); @@ -231,7 +238,8 @@ function initChatSocket() { systemWindow.removeChild(systemWindow.firstChild!); } systemWindow.appendChild(messageElement); - systemWindow.scrollTop = systemWindow.scrollHeight; + systemWindow.lastElementChild?.scrollIntoView({ block: "end" }); + } }); diff --git a/frontend/src/chat/chatHelperFunctions/cmdList.ts b/frontend/src/chat/chatHelperFunctions/cmdList.ts index 1eb0211..bc24738 100644 --- a/frontend/src/chat/chatHelperFunctions/cmdList.ts +++ b/frontend/src/chat/chatHelperFunctions/cmdList.ts @@ -17,7 +17,7 @@ export function cmdList() { addMessage('\'@pong\' - displays your pong match results'); addMessage('\'@ttt\' - displays your ttt match results'); addMessage('\'F1\' - chat box display toggles on'); - addMessage('\'F2\' - chat box display toggles off'); + addMessage('\'ESC\' - chat box display toggles off'); addMessage('** *********************************** **'); addMessage('*'); } \ No newline at end of file