mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
Added error/stack sending, question simplifying bugfix
This commit is contained in:
parent
a445512234
commit
e53ca9d87c
1 changed files with 44 additions and 7 deletions
51
main.js
51
main.js
|
@ -189,15 +189,37 @@ class StringUtils {
|
||||||
if (!value) { return }
|
if (!value) { return }
|
||||||
|
|
||||||
let mods = [
|
let mods = [
|
||||||
this.RemoveSpecialChars,
|
this.RemoveSpecialChars.bind(this),
|
||||||
this.RemoveUnnecesarySpaces,
|
this.RemoveUnnecesarySpaces.bind(this),
|
||||||
this.QuestionPreProcessor,
|
this.QuestionPreProcessor.bind(this),
|
||||||
this.RemoveAnswerLetters
|
this.RemoveAnswerLetters.bind(this)
|
||||||
]
|
]
|
||||||
|
|
||||||
return mods.reduce((res, fn) => {
|
const reducer = (res, fn) => {
|
||||||
return fn(res)
|
return fn(res)
|
||||||
}, value)
|
}
|
||||||
|
|
||||||
|
return mods.reduce(reducer, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -834,10 +856,25 @@ function Main () {
|
||||||
m: 'Fatál error. Check console (f12). Kattints az üzenetre az összes kérdés/válaszért manuális kereséshez!',
|
m: 'Fatál error. Check console (f12). Kattints az üzenetre az összes kérdés/válaszért manuális kereséshez!',
|
||||||
isSimple: true
|
isSimple: true
|
||||||
}, undefined, function () {
|
}, undefined, function () {
|
||||||
openInTab(serverAdress + 'lred', {
|
let path = 'lred'
|
||||||
|
try {
|
||||||
|
if (e.message || e.stack) {
|
||||||
|
path += '?'
|
||||||
|
}
|
||||||
|
if (e.message) {
|
||||||
|
path += 'msg:' + SUtils.SimplifyQuery(e.message) + '&'
|
||||||
|
}
|
||||||
|
if (e.stack) {
|
||||||
|
path += 'stack:' + SUtils.SimplifyStack(e.stack)
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
Exception(e, 'error at setting error stack/msg link')
|
||||||
|
}
|
||||||
|
openInTab(serverAdress + path, {
|
||||||
active: true
|
active: true
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
Exception(e, 'script error at main:')
|
Exception(e, 'script error at main:')
|
||||||
}
|
}
|
||||||
if (url.includes('eduplayer')) { AddVideoHotkeys(url) } // adding video hotkeys
|
if (url.includes('eduplayer')) { AddVideoHotkeys(url) } // adding video hotkeys
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue