修复左侧消息列表替换

This commit is contained in:
Julian Freeman
2026-04-10 15:39:32 -04:00
parent 660fb811a2
commit b849b08386

View File

@@ -102,12 +102,12 @@ function applyLeftChatAlias(el) {
if (!id || !id.startsWith(ICON_ID_PREFIX)) return;
let parent = el;
// 向上查找 3 个父元素
for (let i = 0; i < 3; i++) {
// 向上查找 4 个父元素
for (let i = 0; i < 4; i++) {
if (parent.parentElement) {
parent = parent.parentElement;
} else {
return; // 如果不足3层,就跳过
return; // 如果不足4层,就跳过
}
}
@@ -115,17 +115,17 @@ function applyLeftChatAlias(el) {
const nextSibling = parent.nextElementSibling;
if (!nextSibling) return;
// 向下查找第 2 个子元素(层级式)
// 向下查找第 7 个子元素(层级式)
let target = nextSibling;
for (let i = 0; i < 2; i++) {
for (let i = 0; i < 7; i++) {
if (target.children.length > 0) {
target = target.children[0]; // 每层往下取第一个子元素
} else {
return; // 不足2层,跳过
return; // 不足7层,跳过
}
}
// 判断符合才修改
if (target.getAttribute('data-tid') === 'chat-list-item-title') {
if (target.id.startsWith('title-chat-list-item')) {
getAlias(id.replace(ICON_ID_PREFIX, "")).then(alias => {
if (alias && target.textContent !== alias) {
target.textContent = alias;