欢迎语:渲染为蓝色边框公告样式(低于系统公告),发送前临时设 action=欢迎

This commit is contained in:
2026-03-17 21:24:31 +08:00
parent ca415cceef
commit 5b065fdcce

View File

@@ -151,8 +151,16 @@
const menu = document.getElementById('welcome-menu');
if (menu) { menu.style.display = 'none'; }
// 临时把 action 设为「欢迎」,让消息在聊天窗口以瓦蓝边框样式显示
const actionSel = document.getElementById('action');
const prevAction = actionSel?.value || '';
if (actionSel) { actionSel.value = '欢迎'; }
// 自动触发发送
sendMessage(null);
sendMessage(null).finally(() => {
// 发完后恢复原来的 action
if (actionSel) { actionSel.value = prevAction; }
});
}
// 点击页面任意位置,关闭欢迎语浮层
@@ -492,6 +500,19 @@
html = `${iconImg} ${parsedContent}`;
}
// 贾妖语 —— 蓝色左边框渐变样式,比 系统公告 低调
else if (msg.action === '欢迎') {
div.style.cssText =
'background: linear-gradient(135deg, #eff6ff, #f0f9ff); border: 1.5px solid #3b82f6; border-radius: 5px; padding: 5px 10px; margin: 3px 0; box-shadow: 0 1px 3px rgba(59,130,246,0.12);';
let parsedContent = msg.content;
parsedContent = parsedContent.replace(/([^]+)/g, function(match, uName) {
return '【' + clickableUser(uName, '#1d4ed8') + '】';
});
html = `<div style="color: #1e40af;">&#x1F4AC; ${parsedContent} <span style="color: #93c5fd; font-size: 11px; font-weight: normal;">(${timeStr})</span></div>`;
timeStrOverride = true;
}
// 接下来再判断各类发话人
else if (systemUsers.includes(msg.from_user)) {
if (msg.from_user === '系统公告') {