1
0
mirror of https://github.com/bitwarden/web synced 2026-01-13 14:03:28 +00:00

Apply Prettier (#1347)

This commit is contained in:
Oscar Hinton
2021-12-17 15:57:11 +01:00
committed by GitHub
parent 2b0a9d995e
commit 56477eb39c
414 changed files with 33390 additions and 26857 deletions

View File

@@ -2,24 +2,24 @@
// This is done outside the Angular app to avoid a flash of unthemed content before it loads
// The defaultTheme is also set in the html itself to make sure that some theming is always applied
(function () {
const defaultTheme = 'light'
const htmlEl = document.documentElement;
let theme = defaultTheme;
const defaultTheme = "light";
const htmlEl = document.documentElement;
let theme = defaultTheme;
const stateJson = window.localStorage.getItem('state');
if (stateJson != null) {
const globals = JSON.parse(stateJson).globals;
if (globals != null && globals.theme != null) {
if (globals.theme.indexOf('system') > -1) {
theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
} else if (globals.theme.indexOf('dark') > -1) {
theme = 'dark';
}
}
if (!htmlEl.classList.contains('theme_' + theme)) {
htmlEl.classList.remove('theme_' + defaultTheme);
htmlEl.classList.add('theme_' + theme);
}
const stateJson = window.localStorage.getItem("state");
if (stateJson != null) {
const globals = JSON.parse(stateJson).globals;
if (globals != null && globals.theme != null) {
if (globals.theme.indexOf("system") > -1) {
theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
} else if (globals.theme.indexOf("dark") > -1) {
theme = "dark";
}
}
if (!htmlEl.classList.contains("theme_" + theme)) {
htmlEl.classList.remove("theme_" + defaultTheme);
htmlEl.classList.add("theme_" + theme);
}
}
})();