迁移聊天室禁音入口

This commit is contained in:
2026-04-25 19:36:37 +08:00
parent 7fc40eba32
commit 36ac9d090b
3 changed files with 33 additions and 16 deletions
@@ -3169,15 +3169,15 @@
* @param {boolean} muted true = 禁音,false = 开启声音
*/
function toggleSoundMute(muted) {
if (window.ChatRoomTools?.setSoundMuted) {
window.ChatRoomTools.setSoundMuted(muted);
} else {
localStorage.setItem(CHAT_SOUND_MUTED_STORAGE_KEY, muted ? '1' : '0');
}
if (muted && typeof EffectSounds !== 'undefined') {
EffectSounds.stop(); // 立即停止当前音效
if (window.ChatRoomTools?.toggleSoundMute) {
window.ChatRoomTools.toggleSoundMute(muted, () => saveChatPreferences());
return;
}
localStorage.setItem(CHAT_SOUND_MUTED_STORAGE_KEY, muted ? '1' : '0');
if (muted && typeof EffectSounds !== 'undefined') {
EffectSounds.stop();
}
void saveChatPreferences();
}
window.toggleSoundMute = toggleSoundMute;