MCPcopy
hub / github.com/Bistutu/FluentRead / shouldSkipGitHubElement

Function shouldSkipGitHubElement

entrypoints/main/compat.ts:697–1033  ·  view source on GitHub ↗

* 判断是否应该跳过GitHub网站上的特定元素

(node: any)

Source from the content-addressed store, hash-verified

695 * 判断是否应该跳过GitHub网站上的特定元素
696 */
697function shouldSkipGitHubElement(node: any): boolean {
698 // 检查是否为特殊内容(URL、邮箱、用户名等)
699 if (node.textContent && isSpecialContent(node.textContent)) {
700 debugLog('GitHub', '特殊内容跳过', node.textContent);
701 return true;
702 }
703
704 // 判断是否为目录名称或路径
705 if (isGitHubPathOrFileName(node)) {
706 debugLog('GitHub', '目录/文件名跳过', node.textContent);
707 return true;
708 }
709
710 // 检查是否为GitHub特定的标签文本
711 const gitHubLabels = [
712 'bug', 'feature', 'enhancement', 'documentation', 'duplicate', 'good first issue',
713 'help wanted', 'invalid', 'question', 'wontfix', 'dependencies', 'security',
714 'enhancement', 'open', 'closed', 'merged', 'draft', 'done', 'in progress',
715 'pending', 'fixed', 'resolved', 'won\'t fix', 'needs review', 'approved',
716 'blocked', 'stale', 'needs work', 'ready for review', 'needs more information',
717 'enhancement', 'frontend', 'backend', 'api', 'ui', 'ux', 'refactor', 'test',
718 'needs tests', 'ready for work', 'wip', 'top priority', 'low priority', 'medium priority',
719 'high priority', 'work in progress', 'needs investigation', 'feature request',
720 'discussion', 'breaking change', 'needs triage'
721 ];
722
723 // GitHub状态文本
724 const gitHubStatusTexts = [
725 'Open', 'Closed', 'Merged', 'Draft', 'Pending', 'Approved',
726 'Changes requested', 'Review required', 'Needs work', 'Ready for review',
727 'Assignee', 'Author', 'Changed', 'Comments', 'Commits', 'Conversation',
728 'Files changed', 'Participants', 'Reviewers', 'Unresolved conversations',
729 'View changes', 'Clone', 'Code', 'Contributors', 'Raw', 'Blame', 'History',
730 'is:issue', 'is:pr', 'is:open', 'is:closed', 'state:open', 'state:closed',
731 'No wrap', 'Soft wrap', 'Set status'
732 ];
733
734 // 如果节点文本是GitHub标签或状态文本,跳过翻译
735 if (node.textContent) {
736 const text = node.textContent.trim();
737
738 // 检查是否为GitHub Label文本
739 for (const label of gitHubLabels) {
740 if (text.toLowerCase() === label.toLowerCase()) {
741 debugLog('GitHub', 'GitHub Label跳过', text);
742 return true;
743 }
744 }
745
746 // 检查是否为GitHub状态文本
747 for (const status of gitHubStatusTexts) {
748 if (text === status) {
749 debugLog('GitHub', 'GitHub状态文本跳过', text);
750 return true;
751 }
752 }
753
754 // 检查是否为搜索过滤器语法

Callers 1

compat.tsFile · 0.85

Calls 3

isSpecialContentFunction · 0.85
debugLogFunction · 0.85
isGitHubPathOrFileNameFunction · 0.85

Tested by

no test coverage detected