Compare commits
No commits in common. "d18f00d1c0880b8c74a6393c8253a7f1a166da28" and "1d1cfa0af2a81a4f45bc36925e078043191d56d0" have entirely different histories.
d18f00d1c0
...
1d1cfa0af2
4 changed files with 13 additions and 49 deletions
18
app.vue
18
app.vue
|
@ -8,7 +8,6 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import ContextMenu from '~/components/ContextMenu.vue';
|
import ContextMenu from '~/components/ContextMenu.vue';
|
||||||
import { render } from 'vue';
|
import { render } from 'vue';
|
||||||
import settingLoad from './utils/settingLoad';
|
|
||||||
|
|
||||||
const banner = useState("banner", () => false);
|
const banner = useState("banner", () => false);
|
||||||
|
|
||||||
|
@ -44,14 +43,21 @@ function contextMenuHandler(e: MouseEvent) {
|
||||||
//]);
|
//]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentTheme = settingLoad("selectedThemeId") ?? "dark"
|
let currentTheme = "dark" // default theme
|
||||||
|
const savedTheme = localStorage.getItem("selectedTheme");
|
||||||
|
if (savedTheme) {
|
||||||
|
currentTheme = savedTheme;
|
||||||
|
}
|
||||||
|
|
||||||
const baseURL = useRuntimeConfig().app.baseURL;
|
const baseURL = useRuntimeConfig().app.baseURL;
|
||||||
|
|
||||||
useHead({
|
useHead({
|
||||||
link: [{
|
link: [
|
||||||
rel: "stylesheet",
|
{
|
||||||
href: `${baseURL}themes/${currentTheme}.css`
|
rel: "stylesheet",
|
||||||
}]
|
href: `${baseURL}themes/${currentTheme}.css`
|
||||||
|
}
|
||||||
|
]
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,6 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import settingSave from '~/utils/settingSave';
|
|
||||||
|
|
||||||
const runtimeConfig = useRuntimeConfig()
|
const runtimeConfig = useRuntimeConfig()
|
||||||
const defaultThemes = runtimeConfig.public.defaultThemes
|
const defaultThemes = runtimeConfig.public.defaultThemes
|
||||||
const baseURL = runtimeConfig.app.baseURL;
|
const baseURL = runtimeConfig.app.baseURL;
|
||||||
|
@ -48,7 +46,7 @@ function changeTheme(id: string, url: string) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
settingSave("selectedThemeId", id)
|
localStorage.setItem("selectedTheme", id);
|
||||||
|
|
||||||
// if the theme didn't originally load for some reason, create it
|
// if the theme didn't originally load for some reason, create it
|
||||||
if (!themeLinkElement) {
|
if (!themeLinkElement) {
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
export default (key: string): any => {
|
|
||||||
let clientSettingsItem: string | null = localStorage.getItem("clientSettings")
|
|
||||||
if (typeof clientSettingsItem != "string") {
|
|
||||||
clientSettingsItem = "{}"
|
|
||||||
}
|
|
||||||
|
|
||||||
let clientSettings: { [key: string]: any } = {}
|
|
||||||
try {
|
|
||||||
clientSettings = JSON.parse(clientSettingsItem)
|
|
||||||
} catch {
|
|
||||||
clientSettings = {}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof clientSettings !== "object") {
|
|
||||||
clientSettings = {}
|
|
||||||
}
|
|
||||||
|
|
||||||
return clientSettings[key]
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
export default (key: string, value: any): void => {
|
|
||||||
let clientSettingsItem: string | null = localStorage.getItem("clientSettings")
|
|
||||||
if (typeof clientSettingsItem != "string") {
|
|
||||||
clientSettingsItem = "{}"
|
|
||||||
}
|
|
||||||
|
|
||||||
let clientSettings: { [key: string]: any } = {}
|
|
||||||
try {
|
|
||||||
clientSettings = JSON.parse(clientSettingsItem)
|
|
||||||
} catch {
|
|
||||||
clientSettings = {}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof clientSettings !== "object") {
|
|
||||||
clientSettings = {}
|
|
||||||
}
|
|
||||||
|
|
||||||
clientSettings[key] = value
|
|
||||||
|
|
||||||
localStorage.setItem("clientSettings", JSON.stringify(clientSettings))
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue