(node: any, tag: string)
| 158 | |
| 159 | // 检查是否应该跳过节点 |
| 160 | function shouldSkipNode(node: any, tag: string): boolean { |
| 161 | // 1. 判断标签是否在 skipSet 内 |
| 162 | // 2. 检查是否具有 notranslate 类 |
| 163 | // 3. 判断节点是否可编辑 |
| 164 | // 4. 判断文本是否过长 |
| 165 | // 5. 判断文本是否为纯数字或标准数字格式(仅当节点内容几乎全是数字时才跳过) |
| 166 | return skipSet.has(tag) || |
| 167 | node.classList?.contains('notranslate') || |
| 168 | node.isContentEditable || |
| 169 | checkTextSize(node) || |
| 170 | isMainlyNumericContent(node); |
| 171 | } |
| 172 | |
| 173 | // 检查文本长度 |
| 174 | function checkTextSize(node: any): boolean { |
no test coverage detected