update answerer
This commit is contained in:
parent
9d6283101b
commit
ef0b2b51b1
@ -74,8 +74,18 @@
|
||||
const question = doc
|
||||
.getElementsByTagName("iframe")[0]
|
||||
.contentDocument.getElementById("body").innerText;
|
||||
const answer = doc.getElementsByClassName("extable")[0].innerText.replaceAll("\t", "- ");
|
||||
return question + answer;
|
||||
const children = getAnswerElement().children[0].children;
|
||||
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() {
|
||||
@ -90,15 +100,29 @@
|
||||
let answered = false;
|
||||
const answers = answer.split("\n");
|
||||
const children = getAnswerElement().children[0].children;
|
||||
const options = {};
|
||||
for (const child of children) {
|
||||
if (child.classList[0] !== "optionContent") {
|
||||
continue;
|
||||
}
|
||||
if (answers.includes(child.innerText.replaceAll("\t", ""))) {
|
||||
child.children[0].children[0].click();
|
||||
answered = true;
|
||||
const labels = child.getElementsByTagName("label");
|
||||
if (labels.length > 1) {
|
||||
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) {
|
||||
const done = allDone();
|
||||
const submitButton = getAnswerElement().nextElementSibling.children[1];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user