Skip to content

Commit

Permalink
加强:ignoreMutationSelectors新增支持公共规则,并修复 #149
Browse files Browse the repository at this point in the history
修复顶部搜索框会误翻译输入的词汇
  • Loading branch information
maboloshi committed Aug 23, 2024
1 parent 61c3a51 commit 96fd043
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions locals.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ I18N.conf = {
'repository/blame': ["section"], // 代码视图
'repository': [".AppHeader-context", "article.markdown-body", "table"],
'repository/releases': [".Box-footer"], // 附件清单
'*': [
'div.QueryBuilder-StyledInputContainer', // 顶部搜索栏 关键词被翻译
],
},

// 特定页面,忽略元素规则
Expand Down Expand Up @@ -139,6 +142,7 @@ I18N.conf = {
'*': [
'.markdown-body',
'.markdown-title',
'span.ActionListItem-label.text-normal', // 顶部搜索栏 关键词被翻译
'CODE', 'SCRIPT', 'STYLE', 'LINK', 'IMG', 'MARKED-TEXT', 'PRE', 'KBD', // 特定元素标签
],
}
Expand Down
2 changes: 1 addition & 1 deletion main.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

characterData = characterDataPage.includes(page);
// 忽略突变元素选择器
ignoreMutationSelectors = ignoreMutationSelectorPage[page] || [];
ignoreMutationSelectors = ignoreMutationSelectorPage['*'].concat(ignoreMutationSelectorPage[page] || []);
// 忽略元素选择器
ignoreSelectors = ignoreSelectorPage['*'].concat(ignoreSelectorPage[page] || []);
// 通过 CSS 选择器翻译的规则
Expand Down

0 comments on commit 96fd043

Please sign in to comment.