From 96fd043f0c407dbb851aa55bf0d98a7c4032e76d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=99=E6=BC=A0=E4=B9=8B=E5=AD=90?= <7850715+maboloshi@users.noreply.github.com> Date: Fri, 23 Aug 2024 19:02:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=BC=BA=EF=BC=9A`ignoreMutationSelec?= =?UTF-8?q?tors`=E6=96=B0=E5=A2=9E=E6=94=AF=E6=8C=81=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E8=A7=84=E5=88=99=EF=BC=8C=E5=B9=B6=E4=BF=AE=E5=A4=8D=20#149?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E9=A1=B6=E9=83=A8=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=A1=86=E4=BC=9A=E8=AF=AF=E7=BF=BB=E8=AF=91=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E7=9A=84=E8=AF=8D=E6=B1=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locals.js | 4 ++++ main.user.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/locals.js b/locals.js index 46b8a5c4a..79a1ac88f 100644 --- a/locals.js +++ b/locals.js @@ -67,6 +67,9 @@ I18N.conf = { 'repository/blame': ["section"], // 代码视图 'repository': [".AppHeader-context", "article.markdown-body", "table"], 'repository/releases': [".Box-footer"], // 附件清单 + '*': [ + 'div.QueryBuilder-StyledInputContainer', // 顶部搜索栏 关键词被翻译 + ], }, // 特定页面,忽略元素规则 @@ -139,6 +142,7 @@ I18N.conf = { '*': [ '.markdown-body', '.markdown-title', + 'span.ActionListItem-label.text-normal', // 顶部搜索栏 关键词被翻译 'CODE', 'SCRIPT', 'STYLE', 'LINK', 'IMG', 'MARKED-TEXT', 'PRE', 'KBD', // 特定元素标签 ], } diff --git a/main.user.js b/main.user.js index feac59798..d730461a4 100644 --- a/main.user.js +++ b/main.user.js @@ -44,7 +44,7 @@ characterData = characterDataPage.includes(page); // 忽略突变元素选择器 - ignoreMutationSelectors = ignoreMutationSelectorPage[page] || []; + ignoreMutationSelectors = ignoreMutationSelectorPage['*'].concat(ignoreMutationSelectorPage[page] || []); // 忽略元素选择器 ignoreSelectors = ignoreSelectorPage['*'].concat(ignoreSelectorPage[page] || []); // 通过 CSS 选择器翻译的规则