mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-01 09:14:27 +08:00
ignoring media and audio keys
This commit is contained in:
parent
37b06e9aeb
commit
ebc1828d65
2 changed files with 13 additions and 0 deletions
8
frontend/src/ts/constants/ignored-keys.ts
Normal file
8
frontend/src/ts/constants/ignored-keys.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
export const IgnoredKeys = [
|
||||
"MediaTrackNext",
|
||||
"MediaTrackPrevious",
|
||||
"MediaPlayPause",
|
||||
"AudioVolumeUp",
|
||||
"AudioVolumeDown",
|
||||
"AudioVolumeMute",
|
||||
];
|
|
@ -30,6 +30,7 @@ import * as TestWords from "../test/test-words";
|
|||
import * as Hangul from "hangul-js";
|
||||
import * as CustomTextState from "../states/custom-text-name";
|
||||
import { navigate } from "../observables/navigate-event";
|
||||
import { IgnoredKeys } from "../constants/ignored-keys";
|
||||
|
||||
let dontInsertSpace = false;
|
||||
let correctShiftUsed = true;
|
||||
|
@ -765,6 +766,8 @@ function handleTab(event: JQuery.KeyDownEvent, popupVisible: boolean): void {
|
|||
$(document).keydown(async (event) => {
|
||||
if (ActivePage.get() == "loading") return;
|
||||
|
||||
if (IgnoredKeys.includes(event.key)) return;
|
||||
|
||||
//autofocus
|
||||
const wordsFocused: boolean = $("#wordsInput").is(":focus");
|
||||
const pageTestActive: boolean = ActivePage.get() === "test";
|
||||
|
@ -961,6 +964,8 @@ $("#wordsInput").keyup((event) => {
|
|||
return;
|
||||
}
|
||||
|
||||
if (IgnoredKeys.includes(event.key)) return;
|
||||
|
||||
if (TestUI.resultVisible) return;
|
||||
const now: number = performance.now();
|
||||
if (TestInput.keypressTimings.duration.current !== -1) {
|
||||
|
|
Loading…
Reference in a new issue