mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
Stack simplification removing, more precise HasImage checking, Question getting small fix
This commit is contained in:
parent
304e2d6651
commit
f34449c960
3 changed files with 14 additions and 42 deletions
2
frame.js
2
frame.js
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Moodle/Elearning/KMOOC test help
|
// @name Moodle/Elearning/KMOOC test help
|
||||||
// @version 1.6.4.0
|
// @version 1.6.4.1
|
||||||
// @description Online Moodle/Elearning/KMOOC test help
|
// @description Online Moodle/Elearning/KMOOC test help
|
||||||
// @author MrFry
|
// @author MrFry
|
||||||
// @match https://elearning.uni-obuda.hu/main/*
|
// @match https://elearning.uni-obuda.hu/main/*
|
||||||
|
|
26
main.js
26
main.js
|
@ -221,23 +221,7 @@ class StringUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
SimplifyStack (stack) {
|
SimplifyStack (stack) {
|
||||||
stack = this.SimplifyQuery(stack)
|
return this.SimplifyQuery(stack)
|
||||||
let ns = ''
|
|
||||||
let adding = true
|
|
||||||
stack.split('').forEach((c) => {
|
|
||||||
if (c === '(') {
|
|
||||||
adding = false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (adding) {
|
|
||||||
ns += c
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c === ')') {
|
|
||||||
adding = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return ns
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +247,7 @@ class Question {
|
||||||
}
|
}
|
||||||
|
|
||||||
HasImage () {
|
HasImage () {
|
||||||
return this.I !== undefined
|
return this.I !== undefined && (typeof this.I === 'string' || Array.isArray(this.I))
|
||||||
}
|
}
|
||||||
|
|
||||||
IsComplete () {
|
IsComplete () {
|
||||||
|
@ -550,8 +534,10 @@ class QuestionsPageModell {
|
||||||
Log('Some error with images')
|
Log('Some error with images')
|
||||||
}
|
}
|
||||||
|
|
||||||
questions = questions.map((item, ind) => {
|
questions = questions.map((item) => {
|
||||||
return SUtils.ReplaceCharsWithSpace(item, '\n')
|
if (item) {
|
||||||
|
return SUtils.ReplaceCharsWithSpace(item, '\n')
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
28
stable.js
28
stable.js
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Moodle/Elearning/KMOOC test help
|
// @name Moodle/Elearning/KMOOC test help
|
||||||
// @version 1.6.4.0
|
// @version 1.6.4.1
|
||||||
// @description Online Moodle/Elearning/KMOOC test help
|
// @description Online Moodle/Elearning/KMOOC test help
|
||||||
// @author MrFry
|
// @author MrFry
|
||||||
// @match https://elearning.uni-obuda.hu/main/*
|
// @match https://elearning.uni-obuda.hu/main/*
|
||||||
|
@ -239,23 +239,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
SimplifyStack (stack) {
|
SimplifyStack (stack) {
|
||||||
stack = this.SimplifyQuery(stack)
|
return this.SimplifyQuery(stack)
|
||||||
let ns = ''
|
|
||||||
let adding = true
|
|
||||||
stack.split('').forEach((c) => {
|
|
||||||
if (c === '(') {
|
|
||||||
adding = false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (adding) {
|
|
||||||
ns += c
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c === ')') {
|
|
||||||
adding = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return ns
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,7 +265,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
HasImage () {
|
HasImage () {
|
||||||
return this.I !== undefined
|
return this.I !== undefined && (typeof this.I === 'string' || Array.isArray(this.I))
|
||||||
}
|
}
|
||||||
|
|
||||||
IsComplete () {
|
IsComplete () {
|
||||||
|
@ -568,8 +552,10 @@
|
||||||
Log('Some error with images')
|
Log('Some error with images')
|
||||||
}
|
}
|
||||||
|
|
||||||
questions = questions.map((item, ind) => {
|
questions = questions.map((item) => {
|
||||||
return SUtils.ReplaceCharsWithSpace(item, '\n')
|
if (item) {
|
||||||
|
return SUtils.ReplaceCharsWithSpace(item, '\n')
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue