MCPcopy
hub / github.com/ocsjs/ocsjs / readerAndFillHandle

Function readerAndFillHandle

packages/scripts/src/projects/cx.ts:2196–2219  ·  view source on GitHub ↗

阅读理解和完形填空的共同处理器

(searchInfos: SearchInformation[], list: HTMLElement[])

Source from the content-addressed store, hash-verified

2194
2195/** 阅读理解和完形填空的共同处理器 */
2196async function readerAndFillHandle(searchInfos: SearchInformation[], list: HTMLElement[]) {
2197 for (const answers of searchInfos.map((info) => info.results.map((res) => res.answer))) {
2198 let ans = answers;
2199
2200 if (ans.length === 1) {
2201 ans = splitAnswer(ans[0]);
2202 }
2203
2204 if (ans.filter(Boolean).length !== 0 && list.length !== 0) {
2205 for (let index = 0; index < ans.length; index++) {
2206 const item = list[index];
2207 if (item) {
2208 /** 获取每个小题中的准确答案选项 并点击 */
2209 $el(`span.saveSingleSelect[data="${ans[index]}"]`, item)?.click();
2210 await $.sleep(200);
2211 }
2212 }
2213
2214 return { finish: true };
2215 }
2216 }
2217
2218 return { finish: false };
2219}
2220
2221function hasFaceRecognition() {
2222 // 人脸元素有时候 src 属性为空字符串,所以这里需要判断 src 是否为空字符串,如是则人脸识别会出现。

Callers 1

workOrExamFunction · 0.85

Calls 1

splitAnswerFunction · 0.90

Tested by

no test coverage detected