From 3c32eee9a542fa89f831734f8a36d8fd950564fc Mon Sep 17 00:00:00 2001 From: Miodec Date: Wed, 27 Sep 2023 22:08:14 +0100 Subject: [PATCH] refactor: not running test dependent functions if active page is not test --- frontend/src/ts/test/test-ui.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/src/ts/test/test-ui.ts b/frontend/src/ts/test/test-ui.ts index d93dc1d85..30327ac13 100644 --- a/frontend/src/ts/test/test-ui.ts +++ b/frontend/src/ts/test/test-ui.ts @@ -20,6 +20,7 @@ import { skipXpBreakdown } from "../elements/account-button"; import * as FunboxList from "./funbox/funbox-list"; import { debounce } from "throttle-debounce"; import * as ResultWordHighlight from "../elements/result-word-highlight"; +import * as ActivePage from "../states/active-page"; const debouncedZipfCheck = debounce(250, () => { Misc.checkIfLanguageSupportsZipf(Config.language).then((supports) => { @@ -226,6 +227,7 @@ function shouldUpdateWordsInputPosition(): boolean { } export function updateWordsInputPosition(initial = false): void { + if (ActivePage.get() !== "test") return; if (Config.tapeMode !== "off" && !initial) return; const el = document.querySelector("#wordsInput") as HTMLElement; const activeWord = document.querySelector( @@ -282,6 +284,7 @@ export function updateWordsInputPosition(initial = false): void { } function updateWordsHeight(force = false): void { + if (ActivePage.get() !== "test") return; if (!force && Config.mode !== "custom") return; $("#wordsWrapper").removeClass("hidden"); const wordHeight = (