This commit is contained in:
2025-10-21 22:29:44 +02:00
parent 04891bf449
commit a26c92ff2b
4 changed files with 27 additions and 11 deletions

View File

@@ -13,8 +13,19 @@ document.addEventListener('DOMContentLoaded', () => {
setupEventListeners();
setDefaultDate();
handleRouting();
checkAdminMode();
});
// Admin mode
function checkAdminMode() {
const urlParams = new URLSearchParams(window.location.search);
if (urlParams.get('admin') === 'true') {
document.querySelectorAll('.import-section').forEach(el => {
el.style.display = 'block';
});
}
}
// Routing
function handleRouting() {
// Handle initial load and hash changes
@@ -63,15 +74,17 @@ function initializeTabs() {
});
}
// Set default date to today
// Set default date to yesterday (since we enter steps the day after)
function setDefaultDate() {
const today = new Date().toISOString().split('T')[0];
const yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
const yesterdayStr = yesterday.toISOString().split('T')[0];
const dateInput = document.getElementById('step-date');
dateInput.value = today;
dateInput.value = yesterdayStr;
// Set max date to October 31, 2025
dateInput.max = '2025-10-31';
dateInput.min = '2025-10-15';
dateInput.min = '2025-10-20';
}
// Load initial data
@@ -832,6 +845,7 @@ async function importMonsters() {
}
const overwrite = overwriteCheckbox.checked;
console.log('Overwrite checkbox checked:', overwrite);
// Confirm if overwrite is selected
if (overwrite) {