timetable: alert hold during a minute
This commit is contained in:
parent
62a2597a84
commit
a68734afda
|
|
@ -70,10 +70,11 @@ const softAlarmAudio = new Audio('/soft_alarm.mp3');
|
||||||
const newsAudio = new Audio('/news.mp3');
|
const newsAudio = new Audio('/news.mp3');
|
||||||
let notifTimer = null;
|
let notifTimer = null;
|
||||||
|
|
||||||
function showNotif(message, audio = softAlarmAudio) {
|
function showNotif(message, audio = softAlarmAudio, duration = 10_000) {
|
||||||
notifMessage.textContent = message;
|
notifMessage.textContent = message;
|
||||||
|
|
||||||
// Re-déclencher l'animation de la barre
|
// Re-déclencher l'animation de la barre
|
||||||
|
notifBarInner.style.setProperty('--notif-duration', `${duration / 1000}s`);
|
||||||
notifBarInner.style.animation = 'none';
|
notifBarInner.style.animation = 'none';
|
||||||
void notifBarInner.offsetWidth;
|
void notifBarInner.offsetWidth;
|
||||||
notifBarInner.style.animation = '';
|
notifBarInner.style.animation = '';
|
||||||
|
|
@ -93,7 +94,7 @@ function showNotif(message, audio = softAlarmAudio) {
|
||||||
notifTimer = setTimeout(() => {
|
notifTimer = setTimeout(() => {
|
||||||
notifOverlay.classList.add('hidden');
|
notifOverlay.classList.add('hidden');
|
||||||
notifTimer = null;
|
notifTimer = null;
|
||||||
}, 10_000);
|
}, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Alarm sound ───────────────────────────────────────────────────────────────
|
// ── Alarm sound ───────────────────────────────────────────────────────────────
|
||||||
|
|
@ -354,7 +355,7 @@ function checkUpcomingCourses() {
|
||||||
if (diffMin > 0 && diffMin <= 5 && !notifiedCourses.has(event.start)) {
|
if (diffMin > 0 && diffMin <= 5 && !notifiedCourses.has(event.start)) {
|
||||||
notifiedCourses.add(event.start);
|
notifiedCourses.add(event.start);
|
||||||
const loc = event.location ? ` — ${event.location}` : '';
|
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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -404,7 +404,7 @@ main.grid {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
transform-origin: left;
|
transform-origin: left;
|
||||||
animation: notif-countdown 10s linear forwards;
|
animation: notif-countdown var(--notif-duration, 10s) linear forwards;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes notif-countdown {
|
@keyframes notif-countdown {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue