From b849b083864b03b5a78641ed2d3bdb7bf78af99e Mon Sep 17 00:00:00 2001 From: Julian Freeman Date: Fri, 10 Apr 2026 15:39:32 -0400 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B7=A6=E4=BE=A7=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E5=88=97=E8=A1=A8=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/content.js b/content.js index 91f6361..8a6088f 100644 --- a/content.js +++ b/content.js @@ -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;