mirror of
https://github.com/MathMan05/Fermi.git
synced 2026-07-31 09:29:26 +00:00
setTheme async (prefs storage)
This commit is contained in:
committed by
MathMan05
parent
9e8d0e6cb8
commit
deb731720f
+1
-1
@@ -1,7 +1,7 @@
|
||||
import {I18n} from "./i18n";
|
||||
import {setTheme, SW} from "./utils/utils";
|
||||
|
||||
setTheme();
|
||||
await setTheme();
|
||||
await I18n.done;
|
||||
I18n.translatePage();
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import {BinWrite} from "../utils/binaryUtils.js";
|
||||
import {setTheme} from "../utils/utils.js";
|
||||
import {Play} from "./play.js";
|
||||
|
||||
setTheme();
|
||||
await setTheme();
|
||||
const w = new BinWrite(2 ** 12);
|
||||
w.writeStringNo("jasf");
|
||||
w.write8(4);
|
||||
|
||||
@@ -304,7 +304,7 @@ document.addEventListener("paste", async (e: ClipboardEvent) => {
|
||||
}
|
||||
});
|
||||
|
||||
setTheme();
|
||||
await setTheme();
|
||||
|
||||
function userSettings(): void {
|
||||
thisUser.showusersettings();
|
||||
|
||||
@@ -2246,6 +2246,8 @@ class Localuser {
|
||||
};
|
||||
}
|
||||
async showusersettings() {
|
||||
const prefs = await getPreferences();
|
||||
const localSettings = getLocalSettings();
|
||||
const settings = new Settings(I18n.localuser.settings());
|
||||
{
|
||||
const userOptions = settings.addButton(I18n.localuser.userSettings(), {
|
||||
@@ -2375,13 +2377,13 @@ class Localuser {
|
||||
const themes = ["Dark", "WHITE", "Light", "Dark-Accent"];
|
||||
tas.addSelect(
|
||||
I18n.localuser["theme:"](),
|
||||
(_) => {
|
||||
localStorage.setItem("theme", themes[_]);
|
||||
setTheme();
|
||||
async (_) => {
|
||||
prefs.theme = themes[_] as ThemeOption;
|
||||
await setTheme();
|
||||
},
|
||||
themes,
|
||||
{
|
||||
defaultIndex: themes.indexOf(localStorage.getItem("theme") as string),
|
||||
defaultIndex: themes.indexOf(prefs.theme),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -26,14 +26,10 @@ let instances:
|
||||
};
|
||||
}[]
|
||||
| null = null;
|
||||
setTheme();
|
||||
export function setTheme() {
|
||||
let name = localStorage.getItem("theme");
|
||||
if (!name) {
|
||||
localStorage.setItem("theme", "Dark");
|
||||
name = "Dark";
|
||||
}
|
||||
document.body.className = name + "-theme";
|
||||
await setTheme();
|
||||
export async function setTheme() {
|
||||
const prefs = await getPreferences();
|
||||
document.body.className = prefs.theme + "-theme";
|
||||
}
|
||||
export function getBulkUsers() {
|
||||
const json = getBulkInfo();
|
||||
|
||||
Reference in New Issue
Block a user