From dc14b5193fbcae912ced02eb0fe269e523cbe980 Mon Sep 17 00:00:00 2001 From: Mow910 Date: Wed, 4 Mar 2026 22:40:38 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20d'une=20fonctionnalit=C3=A9=20de=20noti?= =?UTF-8?q?fication=20sonore=20dans=20la=20shoutbox=20pour=20les=20mod?= =?UTF-8?q?=C3=A9rateurs=20Twitch.=20Impl=C3=A9mentation=20d'un=20syst?= =?UTF-8?q?=C3=A8me=20de=20d=C3=A9tection=20de=20visibilit=C3=A9=20de=20l'?= =?UTF-8?q?onglet=20et=20d'un=20son=20de=20notification=20lorsque=20l'ongl?= =?UTF-8?q?et=20n'est=20pas=20actif.=20Cela=20am=C3=A9liore=20l'exp=C3=A9r?= =?UTF-8?q?ience=20utilisateur=20en=20alertant=20les=20mod=C3=A9rateurs=20?= =?UTF-8?q?des=20nouveaux=20messages=20m=C3=AAme=20lorsqu'ils=20ne=20regar?= =?UTF-8?q?dent=20pas=20la=20shoutbox.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webapp/templates/twitch-moderation.html | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/webapp/templates/twitch-moderation.html b/webapp/templates/twitch-moderation.html index 956245c..fb487fb 100644 --- a/webapp/templates/twitch-moderation.html +++ b/webapp/templates/twitch-moderation.html @@ -889,6 +889,28 @@ document.addEventListener('keydown', function(e) { var shoutboxKnownIds = new Set(); var shoutboxLastTimestamp = ''; var shoutboxAutoScroll = true; +var shoutboxTabVisible = true; +var shoutboxAudioCtx = null; + +document.addEventListener('visibilitychange', function() { + shoutboxTabVisible = !document.hidden; +}); + +function shoutboxBeep() { + try { + if (!shoutboxAudioCtx) shoutboxAudioCtx = new (window.AudioContext || window.webkitAudioContext)(); + var osc = shoutboxAudioCtx.createOscillator(); + var gain = shoutboxAudioCtx.createGain(); + osc.connect(gain); + gain.connect(shoutboxAudioCtx.destination); + osc.frequency.value = 660; + osc.type = 'sine'; + gain.gain.setValueAtTime(0.15, shoutboxAudioCtx.currentTime); + gain.gain.exponentialRampToValueAtTime(0.001, shoutboxAudioCtx.currentTime + 0.3); + osc.start(shoutboxAudioCtx.currentTime); + osc.stop(shoutboxAudioCtx.currentTime + 0.3); + } catch(e) {} +} var SHOUTBOX_COLORS = [ '#6366f1', '#8b5cf6', '#ec4899', '#14b8a6', '#f59e0b', @@ -946,6 +968,8 @@ function addShoutboxItem(item) { display.appendChild(line); + if (!shoutboxTabVisible) shoutboxBeep(); + while (display.children.length > 200) display.removeChild(display.firstChild); if (shoutboxAutoScroll) display.scrollTop = display.scrollHeight; }