()
| 2562 | } |
| 2563 | |
| 2564 | function waitForCaptcha(): void | Promise<void> { |
| 2565 | const popup = getPopupCaptcha(); |
| 2566 | if (popup) { |
| 2567 | const message = $message.warn({ content: '当前检测到验证码,请输入后方可继续运行。', duration: 0 }); |
| 2568 | CommonProject.scripts.settings.methods.notificationBySetting( |
| 2569 | '智慧树脚本:当前检测到验证码,请输入后方可继续运行。', |
| 2570 | { duration: 0 } |
| 2571 | ); |
| 2572 | |
| 2573 | return new Promise<void>((resolve, reject) => { |
| 2574 | const interval = setInterval(() => { |
| 2575 | const popup = getPopupCaptcha(); |
| 2576 | if (popup === null) { |
| 2577 | message?.remove(); |
| 2578 | clearInterval(interval); |
| 2579 | resolve(); |
| 2580 | } |
| 2581 | }, 1000); |
| 2582 | }); |
| 2583 | } |
| 2584 | } |
| 2585 | |
| 2586 | function getPopupCaptcha() { |
| 2587 | return document.querySelector('.yidun_popup'); |
no test coverage detected