update answerer
This commit is contained in:
parent
9d6283101b
commit
ef0b2b51b1
@ -74,8 +74,18 @@
|
|||||||
const question = doc
|
const question = doc
|
||||||
.getElementsByTagName("iframe")[0]
|
.getElementsByTagName("iframe")[0]
|
||||||
.contentDocument.getElementById("body").innerText;
|
.contentDocument.getElementById("body").innerText;
|
||||||
const answer = doc.getElementsByClassName("extable")[0].innerText.replaceAll("\t", "- ");
|
const children = getAnswerElement().children[0].children;
|
||||||
return question + answer;
|
const answers = [];
|
||||||
|
for (const child of children) {
|
||||||
|
if (child.classList[0] !== "optionContent") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const labels = child.getElementsByTagName("label");
|
||||||
|
for (const label of labels) {
|
||||||
|
answers.push(label.innerText.trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return question + answers.map((s) => "- " + s.replaceAll("\t", "")).join("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyToClipboard() {
|
function copyToClipboard() {
|
||||||
@ -90,14 +100,28 @@
|
|||||||
let answered = false;
|
let answered = false;
|
||||||
const answers = answer.split("\n");
|
const answers = answer.split("\n");
|
||||||
const children = getAnswerElement().children[0].children;
|
const children = getAnswerElement().children[0].children;
|
||||||
|
const options = {};
|
||||||
for (const child of children) {
|
for (const child of children) {
|
||||||
if (child.classList[0] !== "optionContent") {
|
if (child.classList[0] !== "optionContent") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (answers.includes(child.innerText.replaceAll("\t", ""))) {
|
const labels = child.getElementsByTagName("label");
|
||||||
child.children[0].children[0].click();
|
if (labels.length > 1) {
|
||||||
answered = true;
|
for (const label of labels) {
|
||||||
|
options[label.innerText.trim().replaceAll("\t", "")] = label.children[0];
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
options[child.innerText.trim().replaceAll("\t", "")] =
|
||||||
|
child.children[0].children[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const answer of answers) {
|
||||||
|
const input = options[answer.trim()];
|
||||||
|
if (!input) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
input.click();
|
||||||
|
answered = true;
|
||||||
}
|
}
|
||||||
if (answered && stat.autoMode) {
|
if (answered && stat.autoMode) {
|
||||||
const done = allDone();
|
const done = allDone();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user