Update HTML files to use Bunny.net CDN for static assets
- Updated all static asset URLs to use iceymi.b-cdn.net CDN - Changed favicon, CSS, and JS file references in index.html, admin.html, and privacy.html - API calls remain pointed to origin server for dynamic content - Ready for CDN deployment with proper cache separation
This commit is contained in:
parent
f73221e5cc
commit
d9559f71fe
15 changed files with 770 additions and 116 deletions
|
@ -584,4 +584,78 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||
clearInterval(updateInterval);
|
||||
}
|
||||
});
|
||||
|
||||
// Initialize theme toggle
|
||||
initializeTheme();
|
||||
});
|
||||
|
||||
// Theme toggle functionality
|
||||
function initializeTheme() {
|
||||
const themeToggle = document.getElementById('theme-toggle');
|
||||
const themeIcon = document.querySelector('.theme-icon');
|
||||
|
||||
if (!themeToggle || !themeIcon) {
|
||||
console.warn('Theme toggle elements not found');
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for saved theme preference or default to auto (follows system)
|
||||
const savedTheme = localStorage.getItem('theme') || 'auto';
|
||||
applyTheme(savedTheme);
|
||||
|
||||
// Update icon based on current theme
|
||||
updateThemeIcon(savedTheme, themeIcon);
|
||||
|
||||
// Add click listener for cycling through themes
|
||||
themeToggle.addEventListener('click', () => {
|
||||
const currentTheme = localStorage.getItem('theme') || 'auto';
|
||||
let newTheme;
|
||||
|
||||
// Cycle: auto → light → dark → auto
|
||||
switch(currentTheme) {
|
||||
case 'auto':
|
||||
newTheme = 'light';
|
||||
break;
|
||||
case 'light':
|
||||
newTheme = 'dark';
|
||||
break;
|
||||
case 'dark':
|
||||
newTheme = 'auto';
|
||||
break;
|
||||
default:
|
||||
newTheme = 'auto';
|
||||
}
|
||||
|
||||
localStorage.setItem('theme', newTheme);
|
||||
applyTheme(newTheme);
|
||||
updateThemeIcon(newTheme, themeIcon);
|
||||
|
||||
console.log(`Theme switched to: ${newTheme}`);
|
||||
});
|
||||
|
||||
// Listen for system theme changes when in auto mode
|
||||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
|
||||
const currentTheme = localStorage.getItem('theme') || 'auto';
|
||||
if (currentTheme === 'auto') {
|
||||
applyTheme('auto');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function applyTheme(theme) {
|
||||
document.documentElement.setAttribute('data-theme', theme);
|
||||
}
|
||||
|
||||
function updateThemeIcon(theme, iconElement) {
|
||||
switch(theme) {
|
||||
case 'auto':
|
||||
iconElement.textContent = '🌍'; // Globe (auto)
|
||||
break;
|
||||
case 'light':
|
||||
iconElement.textContent = '☀️'; // Sun (light)
|
||||
break;
|
||||
case 'dark':
|
||||
iconElement.textContent = '🌙'; // Moon (dark)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue