f17f171f4b
迁移收尾修复:
- heartbeat.js: 移除 export { } 中重复的 startHeartbeat/stopHeartbeat(已通过 export function 导出)
- scripts.blade.php: 移除 JS 注释中的 {{ }} 避免 Blade 编译为 e() 导致 PHP 解析错误
- preferences-status.js: 补全 6 个缺失的 window.* 赋值(toggleBlockMenu/toggleFeatureMenu 等),
实现迁移中丢失的 updateDailyStatus/clearDailyStatus,修复 handleFeatureLocalClear 清屏回调
- toolbar.js: 补全 window.runFeatureShortcut 赋值
头像框样式修复(chat-decorations.css):
- z-index 互换:头像降至 1,框升至 3,使框边缘可遮挡头像外围
- 使用 CSS mask(radial-gradient)挖环形替代旧 ::before 实心圆遮挡方案
- clip-path: circle(50%) 硬裁剪确保圆形,不受 chat.css border-radius: 2px 覆盖
- 特异性提升至 .user-item .avatar-frame-wrapper .user-head
新 Vite 模块(从 Blade 迁移):
- chat-state.js / message-renderer.js / user-list.js / chat-events.js
- composer.js(重写)/ heartbeat.js / admin-commands.js
- vip-presence.js / chat-decorations.css
68 lines
2.1 KiB
JavaScript
68 lines
2.1 KiB
JavaScript
// 聊天室欢迎语快捷菜单事件绑定,替代 Blade 内联 onclick。
|
|
|
|
let welcomeMenuEventsBound = false;
|
|
|
|
/**
|
|
* 切换欢迎语下拉浮层的显示/隐藏。
|
|
*/
|
|
function toggleWelcomeMenu(event) {
|
|
event.stopPropagation();
|
|
const menu = document.getElementById("welcome-menu");
|
|
const adminMenu = document.getElementById("admin-menu");
|
|
const blockMenu = document.getElementById("block-menu");
|
|
const featureMenu = document.getElementById("feature-menu");
|
|
const dailyStatusEditor = document.getElementById("daily-status-editor-overlay");
|
|
|
|
if (!menu) return;
|
|
|
|
[adminMenu, blockMenu, featureMenu, dailyStatusEditor].forEach((el) => {
|
|
if (el) el.style.display = "none";
|
|
});
|
|
|
|
menu.style.display = menu.style.display === "none" ? "block" : "none";
|
|
}
|
|
|
|
// 挂载到 window 供 Blade 脚本及其他模块使用。
|
|
window.toggleWelcomeMenu = toggleWelcomeMenu;
|
|
|
|
/**
|
|
* 绑定欢迎语菜单按钮、菜单内点击拦截与模板发送事件。
|
|
*/
|
|
export function bindWelcomeMenuControls() {
|
|
if (welcomeMenuEventsBound || typeof document === "undefined") {
|
|
return;
|
|
}
|
|
|
|
welcomeMenuEventsBound = true;
|
|
|
|
document.addEventListener("click", (event) => {
|
|
if (!(event.target instanceof Element)) {
|
|
return;
|
|
}
|
|
|
|
const toggleButton = event.target.closest("[data-chat-welcome-menu-toggle]");
|
|
if (toggleButton) {
|
|
event.preventDefault();
|
|
toggleWelcomeMenu(event);
|
|
return;
|
|
}
|
|
|
|
const menu = event.target.closest("[data-chat-welcome-menu]");
|
|
if (!menu) return;
|
|
|
|
// 阻止菜单内部点击冒泡。
|
|
event.stopPropagation();
|
|
|
|
const item = event.target.closest("[data-chat-welcome-template]");
|
|
if (!item || !menu.contains(item)) return;
|
|
|
|
const template = item.getAttribute("data-chat-welcome-template") || "";
|
|
// sendWelcomeTpl 仍由 Blade 维护(依赖 sendMessage),这里通过 window 调用。
|
|
if (template && typeof window.sendWelcomeTpl === "function") {
|
|
window.sendWelcomeTpl(template);
|
|
}
|
|
});
|
|
}
|
|
|
|
export { toggleWelcomeMenu };
|