()
| 1252 | await $.sleep(5 * 1000); |
| 1253 | |
| 1254 | const next = async () => { |
| 1255 | const nextJob = getNextJob(); |
| 1256 | |
| 1257 | if (nextJob) { |
| 1258 | const nextJobTitle = nextJob.querySelector('.common-text') as HTMLElement; |
| 1259 | |
| 1260 | if (include_jobs.some((job) => nextJob.querySelector('.icon-box')?.classList.contains(job))) { |
| 1261 | nextJobTitle.click(); |
| 1262 | await doWork(); |
| 1263 | } |
| 1264 | // 链接任务 |
| 1265 | else { |
| 1266 | /** |
| 1267 | * 链接任务点不会自动取消 active 样式,导致无法获取下一个任务点 |
| 1268 | * 这里手动移除 active 样式,避免影响获取下一个任务点 |
| 1269 | */ |
| 1270 | document |
| 1271 | .querySelectorAll('[class*="card-container"].active') |
| 1272 | .forEach((el) => el.classList.remove('active')); |
| 1273 | |
| 1274 | // 链接任务点不会自动附加 active 样式,这里手动添加 |
| 1275 | nextJob?.classList.add('active'); |
| 1276 | |
| 1277 | await $.sleep(1000); |
| 1278 | |
| 1279 | const _open = $gm.unsafeWindow.open; |
| 1280 | $gm.unsafeWindow.open = () => null; |
| 1281 | nextJobTitle.click(); |
| 1282 | |
| 1283 | const msg = '链接任务完成,即将自动下一节!'; |
| 1284 | $message.info(msg); |
| 1285 | setTimeout(async () => { |
| 1286 | $gm.unsafeWindow.open = _open; |
| 1287 | // 直接下一个 |
| 1288 | await next(); |
| 1289 | }, 3000); |
| 1290 | } |
| 1291 | return; |
| 1292 | } |
| 1293 | |
| 1294 | const nextEl = getNext(); |
| 1295 | if (nextEl) { |
| 1296 | nextEl.click(); |
| 1297 | } else { |
| 1298 | finishAlert(); |
| 1299 | } |
| 1300 | }; |
| 1301 | |
| 1302 | try { |
| 1303 | const wrapper = document.querySelector<HTMLElement>('.video-player-wrapper'); |
no test coverage detected