Last active
April 26, 2021 22:55
-
-
Save rprtr258/a08fe581abb186de146e9af61f26e2cd to your computer and use it in GitHub Desktop.
vanuchaya
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Автоматическое прохождение проверочных заданий. Просто нажимает все первые ответы и отправляет. | |
Неправильные ответы можно исправить вручную. | |
*/ | |
$(".response-label > input[value=choice_0]").click(); | |
$("button.submit").click(); | |
setTimeout(() => { | |
for (let f of $(".notification.error.notification-submit")) | |
f.parentNode.querySelector("input[value=choice_1]").click(); | |
$("button.submit").click(); | |
}, 3000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Собирает вопросы с одним и несколькими вариантами ответа и печатает в виде csv строки с разделителем "&". | |
Вопросы с вводом ответа ломают скрипт, так что надо поменять i=0 на следующий после вопроса с вводом ответа. | |
*/ | |
let joinToString = (elems) => Array.from(elems).map(x=>x.textContent.trim()).join("/"); | |
let joinToString2 = (elems) => Array.from(elems).map(x=>x.nextSibling.textContent.trim()).join("/"); | |
let divs = $("p+div.wrapper-problem-response"); | |
let ps = divs.prev(); | |
let n = divs.length; | |
let kkk = ""; | |
for (let i=0; i<n; i++) { | |
let question = ps[i].textContent; | |
let d = divs[i]; | |
if (d.querySelectorAll("input.input-checkbox").length == 0) { | |
let answer = d.querySelector("label.choicegroup_correct").childNodes[2].textContent.trim(); | |
let wrong = joinToString(d.querySelectorAll("label:not(.choicegroup_correct)")); | |
kkk += `${question}&${answer}&${wrong}\n`; | |
} else { | |
let answer = joinToString2(d.querySelectorAll("input[checked]")); | |
let wrong = joinToString2(d.querySelectorAll("input:not([checked])")); | |
kkk += `${question}&${answer}&${wrong}\n`; | |
} | |
} | |
console.log(kkk); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment