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
|
@ -108,10 +108,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
|
||||
function updateStats() {
|
||||
const now = new Date();
|
||||
const twentyFourHoursAgo = new Date(now.getTime() - 24 * 60 * 60 * 1000);
|
||||
const fortyEightHoursAgo = new Date(now.getTime() - 48 * 60 * 60 * 1000);
|
||||
|
||||
const activeLocations = allLocations.filter(location =>
|
||||
new Date(location.created_at) > twentyFourHoursAgo
|
||||
new Date(location.created_at) > fortyEightHoursAgo
|
||||
);
|
||||
|
||||
const persistentLocations = allLocations.filter(location => location.persistent);
|
||||
|
@ -129,10 +129,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
}
|
||||
|
||||
const now = new Date();
|
||||
const twentyFourHoursAgo = new Date(now.getTime() - 24 * 60 * 60 * 1000);
|
||||
const fortyEightHoursAgo = new Date(now.getTime() - 48 * 60 * 60 * 1000);
|
||||
|
||||
locationsTableBody.innerHTML = allLocations.map(location => {
|
||||
const isActive = new Date(location.created_at) > twentyFourHoursAgo;
|
||||
const isActive = new Date(location.created_at) > fortyEightHoursAgo;
|
||||
const createdDate = new Date(location.created_at);
|
||||
const formattedDate = createdDate.toLocaleString();
|
||||
|
||||
|
@ -168,8 +168,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
function renderEditRow(location) {
|
||||
const row = document.querySelector(`tr[data-id="${location.id}"]`);
|
||||
const now = new Date();
|
||||
const twentyFourHoursAgo = new Date(now.getTime() - 24 * 60 * 60 * 1000);
|
||||
const isActive = new Date(location.created_at) > twentyFourHoursAgo;
|
||||
const fortyEightHoursAgo = new Date(now.getTime() - 48 * 60 * 60 * 1000);
|
||||
const isActive = new Date(location.created_at) > fortyEightHoursAgo;
|
||||
const createdDate = new Date(location.created_at);
|
||||
const formattedDate = createdDate.toLocaleString();
|
||||
|
||||
|
@ -285,8 +285,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
|
||||
const newPersistentStatus = !location.persistent;
|
||||
const confirmMessage = newPersistentStatus
|
||||
? 'Mark this report as persistent? It will not auto-expire after 24 hours.'
|
||||
: 'Remove persistent status? This report will expire normally after 24 hours.';
|
||||
? 'Mark this report as persistent? It will not auto-expire after 48 hours.'
|
||||
: 'Remove persistent status? This report will expire normally after 48 hours.';
|
||||
|
||||
if (!confirm(confirmMessage)) {
|
||||
return;
|
||||
|
@ -353,4 +353,78 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
|
||||
return reportTime.toLocaleDateString();
|
||||
}
|
||||
|
||||
// Initialize theme toggle
|
||||
initializeTheme();
|
||||
});
|
||||
|
||||
// Theme toggle functionality (shared with main page)
|
||||
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