diff --git a/index.php b/index.php index bf73d7c..4aa8440 100644 --- a/index.php +++ b/index.php @@ -1822,9 +1822,14 @@ $twitter_link = "https://twitter.com/";
-

- CHAT EN VIVO -

+
+

+ CHAT EN VIVO +

+ +
MENSAJE FIJADO
@@ -2502,6 +2507,31 @@ $twitter_link = "https://twitter.com/"; const chatMsg = document.getElementById('chat-msg'); const emojiPicker = document.getElementById('emoji-picker'); let lastMessageCount = 0; + let chatSoundMuted = localStorage.getItem('chatSoundMuted') === 'true'; + + function updateMuteButton() { + const btn = document.getElementById('mute-chat-btn'); + if (!btn) return; + const icon = btn.querySelector('i'); + if (chatSoundMuted) { + icon.classList.remove('bi-volume-up-fill'); + icon.classList.add('bi-volume-mute-fill'); + btn.style.color = '#ff4444'; + } else { + icon.classList.remove('bi-volume-mute-fill'); + icon.classList.add('bi-volume-up-fill'); + btn.style.color = 'white'; + } + } + + function toggleChatSound() { + chatSoundMuted = !chatSoundMuted; + localStorage.setItem('chatSoundMuted', chatSoundMuted); + updateMuteButton(); + } + + // Initialize button state + setTimeout(updateMuteButton, 500); function toggleEmojiPicker() { emojiPicker.style.display = emojiPicker.style.display === 'none' ? 'block' : 'none'; @@ -2554,10 +2584,11 @@ $twitter_link = "https://twitter.com/"; if (messages.length === lastMessageCount) return; // Play pop sound for new messages (not on initial load) - if (messages.length > lastMessageCount && lastMessageCount > 0) { + if (!chatSoundMuted && messages.length > lastMessageCount && lastMessageCount > 0) { const popSound = document.getElementById('pop-sound'); if (popSound) { popSound.currentTime = 0; + popSound.volume = 0.4; // Soft volume popSound.play().catch(e => console.log('Pop sound blocked:', e)); } }