diff --git a/public/app.js b/public/app.js index 70db9c1..17b856f 100644 --- a/public/app.js +++ b/public/app.js @@ -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); } }); } diff --git a/public/style.css b/public/style.css index 2e3064c..ded2178 100644 --- a/public/style.css +++ b/public/style.css @@ -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 {