modified: app.py

modified:   templates/itemeditor_command_storage.html
This commit is contained in:
SimolZimol
2026-01-07 04:15:55 +01:00
parent e90d28cc10
commit 26a7169515
2 changed files with 19 additions and 14 deletions

View File

@@ -547,25 +547,30 @@ function startCountdown(expiresAt) {
const expiryTime = document.getElementById('expiryTime');
const endTime = new Date(expiresAt).getTime();
// If expiry is in the past, show expired immediately
if (endTime < new Date().getTime()) {
expiryTime.innerHTML = '<span style="color: #ff5555;">Expired</span>';
return;
}
const interval = setInterval(() => {
// Update countdown immediately
function updateCountdown() {
const now = new Date().getTime();
const distance = endTime - now;
if (distance < 0) {
clearInterval(interval);
expiryTime.innerHTML = '<span style="color: #ff5555;">Expired</span>';
return;
return false;
}
const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((distance % (1000 * 60)) / 1000);
expiryTime.textContent = `${minutes}m ${seconds}s`;
return true;
}
// Update immediately
if (!updateCountdown()) return;
// Then update every second
const interval = setInterval(() => {
if (!updateCountdown()) {
clearInterval(interval);
}
}, 1000);
}
</script>