add website

This commit is contained in:
lx
2026-08-02 17:55:21 +00:00
commit 5ff67c4066
488 changed files with 106390 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
function applyTheme(theme) {
document.documentElement.setAttribute('data-theme', theme);
document.documentElement.setAttribute('data-bs-theme', theme);
}
function setSiteTheme(theme) {
localStorage.setItem('theme', theme);
applyTheme(theme);
document.querySelectorAll('[data-theme-option]').forEach((btn) => {
btn.classList.toggle('active', btn.getAttribute('data-theme-option') === theme);
});
}
document.addEventListener('DOMContentLoaded', () => {
const currentTheme = localStorage.getItem('theme') || 'dark';
document.querySelectorAll('[data-theme-option]').forEach((btn) => {
btn.classList.toggle('active', btn.getAttribute('data-theme-option') === currentTheme);
btn.addEventListener('click', () => setSiteTheme(btn.getAttribute('data-theme-option')));
});
});