diff --git a/client/js/main.js b/client/js/main.js index dcaa942..8c3dde2 100644 --- a/client/js/main.js +++ b/client/js/main.js @@ -65,7 +65,7 @@ import { // Set global configuration parameters window.config = { wsAddress: 'wss://crypt.works/ws', // WebSocket 服务器地址 / WebSocket server address - debug: false // 是否开启调试模式 / Enable debug mode + debug: true // 是否开启调试模式 / Enable debug mode }; // 把一些函数挂载到 window 对象上供其他模块使用 @@ -78,8 +78,6 @@ window.setupEmojiPicker = setupEmojiPicker; // 当 DOM 内容加载完成后执行初始化逻辑 // Run initialization logic when the DOM content is fully loaded window.addEventListener('DOMContentLoaded', () => { - const loginContainer = $id('login-container'); // 登录容器 / Login container - const chatContainer = $id('chat-container'); // 聊天容器 / Chat container const loginForm = $id('login-form'); // 登录表单 / Login form if (loginForm) { diff --git a/client/js/util.settings.js b/client/js/util.settings.js index 81a76f7..6dcbc6f 100644 --- a/client/js/util.settings.js +++ b/client/js/util.settings.js @@ -92,9 +92,13 @@ function setupSettingsPanel() { if (soundCheckbox) soundCheckbox.checked = false; saveSettings(settings); applySettings(settings); - new Notification('Notifications enabled', { - body: 'You will receive alerts here.' - }) + // 防止重复通知,添加一个标志位 + if (!panel._notificationShown) { + new Notification('Notifications enabled', { + body: 'You will receive alerts here.' + }); + panel._notificationShown = true; // 设置标志位 + } } else { settings.notify = false; e.target.checked = false; @@ -106,7 +110,11 @@ function setupSettingsPanel() { } else { settings.notify = false; saveSettings(settings); - applySettings(settings) + applySettings(settings); + // 重置标志位 + if (panel._notificationShown) { + panel._notificationShown = false; + } } }); on(soundCheckbox, 'change', e => {