From 54bfd1430e3458ec41e7287733902202db4c488d Mon Sep 17 00:00:00 2001 From: Lopinosaurus Date: Fri, 13 Mar 2026 15:25:38 +0100 Subject: [PATCH] news: minimize alerts --- public/app.js | 25 +++++++++++++++++++++++-- public/index.html | 6 ++++++ public/style.css | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 2 deletions(-) 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 @@ + + + diff --git a/public/style.css b/public/style.css index ded2178..bc31908 100644 --- a/public/style.css +++ b/public/style.css @@ -480,5 +480,49 @@ main.grid { line-height: 1.6; } +/* ── Geo news bottom banner ──────────────────────────────────────────────── */ +#geo-banner { + position: fixed; + bottom: 0; + left: 0; + right: 0; + z-index: 9997; + background: rgba(0, 60, 15, 0.95); + border-top: 1px solid var(--green-dim); + display: flex; + align-items: center; + gap: 12px; + padding: 6px 16px; + font-size: 13px; + letter-spacing: 1px; + animation: slide-up 0.3s ease-out; +} + +#geo-banner.hidden { display: none !important; } + +@keyframes slide-up { + from { transform: translateY(100%); } + to { transform: translateY(0); } +} + +#geo-banner-label { + color: var(--green); + font-weight: bold; + font-size: 11px; + letter-spacing: 2px; + white-space: nowrap; + flex-shrink: 0; +} + +#geo-banner-link { + color: var(--text); + text-decoration: none; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +#geo-banner-link:hover { text-decoration: underline; } + /* ── Utility ──────────────────────────────────────────────────────────────── */ .hidden { display: none !important; }