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 {{{
|
||||
// ==UserScript==
|
||||
// @name Moodle/Elearning/KMOOC test help
|
||||
// @version 2.1.0.3
|
||||
// @version 2.1.1.0
|
||||
// @description Online Moodle/Elearning/KMOOC test help
|
||||
// @author MrFry
|
||||
// @match https://elearning.uni-obuda.hu/*
|
||||
|
@ -403,10 +403,16 @@
|
|||
// TODO: dropdown in question
|
||||
// TODO: get possible answers too
|
||||
const promises = []
|
||||
const questionNodes = Array.from(
|
||||
let questionNodes = Array.from(
|
||||
document.getElementsByTagName('form')[0].childNodes[0].childNodes
|
||||
)
|
||||
|
||||
if (questionNodes.length === 0) {
|
||||
questionNodes = Array.from(
|
||||
document.getElementsByTagName('form')[1].childNodes[0].childNodes
|
||||
)
|
||||
}
|
||||
|
||||
let i = 0
|
||||
while (
|
||||
i < questionNodes.length &&
|
||||
|
@ -599,9 +605,14 @@
|
|||
function getQuiz() {
|
||||
return new Promise(resolve => {
|
||||
const promises = []
|
||||
const questionNodes = Array.from(
|
||||
let questionNodes = Array.from(
|
||||
document.getElementsByTagName('form')[0].childNodes[0].childNodes
|
||||
)
|
||||
if (questionNodes.length === 0) {
|
||||
questionNodes = Array.from(
|
||||
document.getElementsByTagName('form')[1].childNodes[0].childNodes
|
||||
)
|
||||
}
|
||||
|
||||
let i = 0
|
||||
while (i < questionNodes.length && questionNodes[i].tagName === 'DIV') {
|
||||
|
@ -1370,6 +1381,12 @@
|
|||
answer.detailedMatch.qdb,
|
||||
}
|
||||
})
|
||||
} else {
|
||||
return [
|
||||
{
|
||||
m: 'Erre a kérdésre nincs találat :c',
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1887,7 +1904,9 @@
|
|||
|
||||
const SetQuestionText = () => {
|
||||
const relevantQuestion = GetRelevantQuestion()
|
||||
if (relevantQuestion.header) {
|
||||
headerText.innerText = relevantQuestion.header
|
||||
}
|
||||
questionTextElement.innerText = relevantQuestion.m
|
||||
|
||||
if (currItem === 0 && currRelevantQuestion === 0) {
|
||||
|
@ -1896,8 +1915,10 @@
|
|||
numberTextBox.innerText =
|
||||
currItem + 1 + './' + (currRelevantQuestion + 1) + '.'
|
||||
}
|
||||
if (relevantQuestion.p) {
|
||||
percentTextBox.innerText = relevantQuestion.p + '%'
|
||||
}
|
||||
}
|
||||
|
||||
const buttonStyle = {
|
||||
color: 'white',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue