MCPcopy
hub / github.com/ocsjs/ocsjs / oncomplete

Function oncomplete

packages/scripts/src/projects/unipus/exploration.ts:120–168  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

118 }
119 },
120 async oncomplete() {
121 if (location.href.includes('cmgt/resource-detail')) {
122 $msg.info('请打开任意课程的章节进行自动学习');
123 return;
124 }
125
126 CommonProject.scripts.render.methods.pin(this);
127
128 // 检查是否为软件环境
129 const rp: RemotePage | undefined = await BackgroundProject.scripts.dev.methods.getRemotePlaywrightCurrentPage();
130 // 检查是否为软件环境
131 if (!rp) {
132 return $playwright.showError();
133 }
134
135 this.onConfigChange('playbackRate', (value) => {
136 if (state.current_media) {
137 state.current_media.playbackRate = value;
138 }
139 });
140 this.onConfigChange('volume', (value) => {
141 if (state.current_media) {
142 state.current_media.volume = value;
143 }
144 });
145
146 // 等待确认弹窗出现自动关闭
147 const checkConfirmModal = async () => {
148 await $.sleep(3000);
149
150 const btns = [
151 // 系统学习时间确认
152 '.system-info-cloud-ok-button',
153 // 确认做笔记习惯弹窗
154 '.ant-modal-body .ant-btn-primary',
155 // 由于你长时间未操作,请点确定继续使用。
156 'button[class*=mask_notice]'
157 ];
158
159 const btn = await waitForElement(btns.join(','));
160 if (btn) {
161 await rp.click(btn);
162 }
163 await checkConfirmModal();
164 };
165 checkConfirmModal();
166 await waitForElement('.question-wrap');
167 job(this.cfg, rp);
168 },
169 onrender(elements) {
170 const translateBtn = h(
171 'button',

Callers

nothing calls this directly

Calls 3

waitForElementFunction · 0.90
checkConfirmModalFunction · 0.85
jobFunction · 0.85

Tested by

no test coverage detected