(titles: (HTMLElement | undefined)[])
| 480 | }); |
| 481 | |
| 482 | const titleTransform = (titles: (HTMLElement | undefined)[]) => { |
| 483 | return removeRedundantWords( |
| 484 | titles |
| 485 | .filter((t) => t?.innerText || t?.querySelector('img')) |
| 486 | .map((t) => { |
| 487 | if (t) { |
| 488 | const el = optimizationElementWithImage(t, true); |
| 489 | // textContent can still read the hidden image URL placeholders. |
| 490 | return (el.textContent || '').replace(/\s+/g, ' ').trim() || ''; |
| 491 | } |
| 492 | return ''; |
| 493 | }) |
| 494 | .filter((t) => t.trim() !== '') |
| 495 | .join(',') |
| 496 | // /\u200B/g 排除不可见的空格 |
| 497 | .replace(/[\u200A-\u200F]/g, ''), |
| 498 | redundanceWordsText.split('\n') |
| 499 | ); |
| 500 | }; |
| 501 | const work_type = type; |
| 502 | |
| 503 | /** 新建答题器 */ |
no test coverage detected