chore: remove unnecessary event; storage changes

This commit is contained in:
Cory Dransfeldt 2024-10-27 19:37:42 -07:00
parent e3421cef1e
commit a0a593ee10
No known key found for this signature in database
8 changed files with 25 additions and 67 deletions

View file

@ -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>

View file

@ -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"

View file

@ -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");

View file

@ -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