mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
Grab and drop question type
This commit is contained in:
parent
4789da4342
commit
f0b05d4fc0
1 changed files with 21 additions and 2 deletions
23
main.js
23
main.js
|
@ -540,7 +540,9 @@ class ResultsPageModell {
|
||||||
if (logElementGetting) { Log('Getting right answer if correct not shown') }
|
if (logElementGetting) { Log('Getting right answer if correct not shown') }
|
||||||
var results = this.GetFormResult() // getting results element
|
var results = this.GetFormResult() // getting results element
|
||||||
var n = results[i].getElementsByTagName('i')[0].parentNode
|
var n = results[i].getElementsByTagName('i')[0].parentNode
|
||||||
if (n.className.includes('correct') && !n.className.includes('incorrect')) { return results[i].getElementsByTagName('i')[0].parentNode.innerText } else { return '' }
|
if (n.className.includes('correct') && !n.className.includes('incorrect')) {
|
||||||
|
return results[i].getElementsByTagName('i')[0].parentNode.innerText
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GetFormCFOfResult (result) {
|
GetFormCFOfResult (result) {
|
||||||
|
@ -560,6 +562,15 @@ class ResultsPageModell {
|
||||||
return this.GetFormCFOfResult(results[i]).getElementsByTagName('img')
|
return this.GetFormCFOfResult(results[i]).getElementsByTagName('img')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GetOnlyImageQuestionResult (i) {
|
||||||
|
console.log('############################################################')
|
||||||
|
console.log(i)
|
||||||
|
const results = this.GetFormResult() // getting results element
|
||||||
|
const n = results[i]
|
||||||
|
console.log(n)
|
||||||
|
console.log('############################################################')
|
||||||
|
}
|
||||||
|
|
||||||
// gets the question from the result page
|
// gets the question from the result page
|
||||||
// i is the index of the question
|
// i is the index of the question
|
||||||
GetQuestionFromResult (i) {
|
GetQuestionFromResult (i) {
|
||||||
|
@ -608,6 +619,11 @@ class ResultsPageModell {
|
||||||
if (RPM.GetDropboxes(i).length > 0) { return RPM.GetCurrentAnswer(i) }
|
if (RPM.GetDropboxes(i).length > 0) { return RPM.GetCurrentAnswer(i) }
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// image and text only question
|
||||||
|
fun.push(function TryGet5 (i) {
|
||||||
|
return RPM.GetOnlyImageQuestionResult(i)
|
||||||
|
})
|
||||||
|
|
||||||
// if the correct answers are not shown, and the selected answer
|
// if the correct answers are not shown, and the selected answer
|
||||||
// is correct
|
// is correct
|
||||||
fun.push(function TryGet2 (i) {
|
fun.push(function TryGet2 (i) {
|
||||||
|
@ -637,7 +653,10 @@ class ResultsPageModell {
|
||||||
var j = 0
|
var j = 0
|
||||||
var currAnswer
|
var currAnswer
|
||||||
while (j < fun.length && SUtils.EmptyOrWhiteSpace(currAnswer)) {
|
while (j < fun.length && SUtils.EmptyOrWhiteSpace(currAnswer)) {
|
||||||
currAnswer = fun[j](i)
|
try {
|
||||||
|
currAnswer = fun[j](i)
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
j++
|
j++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue