MCPcopy
hub / github.com/ocsjs/ocsjs / readPPT

Function readPPT

packages/scripts/src/projects/icourse.ts:666–687  ·  view source on GitHub ↗
(remotePage: RemotePage, readSpeed: number)

Source from the content-addressed store, hash-verified

664}
665
666async function readPPT(remotePage: RemotePage, readSpeed: number) {
667 const reader = document.querySelector('.ux-pdf-reader');
668 if (reader) {
669 const total = parseInt(
670 document
671 .querySelector('.ux-h5pdfreader_container_footer_pages_total')
672 ?.childNodes[1]?.textContent?.replace(/\s/, '') || '0'
673 );
674 const start = parseInt(
675 document.querySelector<HTMLInputElement>('.ux-h5pdfreader_container_footer_pages_in')?.value || '1'
676 );
677 for (let index = start; index < total + 1; index++) {
678 const next = document.querySelector<HTMLElement>('.ux-h5pdfreader_container_footer_pages_next');
679 if (next) {
680 await remotePage.click(next);
681 } else {
682 $msg_and_log('error', '未找到PPT的下一页按钮!');
683 }
684 await $.sleep(readSpeed * 1000);
685 }
686 }
687}
688
689async function discussion(
690 remotePage: RemotePage,

Callers 1

studyFunction · 0.85

Calls 1

$msg_and_logFunction · 0.70

Tested by

no test coverage detected