fix: v0.18 — 搜尋語法 state:open 不再被翻(修功能性災難)+ 貢獻 banner 補第一段

搜尋框:新版 React SearchBar 用 <span data-type="filter-expression"> 包住
is:issue state:open,外層 form 只有 role="form" 不是 role="search",
既有 [role="searchbox"] / form[role="search"] 全部抓不到,導致 state:open
被翻成 state:開啟中,點擊會破壞搜尋功能。

新增 skip:
- [data-type="filter-expression"] / [data-type="filter"] / [data-type="filter-value"]
- .styled-input-container

貢獻 banner:整句詞庫條目永遠不匹配(contributing guidelines 在 <a> 裡,
跨不過節點邊界),實際只靠三個片段拼。原本缺前段「If you have a bug or an
idea, read the」對應,所以顯示半翻。補上該片段條目,移除無效的整句條目與
read the contributing guidelines 條目。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-22 18:03:11 +08:00
parent 36cd2df55d
commit f881124bdf

View File

@@ -1,7 +1,7 @@
// ==UserScript==
// @name GitHub 中文化 (繁體)
// @namespace https://github.com/scriptscat/scriptcat
// @version 0.17
// @version 0.18
// @description 幫 GitHub 導覽列、按鈕、屬性換成繁體中文,支援 SPA 動態更新,不亂翻、不卡頓。
// @match https://github.com/*
// @run-at document-idle
@@ -182,8 +182,9 @@
['Recently updated', '最近更新'],
['Dismiss', '關閉提示'],
['Want to contribute to', '想貢獻給'],
['If you have a bug or an idea, read the contributing guidelines before opening an issue', '若您發現錯誤或有新想法,請先閱讀貢獻指引再開啟問題'],
['read the contributing guidelines', '請閱讀貢獻指引'],
// 此橫幅實際是三段文字節點:前段文字 + <a>contributing guidelines</a> + 後段文字。
// 整句條目永遠不會匹配(跨不過 <a> 邊界),只靠三個片段湊。
['If you have a bug or an idea, read the', '若您發現錯誤或有新想法,請先閱讀'],
['contributing guidelines', '貢獻指引'],
['before opening an issue', '再開啟問題'],
['Never', '從未'],
@@ -312,6 +313,12 @@
'.subnav-search-context',
'input[name="q"] ~ *',
'.pl-c1', '.pl-s', '.pl-en', '.pl-k', '.pl-v', '.pl-smi', '.pl-s1',
// 2026 新版 React SearchBarfilter 語法 token 用 data-type 標記is / state / open / issue 等),
// 外層 form 只有 role="form" 不是 role="search",原規則抓不到。
'[data-type="filter-expression"]',
'[data-type="filter"]',
'[data-type="filter-value"]',
'.styled-input-container',
// Labels使用者自定義 label 顏色塊)
'a.IssueLabel',
'.IssueLabel',