mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
Possible answers fixes
This commit is contained in:
parent
50cb6d3237
commit
2f4786987d
1 changed files with 19 additions and 15 deletions
|
@ -46,7 +46,7 @@
|
|||
// : Script header {{{
|
||||
// ==UserScript==
|
||||
// @name Moodle/Elearning/KMOOC test help
|
||||
// @version 2.1.3.5
|
||||
// @version 2.1.3.6
|
||||
// @description Online Moodle/Elearning/KMOOC test help
|
||||
// @author MrFry
|
||||
// @match https://elearning.uni-obuda.hu/*
|
||||
|
@ -87,7 +87,6 @@
|
|||
// eslint-disable-line
|
||||
// GM functions, only to disable ESLINT errors
|
||||
/* eslint-disable */
|
||||
const a = Main
|
||||
const usf = unsafeWindow
|
||||
function getVal(name) {
|
||||
return GM_getValue(name)
|
||||
|
@ -118,7 +117,7 @@
|
|||
// ------------------------------------------------------------------------------
|
||||
// forcing pages for testing. unless you test, do not set these to true!
|
||||
const isDevel = false
|
||||
const forcedMatchString = isDevel ? '' : null
|
||||
const forcedMatchString = isDevel ? 'default' : null
|
||||
// only one of these should be true for testing
|
||||
const forceTestPage = isDevel && false
|
||||
const forceResultPage = isDevel && false
|
||||
|
@ -353,8 +352,13 @@
|
|||
const questions = readQuestions.map((question) => {
|
||||
return {
|
||||
Q: question.question,
|
||||
data: Object.assign(
|
||||
{},
|
||||
{
|
||||
possibleAnswers: question.possibleAnswers,
|
||||
data: question.data,
|
||||
},
|
||||
question.data
|
||||
),
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -367,8 +371,6 @@
|
|||
uid: getUid(),
|
||||
}
|
||||
|
||||
log(sentData)
|
||||
|
||||
log('Sent data', sentData)
|
||||
post('ask', sentData).then((results) => {
|
||||
removeLoadingMessage()
|
||||
|
@ -641,9 +643,12 @@
|
|||
question.reduce(makeTextFromElements, []).join(' ')
|
||||
)
|
||||
const possibleAnswers = possibleAnswerArray.map((x) => {
|
||||
return removeUnnecesarySpaces(
|
||||
return {
|
||||
type: 'txt',
|
||||
val: removeUnnecesarySpaces(
|
||||
x.reduce(makeTextFromElements, []).join(' ')
|
||||
)
|
||||
),
|
||||
}
|
||||
})
|
||||
const images = getImagesFromElements([
|
||||
...question,
|
||||
|
@ -682,7 +687,7 @@
|
|||
})
|
||||
}
|
||||
|
||||
function getDataFromTest(node, hashedImages, legacyImages) {
|
||||
function getDataFromTest(_node, hashedImages, legacyImages) {
|
||||
if (hashedImages.length > 0) {
|
||||
return {
|
||||
type: 'image',
|
||||
|
@ -1038,9 +1043,9 @@
|
|||
if (currElem) {
|
||||
const img = currElem.getElementsByTagName('img')[0]
|
||||
if (img) {
|
||||
elems.push(getAVRTextFromImg(img))
|
||||
elems.push({ type: 'txt', val: getAVRTextFromImg(img) })
|
||||
} else {
|
||||
elems.push(currElem.innerText)
|
||||
elems.push({ type: 'txt', val: currElem.innerText })
|
||||
}
|
||||
}
|
||||
i++
|
||||
|
@ -1163,8 +1168,7 @@
|
|||
{
|
||||
Q: question,
|
||||
subj: 'AVR',
|
||||
data: { type: 'simple' },
|
||||
possibleAnswers: possibleAnswers,
|
||||
data: { type: 'simple', possibleAnswers: possibleAnswers },
|
||||
},
|
||||
],
|
||||
testUrl: url,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue