MCPcopy
hub / github.com/ocsjs/ocsjs / waitForCaptcha

Function waitForCaptcha

packages/scripts/src/projects/zhs.ts:2564–2584  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2562}
2563
2564function 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
2586function getPopupCaptcha() {
2587 return document.querySelector('.yidun_popup');

Callers 7

handleTestDialogMethod · 0.85
handleTestDialogMethod · 0.85
handleTestDialogMethod · 0.85
doWorkFunction · 0.85
doJobFunction · 0.85
watchFunction · 0.85
gxkWorkAndExamFunction · 0.85

Calls 1

getPopupCaptchaFunction · 0.85

Tested by

no test coverage detected