mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
Making things work on older moodle versions
This commit is contained in:
parent
a437f8f98d
commit
21aee8420c
1 changed files with 26 additions and 5 deletions
|
@ -46,7 +46,7 @@
|
||||||
// : Script header {{{
|
// : Script header {{{
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Moodle/Elearning/KMOOC test help
|
// @name Moodle/Elearning/KMOOC test help
|
||||||
// @version 2.1.0.3
|
// @version 2.1.1.0
|
||||||
// @description Online Moodle/Elearning/KMOOC test help
|
// @description Online Moodle/Elearning/KMOOC test help
|
||||||
// @author MrFry
|
// @author MrFry
|
||||||
// @match https://elearning.uni-obuda.hu/*
|
// @match https://elearning.uni-obuda.hu/*
|
||||||
|
@ -403,10 +403,16 @@
|
||||||
// TODO: dropdown in question
|
// TODO: dropdown in question
|
||||||
// TODO: get possible answers too
|
// TODO: get possible answers too
|
||||||
const promises = []
|
const promises = []
|
||||||
const questionNodes = Array.from(
|
let questionNodes = Array.from(
|
||||||
document.getElementsByTagName('form')[0].childNodes[0].childNodes
|
document.getElementsByTagName('form')[0].childNodes[0].childNodes
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (questionNodes.length === 0) {
|
||||||
|
questionNodes = Array.from(
|
||||||
|
document.getElementsByTagName('form')[1].childNodes[0].childNodes
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
let i = 0
|
let i = 0
|
||||||
while (
|
while (
|
||||||
i < questionNodes.length &&
|
i < questionNodes.length &&
|
||||||
|
@ -599,9 +605,14 @@
|
||||||
function getQuiz() {
|
function getQuiz() {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
const promises = []
|
const promises = []
|
||||||
const questionNodes = Array.from(
|
let questionNodes = Array.from(
|
||||||
document.getElementsByTagName('form')[0].childNodes[0].childNodes
|
document.getElementsByTagName('form')[0].childNodes[0].childNodes
|
||||||
)
|
)
|
||||||
|
if (questionNodes.length === 0) {
|
||||||
|
questionNodes = Array.from(
|
||||||
|
document.getElementsByTagName('form')[1].childNodes[0].childNodes
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
let i = 0
|
let i = 0
|
||||||
while (i < questionNodes.length && questionNodes[i].tagName === 'DIV') {
|
while (i < questionNodes.length && questionNodes[i].tagName === 'DIV') {
|
||||||
|
@ -1370,6 +1381,12 @@
|
||||||
answer.detailedMatch.qdb,
|
answer.detailedMatch.qdb,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
m: 'Erre a kérdésre nincs találat :c',
|
||||||
|
},
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1887,7 +1904,9 @@
|
||||||
|
|
||||||
const SetQuestionText = () => {
|
const SetQuestionText = () => {
|
||||||
const relevantQuestion = GetRelevantQuestion()
|
const relevantQuestion = GetRelevantQuestion()
|
||||||
|
if (relevantQuestion.header) {
|
||||||
headerText.innerText = relevantQuestion.header
|
headerText.innerText = relevantQuestion.header
|
||||||
|
}
|
||||||
questionTextElement.innerText = relevantQuestion.m
|
questionTextElement.innerText = relevantQuestion.m
|
||||||
|
|
||||||
if (currItem === 0 && currRelevantQuestion === 0) {
|
if (currItem === 0 && currRelevantQuestion === 0) {
|
||||||
|
@ -1896,8 +1915,10 @@
|
||||||
numberTextBox.innerText =
|
numberTextBox.innerText =
|
||||||
currItem + 1 + './' + (currRelevantQuestion + 1) + '.'
|
currItem + 1 + './' + (currRelevantQuestion + 1) + '.'
|
||||||
}
|
}
|
||||||
|
if (relevantQuestion.p) {
|
||||||
percentTextBox.innerText = relevantQuestion.p + '%'
|
percentTextBox.innerText = relevantQuestion.p + '%'
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const buttonStyle = {
|
const buttonStyle = {
|
||||||
color: 'white',
|
color: 'white',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue