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:
26
main.js
26
main.js
@@ -221,23 +221,7 @@ class StringUtils {
|
||||
}
|
||||
|
||||
SimplifyStack (stack) {
|
||||
stack = 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
|
||||
return this.SimplifyQuery(stack)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,7 +247,7 @@ class Question {
|
||||
}
|
||||
|
||||
HasImage () {
|
||||
return this.I !== undefined
|
||||
return this.I !== undefined && (typeof this.I === 'string' || Array.isArray(this.I))
|
||||
}
|
||||
|
||||
IsComplete () {
|
||||
@@ -550,8 +534,10 @@ class QuestionsPageModell {
|
||||
Log('Some error with images')
|
||||
}
|
||||
|
||||
questions = questions.map((item, ind) => {
|
||||
return SUtils.ReplaceCharsWithSpace(item, '\n')
|
||||
questions = questions.map((item) => {
|
||||
if (item) {
|
||||
return SUtils.ReplaceCharsWithSpace(item, '\n')
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user