The first Qodana run found 74 problems in TypeScript / JavaScript and 12 in Rust. Fixed: - React 19.3 deprecates `FormEvent`: the three save forms take the `SubmitEvent` their `onSubmit` hands them. - The URL patterns read `\S` instead of `[^\s]` (18 patterns in platforms.ts and playtest-platforms.ts, same characters). - public/theme-init.js declares its browser globals and drops an unused catch binding. - The two private `stable()` JSON helpers (restore.ts, library-apply.ts) become one `stableJson()` in src/utils/stable-json.ts, with a test. - vitest.config.ts reuses vite.config.ts's alias map instead of a copy. - Accordion destructures `icon` as `Icon` instead of copying it, a JSDoc link points at nothing any more, and i18next's `init()` promise is `void`ed on purpose. - Rust: the three "show the main window" blocks become `show_main_window`. Excluded in qodana.yaml, each with its reason: the Discord webhook secret reference (HardcodedPasswords), escaped `]` / `}` in regexes, the `@i18n/index` imports tsconfig needs, the three react-hooks warnings eslint.config.js documents, the legacy `@deprecated` draft fields in the files that migrate them; in src-tauri/qodana.yaml the module paths `generate_handler!` needs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 lines
1.1 KiB
JavaScript
28 lines
1.1 KiB
JavaScript
// Applies the saved theme, scrollbar preference and UI language before the
|
|
// first paint, so a light-theme user never sees the dark default flash. A
|
|
// separate file rather than an inline <script> so the Content-Security-Policy
|
|
// needs no exception.
|
|
/* global document, localStorage */
|
|
(function () {
|
|
var root = document.documentElement;
|
|
var theme = "dark";
|
|
var hideScrollbars = false;
|
|
var lang = null;
|
|
try {
|
|
var raw = localStorage.getItem("ytdescgen-settings");
|
|
var state = raw ? JSON.parse(raw).state : null;
|
|
if (state && state.theme === "light") theme = "light";
|
|
// Unhealed raw storage, so only a real `true` counts.
|
|
if (state && state.hideScrollbars === true) hideScrollbars = true;
|
|
if (state && typeof state.appLanguage === "string") lang = state.appLanguage;
|
|
} catch {
|
|
/* storage blocked or corrupt: keep the defaults */
|
|
}
|
|
root.classList.toggle("dark", theme === "dark");
|
|
root.classList.toggle("light", theme === "light");
|
|
root.style.colorScheme = theme;
|
|
// Same class as src/utils/scrollbars.ts.
|
|
root.classList.toggle("hide-scrollbars", hideScrollbars);
|
|
if (lang) root.lang = lang;
|
|
})();
|