mirror of
https://github.com/ankitects/anki.git
synced 2025-11-06 20:57:13 -05:00
Fix: missing nightmode
This commit is contained in:
parent
b0a8c341a1
commit
91a968596c
1 changed files with 8 additions and 6 deletions
|
|
@ -4,6 +4,8 @@ import "../base.scss";
|
||||||
import "../../reviewer/reviewer.scss";
|
import "../../reviewer/reviewer.scss";
|
||||||
import { enableNightMode } from "../reviewer/reviewer";
|
import { enableNightMode } from "../reviewer/reviewer";
|
||||||
|
|
||||||
|
const urlParams = new URLSearchParams(location.search);
|
||||||
|
|
||||||
const style = document.createElement("style");
|
const style = document.createElement("style");
|
||||||
document.head.appendChild(style);
|
document.head.appendChild(style);
|
||||||
|
|
||||||
|
|
@ -16,6 +18,12 @@ addEventListener("message", (e) => {
|
||||||
}
|
}
|
||||||
if (e.data.bodyclass) {
|
if (e.data.bodyclass) {
|
||||||
document.body.className = 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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -34,9 +42,3 @@ function pycmd(cmd: string) {
|
||||||
window.parent.postMessage({ type: "pycmd", value: cmd }, "*");
|
window.parent.postMessage({ type: "pycmd", value: cmd }, "*");
|
||||||
}
|
}
|
||||||
globalThis.pycmd = pycmd;
|
globalThis.pycmd = pycmd;
|
||||||
|
|
||||||
const params = new URLSearchParams(location.search);
|
|
||||||
const theme = params.get("nightMode");
|
|
||||||
if (theme !== null) {
|
|
||||||
enableNightMode();
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue