refactor: not running test dependent functions if active page is not test

This commit is contained in:
Miodec 2023-09-27 22:08:14 +01:00
parent 897cfde4eb
commit 3c32eee9a5

View file

@ -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 = <number>(