Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
be29e24
Convert
Leonabcd123 Jan 7, 2026
5fdc839
Add default value
Leonabcd123 Jan 7, 2026
c2f5d21
Merge branch 'master' into bye-jquery-test
Leonabcd123 Jan 7, 2026
15adadc
Add getChildren
Leonabcd123 Jan 7, 2026
047c158
Add back getChildren
Leonabcd123 Jan 7, 2026
45aaa74
Chain
Leonabcd123 Jan 7, 2026
a33be62
Return ElementsWithUtils
Leonabcd123 Jan 7, 2026
2e4509b
Fix qsa warning
Leonabcd123 Jan 7, 2026
58c6e12
fehmer
Leonabcd123 Jan 7, 2026
5c5d6af
Remove comments
Leonabcd123 Jan 7, 2026
db0e29c
Remove getElementIndex
Leonabcd123 Jan 7, 2026
d0e63b8
Merge branch 'master' into bye-jquery-test
Leonabcd123 Jan 7, 2026
d41a701
Merge branch 'master' into bye-jquery-test
Leonabcd123 Jan 11, 2026
f4d5d4c
Merge branch 'master' into pr/Leonabcd123/7325
Miodec Jan 14, 2026
b090fe1
Merge branch 'master' into bye-jquery-test
Leonabcd123 Jan 14, 2026
f2e57c5
Remove jquery from test-screenshot
Leonabcd123 Jan 15, 2026
c40460b
Complete
Leonabcd123 Jan 15, 2026
7d18970
Remove jQuery from test-logic
Leonabcd123 Jan 15, 2026
69785b0
Remove jQuery from result
Leonabcd123 Jan 18, 2026
4a2c3b5
Remove jQuery from test-config
Leonabcd123 Jan 18, 2026
3edba28
Replace native dom with dom utils
Leonabcd123 Jan 19, 2026
ea58306
Merge branch 'master' into bye-jquery-test
Leonabcd123 Jan 19, 2026
8ee3417
Remove jquery from funbox-functions
Leonabcd123 Jan 19, 2026
881718f
Don't accept jQuery
Leonabcd123 Jan 19, 2026
a333c11
Merge branch 'master' into pr/Leonabcd123/7325
Miodec Jan 21, 2026
b5976e1
Accept KeyboardEvent
Leonabcd123 Jan 21, 2026
3db8a37
finish
Miodec Jan 21, 2026
7b097d7
Update frontend/src/ts/observables/connection-event.ts
Miodec Jan 21, 2026
1ec63a0
remove
Miodec Jan 21, 2026
9dc457d
rename
Miodec Jan 21, 2026
421447e
fix
Miodec Jan 21, 2026
275f67a
improve utils
Miodec Jan 21, 2026
9437d15
No ??
Leonabcd123 Jan 21, 2026
13b6731
Return this
Leonabcd123 Jan 21, 2026
d9a2721
Remove getChildren
Leonabcd123 Jan 21, 2026
1f56b93
use getchildren
Miodec Jan 21, 2026
0a6a084
Don't spread
Leonabcd123 Jan 21, 2026
ff61f4a
Don't spread
Leonabcd123 Jan 21, 2026
1544459
filter after split
Miodec Jan 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions frontend/__tests__/test/layout-emulator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@ describe("LayoutEmulator", () => {
updateAltGrState(event);
});

const createEvent = (
code: string,
type: string,
): JQuery.KeyboardEventBase =>
const createEvent = (code: string, type: string): KeyboardEvent =>
({
code,
type,
}) as JQuery.KeyboardEventBase;
}) as KeyboardEvent;

it("should set isAltGrPressed to true on AltRight keydown", () => {
const event = createEvent("AltRight", "keydown");
Expand Down
7 changes: 3 additions & 4 deletions frontend/src/ts/test/focus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,13 @@ export function set(value: boolean, withCursor = false): void {
});
}

$(document).on("mousemove", function (event) {
document.addEventListener("mousemove", function (event) {
if (PageTransition.get()) return;
if (!state) return;
if (
event.originalEvent &&
// To avoid mouse/desk vibration from creating a flashy effect, we'll unfocus @ >5px instead of >0px
(event.originalEvent.movementX > unfocusPx ||
event.originalEvent.movementY > unfocusPx)
event.movementX > unfocusPx ||
event.movementY > unfocusPx
) {
set(false);
}
Expand Down
21 changes: 11 additions & 10 deletions frontend/src/ts/test/funbox/funbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
} from "./list";
import { checkForcedConfig } from "./funbox-validation";
import { tryCatch } from "@monkeytype/util/trycatch";
import { qs } from "../../utils/dom";

export function toggleScript(...params: string[]): void {
if (Config.funbox.length === 0) return;
Expand Down Expand Up @@ -66,18 +67,18 @@ export function toggleFunbox(funbox: FunboxName): void {
}

export async function clear(): Promise<boolean> {
$("body").attr(
qs("body")?.setAttribute(
"class",
$("body")
?.attr("class")
qs("body")
?.getAttribute("class")
?.split(/\s+/)
?.filter((it) => !it.startsWith("fb-"))
?.join(" ") ?? "",
);

$(".funBoxTheme").remove();
qs(".funBoxTheme")?.remove();

$("#wordsWrapper").removeClass("hidden");
qs("#wordsWrapper")?.show();
MemoryTimer.reset();
ManualRestart.set();
return true;
Expand Down Expand Up @@ -115,7 +116,7 @@ export async function activate(
await setFunboxBodyClasses();
await applyFunboxCSS();

$("#wordsWrapper").removeClass("hidden");
qs("#wordsWrapper")?.show();

const { data: language, error } = await tryCatch(
JSONData.getCurrentLanguage(Config.language),
Expand Down Expand Up @@ -216,23 +217,23 @@ export async function rememberSettings(): Promise<void> {
}

async function setFunboxBodyClasses(): Promise<boolean> {
const $body = $("body");
const $body = qs("body");

const activeFbClasses = getActiveFunboxNames().map(
(name) => "fb-" + name.replaceAll("_", "-"),
);

const currentClasses =
$body
?.attr("class")
?.getAttribute("class")
?.split(/\s+/)
.filter((it) => !it.startsWith("fb-")) ?? [];

if (isFunboxActiveWithProperty("ignoreReducedMotion")) {
currentClasses.push("ignore-reduced-motion");
}

$body.attr(
$body?.setAttribute(
"class",
[...new Set([...currentClasses, ...activeFbClasses]).keys()].join(" "),
);
Expand All @@ -241,7 +242,7 @@ async function setFunboxBodyClasses(): Promise<boolean> {
}

async function applyFunboxCSS(): Promise<boolean> {
$(".funBoxTheme").remove();
qs(".funBoxTheme")?.remove();
for (const funbox of getActiveFunboxesWithProperty("hasCssFile")) {
const css = document.createElement("link");
css.classList.add("funBoxTheme");
Expand Down
16 changes: 7 additions & 9 deletions frontend/src/ts/test/funbox/layoutfluid-funbox-timer.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
import { animate } from "animejs";
import { capitalizeFirstLetter } from "../../utils/strings";
import { applyReducedMotion } from "../../utils/misc";
import { qs } from "../../utils/dom";

const timerEl = document.querySelector(
"#typingTest #layoutfluidTimer",
) as HTMLElement;
const timerEl = qs("#typingTest #layoutfluidTimer");

export function show(): void {
animate(timerEl, {
timerEl?.animate({
opacity: 1,
duration: applyReducedMotion(125),
});
}

export function hide(): void {
animate(timerEl, {
timerEl?.animate({
opacity: 0,
duration: applyReducedMotion(125),
});
}

export function instantHide(): void {
timerEl.style.opacity = "0";
timerEl?.setStyle({ opacity: "0" });
}

export function updateTime(sec: number, layout: string): void {
timerEl.textContent = `${capitalizeFirstLetter(layout)} in: ${sec}s`;
timerEl?.setText(`${capitalizeFirstLetter(layout)} in: ${sec}s`);
}

export function updateWords(words: number, layout: string): void {
Expand All @@ -34,5 +32,5 @@ export function updateWords(words: number, layout: string): void {
if (words === 1) {
str = `${layoutName} starting next word`;
}
timerEl.textContent = str;
timerEl?.setText(str);
}
14 changes: 6 additions & 8 deletions frontend/src/ts/test/funbox/memory-funbox-timer.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import { animate } from "animejs";
import { applyReducedMotion } from "../../utils/misc";
import { qs } from "../../utils/dom";

let memoryTimer: number | null = null;
let memoryInterval: NodeJS.Timeout | null = null;

const timerEl = document.querySelector(
"#typingTest #memoryTimer",
) as HTMLElement;
const timerEl = qs("#typingTest #memoryTimer");

export function show(): void {
animate(timerEl, {
timerEl?.animate({
opacity: 1,
duration: applyReducedMotion(125),
});
}

export function hide(): void {
animate(timerEl, {
timerEl?.animate({
opacity: 0,
duration: applyReducedMotion(125),
});
Expand All @@ -42,11 +40,11 @@ export function start(time: number): void {
memoryTimer === 0 ? hide() : update(memoryTimer);
if (memoryTimer <= 0) {
reset();
$("#wordsWrapper").addClass("hidden");
qs("#wordsWrapper")?.hide();
}
}, 1000);
}

export function update(sec: number): void {
timerEl.textContent = `Timer left to memorise all words: ${sec}s`;
timerEl?.setText(`Timer left to memorise all words: ${sec}s`);
}
6 changes: 3 additions & 3 deletions frontend/src/ts/test/layout-emulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export async function getCharFromEvent(
}
}

export function updateAltGrState(event: JQuery.KeyboardEventBase): void {
export function updateAltGrState(event: KeyboardEvent): void {
const shouldHandleLeftAlt =
event.code === "AltLeft" && navigator.userAgent.includes("Mac");
if (event.code !== "AltRight" && !shouldHandleLeftAlt) return;
Expand All @@ -250,5 +250,5 @@ export function getIsAltGrPressed(): boolean {
return isAltGrPressed;
}

$(document).on("keydown", updateAltGrState);
$(document).on("keyup", updateAltGrState);
document.addEventListener("keydown", updateAltGrState);
document.addEventListener("keyup", updateAltGrState);
40 changes: 19 additions & 21 deletions frontend/src/ts/test/live-acc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,27 @@ import Config from "../config";
import * as TestState from "../test/test-state";
import * as ConfigEvent from "../observables/config-event";
import { applyReducedMotion } from "../utils/misc";
import { animate } from "animejs";
import { requestDebouncedAnimationFrame } from "../utils/debounced-animation-frame";
import { qs } from "../utils/dom";

const textEl = document.querySelector(
"#liveStatsTextBottom .liveAcc",
) as HTMLElement;
const miniEl = document.querySelector("#liveStatsMini .acc") as HTMLElement;
const textEl = qs("#liveStatsTextBottom .liveAcc");
const miniEl = qs("#liveStatsMini .acc");

export function update(acc: number): void {
requestDebouncedAnimationFrame("live-acc.update", () => {
let number = Math.floor(acc);
if (Config.blindMode) {
number = 100;
}
miniEl.innerHTML = number + "%";
textEl.innerHTML = number + "%";
miniEl?.setHtml(number + "%");
textEl?.setHtml(number + "%");
});
}

export function reset(): void {
requestDebouncedAnimationFrame("live-acc.reset", () => {
miniEl.innerHTML = "100%";
textEl.innerHTML = "100%";
miniEl?.setHtml("100%");
textEl?.setHtml("100%");
});
}

Expand All @@ -36,14 +34,14 @@ export function show(): void {
if (state) return;
requestDebouncedAnimationFrame("live-acc.show", () => {
if (Config.liveAccStyle === "mini") {
miniEl.classList.remove("hidden");
animate(miniEl, {
miniEl?.show();
miniEl?.animate({
opacity: [0, 1],
duration: applyReducedMotion(125),
});
} else {
textEl.classList.remove("hidden");
animate(textEl, {
textEl?.show();
textEl?.animate({
opacity: [0, 1],
duration: applyReducedMotion(125),
});
Expand All @@ -55,18 +53,18 @@ export function show(): void {
export function hide(): void {
if (!state) return;
requestDebouncedAnimationFrame("live-acc.hide", () => {
animate(textEl, {
textEl?.animate({
opacity: [1, 0],
duration: applyReducedMotion(125),
onComplete: () => {
textEl.classList.add("hidden");
textEl?.hide();
},
});
animate(miniEl, {
miniEl?.animate({
opacity: [1, 0],
duration: applyReducedMotion(125),
onComplete: () => {
miniEl.classList.add("hidden");
miniEl?.hide();
},
});
state = false;
Expand All @@ -76,10 +74,10 @@ export function hide(): void {
export function instantHide(): void {
if (!state) return;

textEl.classList.add("hidden");
textEl.style.opacity = "0";
miniEl.classList.add("hidden");
miniEl.style.opacity = "0";
textEl?.hide();
textEl?.setStyle({ opacity: "0" });
miniEl?.hide();
miniEl?.setStyle({ opacity: "0" });

state = false;
}
Expand Down
40 changes: 19 additions & 21 deletions frontend/src/ts/test/live-burst.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,24 @@ import * as TestState from "../test/test-state";
import * as ConfigEvent from "../observables/config-event";
import Format from "../utils/format";
import { applyReducedMotion } from "../utils/misc";
import { animate } from "animejs";
import { requestDebouncedAnimationFrame } from "../utils/debounced-animation-frame";
import { qs } from "../utils/dom";

const textEl = document.querySelector(
"#liveStatsTextBottom .liveBurst",
) as HTMLElement;
const miniEl = document.querySelector("#liveStatsMini .burst") as HTMLElement;
const textEl = qs("#liveStatsTextBottom .liveBurst");
const miniEl = qs("#liveStatsMini .burst");

export function reset(): void {
requestDebouncedAnimationFrame("live-burst.reset", () => {
textEl.innerHTML = "0";
miniEl.innerHTML = "0";
textEl?.setHtml("0");
miniEl?.setHtml("0");
});
}

export async function update(burst: number): Promise<void> {
requestDebouncedAnimationFrame("live-burst.update", () => {
const burstText = Format.typingSpeed(burst, { showDecimalPlaces: false });
miniEl.innerHTML = burstText;
textEl.innerHTML = burstText;
miniEl?.setHtml(burstText);
textEl?.setHtml(burstText);
});
}

Expand All @@ -34,14 +32,14 @@ export function show(): void {
if (state) return;
requestDebouncedAnimationFrame("live-burst.show", () => {
if (Config.liveBurstStyle === "mini") {
miniEl.classList.remove("hidden");
animate(miniEl, {
miniEl?.show();
miniEl?.animate({
opacity: [0, 1],
duration: applyReducedMotion(125),
});
} else {
textEl.classList.remove("hidden");
animate(textEl, {
textEl?.show();
textEl?.animate({
opacity: [0, 1],
duration: applyReducedMotion(125),
});
Expand All @@ -53,18 +51,18 @@ export function show(): void {
export function hide(): void {
if (!state) return;
requestDebouncedAnimationFrame("live-burst.hide", () => {
animate(textEl, {
textEl?.animate({
opacity: [1, 0],
duration: applyReducedMotion(125),
onComplete: () => {
textEl.classList.add("hidden");
textEl?.hide();
},
});
animate(miniEl, {
miniEl?.animate({
opacity: [1, 0],
duration: applyReducedMotion(125),
onComplete: () => {
miniEl.classList.add("hidden");
miniEl?.hide();
},
});
state = false;
Expand All @@ -74,10 +72,10 @@ export function hide(): void {
export function instantHide(): void {
if (!state) return;

textEl.classList.add("hidden");
textEl.style.opacity = "0";
miniEl.classList.add("hidden");
miniEl.style.opacity = "0";
textEl?.hide();
textEl?.setStyle({ opacity: "0" });
miniEl?.hide();
miniEl?.setStyle({ opacity: "0" });

state = false;
}
Expand Down
Loading