diff --git a/stable.user.js b/stable.user.js index 86af0f5..9d783c0 100644 --- a/stable.user.js +++ b/stable.user.js @@ -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