diff --git a/public/app.js b/public/app.js index 17b856f..33ce69f 100644 --- a/public/app.js +++ b/public/app.js @@ -67,7 +67,6 @@ const notifOverlay = document.getElementById('notif-overlay'); const notifMessage = document.getElementById('notif-message'); const notifBarInner = document.getElementById('notif-bar-inner'); const softAlarmAudio = new Audio('/soft_alarm.mp3'); -const newsAudio = new Audio('/news.mp3'); let notifTimer = null; function showNotif(message, audio = softAlarmAudio, duration = 10_000) { @@ -97,6 +96,28 @@ function showNotif(message, audio = softAlarmAudio, duration = 10_000) { }, duration); } +// ── Geo news bottom banner ──────────────────────────────────────────────────── + +const geoBanner = document.getElementById('geo-banner'); +const geoBannerLink = document.getElementById('geo-banner-link'); +let geoBannerTimer = null; + +function showGeoBanner(title, link, duration = 15_000) { + geoBannerLink.textContent = title; + geoBannerLink.href = link || '#'; + + geoBanner.style.animation = 'none'; + void geoBanner.offsetWidth; + geoBanner.style.animation = ''; + geoBanner.classList.remove('hidden'); + + if (geoBannerTimer) clearTimeout(geoBannerTimer); + geoBannerTimer = setTimeout(() => { + geoBanner.classList.add('hidden'); + geoBannerTimer = null; + }, duration); +} + // ── Alarm sound ─────────────────────────────────────────────────────────────── const alarmAudio = new Audio('/alert.mp3'); @@ -261,7 +282,7 @@ async function loadGeo() { } else { const newGeoItems = items.filter(i => !seenGeoLinks.has(i.link)); if (newGeoItems.length) { - showNotif(`Nouvelle actualité géopolitique : ${newGeoItems[0].title}`, newsAudio); + showGeoBanner(newGeoItems[0].title, newGeoItems[0].link); seenGeoLinks = currentLinks; } } diff --git a/public/index.html b/public/index.html index 697b704..4896100 100644 --- a/public/index.html +++ b/public/index.html @@ -135,6 +135,12 @@ + +
+