mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
Ugrás... fix
This commit is contained in:
parent
ad0e355f2d
commit
169e48e389
1 changed files with 34 additions and 18 deletions
|
@ -89,7 +89,8 @@
|
|||
const forceResultPage = false
|
||||
const forceDefaultPage = false
|
||||
const logElementGetting = false
|
||||
const log = true
|
||||
const log = false
|
||||
const showErrors = false
|
||||
|
||||
const motdShowCount = 3 /* Ammount of times to show motd */
|
||||
let infoExpireTime = 60 // Every n seconds basic info should be loaded from server
|
||||
|
@ -549,6 +550,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
getGeneralFeedback(i) {
|
||||
return document.getElementsByClassName('generalfeedback')[0]
|
||||
}
|
||||
|
||||
GetAnswerNode(i) {
|
||||
if (logElementGetting) {
|
||||
Log('getting answer node')
|
||||
|
@ -663,7 +668,9 @@
|
|||
}
|
||||
return res
|
||||
} catch (e) {
|
||||
console.info(e)
|
||||
if (showErrors) {
|
||||
console.info(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -760,18 +767,19 @@
|
|||
return currQuestion
|
||||
}
|
||||
|
||||
GetRightAnswerFromResult(i) {
|
||||
let res = this.GetRightAnswerFromResultv2(i)
|
||||
if (!res) {
|
||||
res = this.GetRightAnswerFromResultv1(i)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
// tries to get right answer from result page
|
||||
// i is the index of the question
|
||||
GetRightAnswerFromResult(i) {
|
||||
GetRightAnswerFromResultv1(i) {
|
||||
var fun = []
|
||||
|
||||
// Ugrás... fix: textarea-ban kell válaszolni
|
||||
fun.push(i => {
|
||||
const a = RPM.getTextAreaAnsweretAsd()
|
||||
console.log(a)
|
||||
return a
|
||||
})
|
||||
|
||||
// "húzza oda ..." skip
|
||||
fun.push(i => {
|
||||
let temp = RPM.GetAnswersFromGrabBox(i)
|
||||
|
@ -832,7 +840,9 @@
|
|||
try {
|
||||
currAnswer = fun[j](i)
|
||||
} catch (e) {
|
||||
console.info(e)
|
||||
if (showErrors) {
|
||||
console.info(e)
|
||||
}
|
||||
}
|
||||
j++
|
||||
}
|
||||
|
@ -896,9 +906,14 @@
|
|||
try {
|
||||
var answerNodes = this.GetAnswerNode(i)
|
||||
let items = answerNodes.nodes
|
||||
const generalfeedback = this.getGeneralFeedback(i)
|
||||
|
||||
if (generalfeedback) {
|
||||
return generalfeedback.innerText
|
||||
}
|
||||
|
||||
if (answerNodes.type === 'checkbox') {
|
||||
return RPM.GetRightAnswerFromResult(i)
|
||||
return RPM.GetRightAnswerFromResultv1(i)
|
||||
}
|
||||
|
||||
for (let j = 0; j < items.length; j++) {
|
||||
|
@ -922,6 +937,9 @@
|
|||
}
|
||||
} catch (e) {
|
||||
Log('error at new nodegetting, trying the oldschool way')
|
||||
if (showErrors) {
|
||||
console.info(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1540,12 +1558,8 @@
|
|||
var question = {} // the current question
|
||||
// QUESTION --------------------------------------------------------------------------------------------------------------------
|
||||
question.Q = RPM.GetQuestionFromResult(i)
|
||||
|
||||
// RIGHTANSWER ---------------------------------------------------------------------------------------------------------------------
|
||||
question.A = RPM.GetRightAnswerFromResultv2(i)
|
||||
if (question.A === undefined) {
|
||||
question.A = RPM.GetRightAnswerFromResult(i)
|
||||
}
|
||||
question.A = RPM.GetRightAnswerFromResult(i)
|
||||
// DATA ---------------------------------------------------------------------------------------------------------------------
|
||||
question.data = GetDataFormResult(i)
|
||||
|
||||
|
@ -2283,7 +2297,9 @@
|
|||
try {
|
||||
lastInfo = JSON.parse(getVal('lastInfo'))
|
||||
} catch (e) {
|
||||
console.info(e)
|
||||
if (showErrors) {
|
||||
console.info(e)
|
||||
}
|
||||
}
|
||||
if (
|
||||
lastInfo.result !== 'success' ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue