timetable: alert hold during a minute

This commit is contained in:
Lopinosaurus 2026-03-12 13:59:40 +01:00
parent 62a2597a84
commit a68734afda
2 changed files with 5 additions and 4 deletions

View File

@ -70,10 +70,11 @@ const softAlarmAudio = new Audio('/soft_alarm.mp3');
const newsAudio = new Audio('/news.mp3');
let notifTimer = null;
function showNotif(message, audio = softAlarmAudio) {
function showNotif(message, audio = softAlarmAudio, duration = 10_000) {
notifMessage.textContent = message;
// Re-déclencher l'animation de la barre
notifBarInner.style.setProperty('--notif-duration', `${duration / 1000}s`);
notifBarInner.style.animation = 'none';
void notifBarInner.offsetWidth;
notifBarInner.style.animation = '';
@ -93,7 +94,7 @@ function showNotif(message, audio = softAlarmAudio) {
notifTimer = setTimeout(() => {
notifOverlay.classList.add('hidden');
notifTimer = null;
}, 10_000);
}, duration);
}
// ── Alarm sound ───────────────────────────────────────────────────────────────
@ -354,7 +355,7 @@ function checkUpcomingCourses() {
if (diffMin > 0 && diffMin <= 5 && !notifiedCourses.has(event.start)) {
notifiedCourses.add(event.start);
const loc = event.location ? `${event.location}` : '';
showNotif(`COURS DANS ${Math.ceil(diffMin)} MIN : ${event.title}${loc}`, null);
showNotif(`COURS DANS ${Math.ceil(diffMin)} MIN : ${event.title}${loc}`, null, 60_000);
}
});
}

View File

@ -404,7 +404,7 @@ main.grid {
background: #fff;
width: 100%;
transform-origin: left;
animation: notif-countdown 10s linear forwards;
animation: notif-countdown var(--notif-duration, 10s) linear forwards;
}
@keyframes notif-countdown {