WIP progess f1 button when changing login with refresh
This commit is contained in:
parent
63549752e8
commit
308818fd74
1 changed files with 7 additions and 8 deletions
|
|
@ -33,6 +33,7 @@ import { showError } from "@app/toast";
|
||||||
const MAX_SYSTEM_MESSAGES = 10;
|
const MAX_SYSTEM_MESSAGES = 10;
|
||||||
let inviteMsgFlag: boolean = false;
|
let inviteMsgFlag: boolean = false;
|
||||||
export let noGuestFlag: boolean = true;
|
export let noGuestFlag: boolean = true;
|
||||||
|
let keysPressed: Record<string, boolean> = {};
|
||||||
|
|
||||||
declare module "ft_state" {
|
declare module "ft_state" {
|
||||||
interface State {
|
interface State {
|
||||||
|
|
@ -84,11 +85,10 @@ const systemWindow = document.getElementById("chat-system-box") as HTMLDivElemen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const keysPressed: Record<string, boolean> = {};
|
|
||||||
async function chatKeyToggle() {
|
|
||||||
const chat_toggle_key = 'f1';
|
|
||||||
let anti_flicker_control = false;
|
let anti_flicker_control = false;
|
||||||
|
|
||||||
|
function chatKeyToggle() {
|
||||||
|
const chat_toggle_key = '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;
|
||||||
|
|
@ -98,25 +98,26 @@ async function chatKeyToggle() {
|
||||||
});
|
});
|
||||||
document.addEventListener("keyup", (event) => {
|
document.addEventListener("keyup", (event) => {
|
||||||
keysPressed[event.key.toLowerCase()] = false;
|
keysPressed[event.key.toLowerCase()] = false;
|
||||||
if (event.key.toLowerCase() === chat_toggle_key)
|
if (event.key.toLowerCase() === chat_toggle_key) {
|
||||||
anti_flicker_control = false;
|
anti_flicker_control = false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
setInterval( () => {
|
setInterval( () => {
|
||||||
if(keysPressed[chat_toggle_key] === true) {
|
if(keysPressed[chat_toggle_key] === true) {
|
||||||
if (!chatBox.classList.contains("hidden") && anti_flicker_control === false) {
|
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");
|
||||||
overlay.classList.remove("opacity-60");
|
|
||||||
chatMessageIn?.classList.add("hidden");
|
chatMessageIn?.classList.add("hidden");
|
||||||
chatMessageIn!.textContent = '';
|
chatMessageIn!.textContent = '';
|
||||||
} else {
|
} else {
|
||||||
|
if (anti_flicker_control && !chatBox.classList.contains("hidden")) return;
|
||||||
|
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);
|
||||||
};
|
};
|
||||||
|
|
@ -514,8 +515,6 @@ myTTTGames?.addEventListener("click", () => {
|
||||||
quitChat();
|
quitChat();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Enter key to send message
|
// Enter key to send message
|
||||||
sendtextbox.addEventListener("keydown", (event) => {
|
sendtextbox.addEventListener("keydown", (event) => {
|
||||||
if (!sendtextbox) return;
|
if (!sendtextbox) return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue