Added F1 and F2 toggle chat window on and off
This commit is contained in:
parent
c623019fe3
commit
837361ea80
2 changed files with 7 additions and 10 deletions
|
|
@ -83,12 +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 = 'f1';
|
const chat_toggle_key = 'f2';
|
||||||
|
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) {
|
||||||
anti_flicker_control = true;
|
anti_flicker_control = true;
|
||||||
|
|
@ -104,27 +102,25 @@ function chatKeyToggle() {
|
||||||
});
|
});
|
||||||
setInterval( () => {
|
setInterval( () => {
|
||||||
if(keysPressed[chat_toggle_key] === true) {
|
if(keysPressed[chat_toggle_key] === true) {
|
||||||
if (!chatBox.classList.contains("hidden") && anti_flicker_control === false) {
|
|
||||||
overlay.classList.remove("opacity-60");
|
overlay.classList.remove("opacity-60");
|
||||||
chatBox.classList.add("hidden");
|
chatBox.classList.add("hidden");
|
||||||
chatMessageIn?.classList.add("hidden");
|
chatMessageIn?.classList.add("hidden");
|
||||||
chatMessageIn!.textContent = '';
|
chatMessageIn!.textContent = '';
|
||||||
} else {
|
}
|
||||||
if (anti_flicker_control && !chatBox.classList.contains("hidden")) return;
|
if (keysPressed[chat_toggle_key2] === true) {
|
||||||
anti_flicker_control = false;
|
anti_flicker_control = false;
|
||||||
chatBox.classList.remove("hidden");
|
chatBox.classList.remove("hidden");
|
||||||
overlay.classList.add("opacity-60");
|
overlay.classList.add("opacity-60");
|
||||||
chatMessageIn?.classList.add("hidden");
|
chatMessageIn?.classList.add("hidden");
|
||||||
chatMessageIn!.textContent = '';
|
chatMessageIn!.textContent = '';
|
||||||
sendtextbox.focus();
|
sendtextbox.focus();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, 1000/10);
|
}, 1000/10);
|
||||||
};
|
};
|
||||||
|
|
||||||
function initChatSocket() {
|
function initChatSocket() {
|
||||||
let socket = getSocket();
|
let socket = getSocket();
|
||||||
// let blockMessage: boolean;
|
|
||||||
if (
|
if (
|
||||||
!chatBox ||
|
!chatBox ||
|
||||||
!chatMessageIn ||
|
!chatMessageIn ||
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,8 @@ export function cmdList() {
|
||||||
addMessage('\'@quit\' - disconnect user from the chat');
|
addMessage('\'@quit\' - disconnect user from the chat');
|
||||||
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 / off');
|
addMessage('\'F1\' - chat box display toggles on');
|
||||||
|
addMessage('\'F2\' - chat box display toggles off');
|
||||||
addMessage('** *********************************** **');
|
addMessage('** *********************************** **');
|
||||||
addMessage('*');
|
addMessage('*');
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue