From 91a968596c6e40a129693249389ab54a49e39e5d Mon Sep 17 00:00:00 2001 From: Luc Mcgrady Date: Tue, 21 Oct 2025 15:52:49 +0100 Subject: [PATCH] Fix: missing nightmode --- ts/routes/reviewer-inner/index.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ts/routes/reviewer-inner/index.ts b/ts/routes/reviewer-inner/index.ts index 8fedc8fbf..df2e2d5a8 100644 --- a/ts/routes/reviewer-inner/index.ts +++ b/ts/routes/reviewer-inner/index.ts @@ -4,6 +4,8 @@ import "../base.scss"; import "../../reviewer/reviewer.scss"; import { enableNightMode } from "../reviewer/reviewer"; +const urlParams = new URLSearchParams(location.search); + const style = document.createElement("style"); document.head.appendChild(style); @@ -16,6 +18,12 @@ addEventListener("message", (e) => { } if (e.data.bodyclass) { document.body.className = e.data.bodyclass; + const theme = urlParams.get("nightMode"); + if (theme !== null) { + enableNightMode(); + document.body.classList.add("night_mode"); + document.body.classList.add("nightMode"); + } } break; } @@ -34,9 +42,3 @@ function pycmd(cmd: string) { window.parent.postMessage({ type: "pycmd", value: cmd }, "*"); } globalThis.pycmd = pycmd; - -const params = new URLSearchParams(location.search); -const theme = params.get("nightMode"); -if (theme !== null) { - enableNightMode(); -}