anki/ts/lib/nightmode.ts
Damien Elmes 15dcb09036
Detect incorrect usage of triple slash in TypeScript (#2524)
* Migrate check_copyright to Rust

* Add a new lint to check accidental usages of /// in ts/svelte comments

* Fix a bunch of incorrect jdoc comments

* Move contributor check into minilints

Will allow users to detect the issue locally with './ninja check'
before pushing to CI.

* Make Cargo.toml consistent with other crates
2023-05-26 12:49:44 +10:00

13 lines
445 B
TypeScript

// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
/** Add night-mode class to documentElement if hash location is #night, and
return true if added. */
export function checkNightMode(): boolean {
const nightMode = window.location.hash == "#night";
if (nightMode) {
document.documentElement.className = "night-mode";
}
return nightMode;
}