summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-09-10 17:02:07 +0800
committerEltrac <hi@guhub.cn>2025-09-10 17:02:07 +0800
commit7cc957689b3942577a96f59cfe788b8b5e050d8a (patch)
tree4a352e92270a56c0e3a645ecd312437985485402
parente401f734b7b5c303519e41ac1f3e0fb92353f879 (diff)
refactor: uniforms local storage keys
-rw-r--r--assets/js/settings.js6
-rw-r--r--layouts/_partials/components/back-to-top.html4
2 files changed, 5 insertions, 5 deletions
diff --git a/assets/js/settings.js b/assets/js/settings.js
index 20c38955..053786d6 100644
--- a/assets/js/settings.js
+++ b/assets/js/settings.js
@@ -6,8 +6,8 @@
*/
const setFontSize = (size) => {
- if (size) localStorage.setItem('fontSize', size);
- const fontSizeSelected = size || localStorage.getItem('fontSize') || 'medium';
+ if (size) localStorage.setItem('geedeapro.ui.fontSize', size);
+ const fontSizeSelected = size || localStorage.getItem('geedeapro.ui.fontSize') || 'medium';
const markdownBodies = document.querySelectorAll('.markdown-body');
@@ -43,7 +43,7 @@
const textAlterButtons = document.querySelectorAll('#text-alter-buttons button');
textAlterButtons.forEach(button => {
// highlight selected button
- if (button.dataset.textSize === localStorage.getItem('fontSize')) {
+ if (button.dataset.textSize === localStorage.getItem('geedeapro.ui.fontSize')) {
button.classList.add('bg-neutral-200/50');
}
diff --git a/layouts/_partials/components/back-to-top.html b/layouts/_partials/components/back-to-top.html
index 7e6786d8..ea990f93 100644
--- a/layouts/_partials/components/back-to-top.html
+++ b/layouts/_partials/components/back-to-top.html
@@ -22,7 +22,7 @@ if (localStorage.getItem('geedeapro.ui.hideBatrick') === 'true') {
const backToTop = document.getElementById("back2top")
const backToTopButton = document.getElementById("back2top-button")
const backToTopInstruction = document.getElementById("back2top-instruction")
- const seenAndUsedBat = localStorage.getItem("seenAndUsedBat")
+ const seenAndUsedBat = localStorage.getItem("geedeapro.ui.seenAndUsedBat")
function hideInstruction() {
backToTopInstruction.remove()
@@ -33,7 +33,7 @@ if (localStorage.getItem('geedeapro.ui.hideBatrick') === 'true') {
backToTopButton.addEventListener("click", () => {
window.scrollTo({ top: 0, behavior: "smooth" })
if (!seenAndUsedBat) {
- localStorage.setItem("seenAndUsedBat", true);
+ localStorage.setItem("geedeapro.ui.seenAndUsedBat", true);
hideInstruction();
}
})