mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
grab box answer getting
This commit is contained in:
parent
2b77abc63b
commit
c67ae2e014
1 changed files with 28 additions and 1 deletions
|
@ -39,6 +39,10 @@
|
|||
// @namespace https://qmining.frylabs.net
|
||||
// @updateURL https://qmining.frylabs.net/moodle-test-userscript/stable.user.js?up
|
||||
// ==/UserScript==
|
||||
//
|
||||
// TODO:
|
||||
// test select boxes on result page
|
||||
// dragboxes test on quiz page
|
||||
|
||||
(function() { // eslint-disable-line
|
||||
// GM functions, only to disable ESLINT errors
|
||||
|
@ -670,6 +674,24 @@
|
|||
return r
|
||||
}
|
||||
|
||||
TestIfQuestionIsGrabBox (i) {
|
||||
if (logElementGetting) { Log('testing if question is grab-box') }
|
||||
let results = this.GetFormResult() // getting results element
|
||||
let t = results[i].getElementsByClassName('dragitems')[0].childNodes
|
||||
if (t.length !== 1) { Log('grab box drag items group length is not 1!') }
|
||||
let placedItems = t[0].getElementsByClassName('placed')
|
||||
let res = []
|
||||
for (let i = 0; i < placedItems.length; i++) {
|
||||
let item = placedItems[i]
|
||||
res.push({
|
||||
text: item.innerText,
|
||||
left: item.style.left,
|
||||
top: item.style.top
|
||||
})
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
GetRightAnswerIfCorrectShown (i) {
|
||||
if (logElementGetting) { Log('getting right answer if correct shown') }
|
||||
var results = this.GetFormResult() // getting results element
|
||||
|
@ -748,7 +770,12 @@
|
|||
|
||||
// "húzza oda ..." skip
|
||||
fun.push((i) => {
|
||||
return undefined
|
||||
let temp = RPM.TestIfQuestionIsGrabBox(i)
|
||||
console.log('GRABBOX TEST')
|
||||
console.log(temp)
|
||||
return temp.map((x) => {
|
||||
return x.text
|
||||
}).join(', ')
|
||||
})
|
||||
|
||||
// the basic type of getting answers
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue