mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-22 05:26:14 +08:00
fixed caps warning not hiding on some linux distros
This commit is contained in:
parent
369be4db76
commit
8000585bf2
1 changed files with 17 additions and 15 deletions
|
@ -40,21 +40,23 @@ $(document).on("keydown", function (event) {
|
|||
});
|
||||
|
||||
$(document).on("keyup", function (event) {
|
||||
if (
|
||||
event?.originalEvent?.getModifierState &&
|
||||
event?.originalEvent?.getModifierState("CapsLock")
|
||||
) {
|
||||
//filthy fix but optional chaining refues to work
|
||||
capsState = true;
|
||||
} else {
|
||||
capsState = false;
|
||||
}
|
||||
|
||||
try {
|
||||
if (Config.capsLockWarning && capsState) {
|
||||
show();
|
||||
setTimeout(() => {
|
||||
if (
|
||||
event?.originalEvent?.getModifierState &&
|
||||
event?.originalEvent?.getModifierState("CapsLock")
|
||||
) {
|
||||
//filthy fix but optional chaining refues to work
|
||||
capsState = true;
|
||||
} else {
|
||||
hide();
|
||||
capsState = false;
|
||||
}
|
||||
} catch {}
|
||||
|
||||
try {
|
||||
if (Config.capsLockWarning && capsState) {
|
||||
show();
|
||||
} else {
|
||||
hide();
|
||||
}
|
||||
} catch {}
|
||||
}, 1); // weird fix to make sure the caps warning doesnt get stuck on linux
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue