chore: remove unnecessary event; storage changes
This commit is contained in:
parent
e3421cef1e
commit
a0a593ee10
8 changed files with 25 additions and 67 deletions
|
@ -1,5 +1,5 @@
|
|||
<script type="module" src="/assets/scripts/components/api-text.js?v={% appVersion %}" crossorigin="anonymous"></script>
|
||||
<api-text api-url="/api/now-playing" display="inline">
|
||||
<api-text api-url="/api/now-playing" display="inline" storage="local">
|
||||
<span class="loading client-side">{{ nowPlaying }}</span>
|
||||
<span class="content"></span>
|
||||
<noscript>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script type="module" src="/assets/scripts/components/theme-toggle.js?v={% appVersion %}"
|
||||
crossorigin="anonymous"></script>
|
||||
<span class="client-side">
|
||||
<theme-toggle mode="control">
|
||||
<theme-toggle mode="control" storage="local">
|
||||
<button aria-label="Auto, light, dark theme control" class="theme-toggle">
|
||||
<span class="auto">
|
||||
<svg aria-hidden="true" data-tablericon-name="sun-moon" fill="none" height="24" stroke="currentColor"
|
||||
|
|
|
@ -49,7 +49,11 @@
|
|||
<body>
|
||||
<script>
|
||||
(() => {
|
||||
const currentTheme = sessionStorage.getItem("theme") || "auto";
|
||||
const storageType =
|
||||
document.querySelector("theme-toggle")?.getAttribute("storage") === "local"
|
||||
? localStorage
|
||||
: sessionStorage;
|
||||
const currentTheme = storageType.getItem("theme") || "auto";
|
||||
const metaColorScheme = document.querySelector('meta[name="color-scheme"]');
|
||||
if (currentTheme === "auto") {
|
||||
metaColorScheme.setAttribute("content", "light dark");
|
||||
|
|
|
@ -4,7 +4,7 @@ pagination:
|
|||
size: 1
|
||||
alias: page
|
||||
description: "{{ page.description }}"
|
||||
permalink: "{{ page.permalink }}/index.html"
|
||||
permalink: "{{ page.permalink }}.html"
|
||||
image: "{{ page.open_graph_image | prepend: globals.cdn_url | default: globals.avatar }}"
|
||||
updated: "{{ page.updated | default: null }}"
|
||||
schema: page
|
||||
|
|
Reference in a new issue