diff --git a/stable.user.js b/stable.user.js
index 1173fe3..3722cd9 100755
--- a/stable.user.js
+++ b/stable.user.js
@@ -84,21 +84,22 @@
// forcing pages for testing. unless you test, do not set these to true!
// only one of these should be true for testing
+ setVal('ISDEVEL', false)
const forceTestPage = false
- const forceResultPage = false
+ const forceResultPage = false
const forceDefaultPage = false
const logElementGetting = false
const log = true
const motdShowCount = 3 /* Ammount of times to show motd */
let infoExpireTime = 60 // Every n seconds basic info should be loaded from server
+ var uid = 0
+ var cid = 0
var motd = ''
var userSpecificMotd = ''
var lastestVersion = ''
var subjInfo
- setVal('ISDEVEL', false)
-
if (getVal('ISDEVEL')) {
console.log('Moodle script running in developement mode!')
infoExpireTime = 1
@@ -111,7 +112,7 @@
fatalError:
'Fatál error. Check console (f12). Kattints az üzenetre az összes kérdés/válaszért manuális kereséshez!',
consoleErrorInfo:
- 'Itteni hibák 100% a moodle hiba. Kivéve, ha oda van írva hogy script error ;) Ha ilyesmi szerepel itt, akkor olvasd el a segítség szekciót!',
+ 'Itteni hibák 100% a moodle hiba. Kivéve, ha oda van írva hogy script error ;) Ha ilyesmi szerepel itt, akkor olvasd el a segítség szekciót! https://qmining.frylabs.net/manual?scriptcmd',
freshStartWarning:
'
Moodle teszt userscript:1.5.0 verzió: a script mostantól XMLHTTP kéréseket küld szerver fele! Erre a userscript futtató kiegészítőd is figyelmeztetni fog! Ha ez történik, a script rendes működése érdekében engedélyezd (Always allow domain)! Ha nem akarod, hogy ez történjen, akkor ne engedélyezd, vagy a menüben válaszd ki a "helyi fájl használata" opciót!
Elküldött adatok: minden teszt után a kérdés-válasz páros. Fogadott adatok: Az összes eddig ismert kérdés. Érdemes help-et elolvasni!!!
Ez az ablak frissités után eltűnik. Ha nem, akkor a visza gombbal próbálkozz.
',
noResult:
@@ -574,6 +575,13 @@
}
}
+ getAsd() {
+ const a = document.getElementsByClassName('generalfeedback')
+ if (a.length > 0) {
+ return a[0].innerText
+ }
+ }
+
GetCurrentAnswer(i) {
if (logElementGetting) {
Log('getting curr answer by index: ' + i)
@@ -757,6 +765,14 @@
GetRightAnswerFromResult(i) {
var fun = []
+ // Ugrás... fix: textarea-ban kell válaszolni
+ // TODO
+ // fun.push(i => {
+ // const a = RPM.getAsd()
+ // console.log(a)
+ // return a
+ // })
+
// "húzza oda ..." skip
fun.push(i => {
let temp = RPM.GetAnswersFromGrabBox(i)
@@ -1162,9 +1178,11 @@
motd = inf.motd
userSpecificMotd = inf.userSpecificMotd
subjInfo = inf.subjinfo
+ uid = inf.uid
+ cid = getVal('clientId')
overlay.querySelector(
'#infoMainDiv'
- ).innerText = `${subjInfo.subjects} tárgy, ${subjInfo.questions} kérdés. Felh #${inf.uid}`
+ ).innerText = `${subjInfo.subjects} tárgy, ${subjInfo.questions} kérdés. Felh #${uid}`
// FIXME: if cwith() throws an unhandled error it sais server is not avaible
cwith()
})
@@ -1328,7 +1346,6 @@
)
})
- // FIXME: promise.all promise resolve order same as original?
Promise.all(promises).then(res => {
let answers = []
@@ -1391,7 +1408,9 @@
function() {
OpenErrorPage({
message: 'No result found',
- stack: JSON.stringify(question),
+ question: Array.isArray(question)
+ ? question[0].replace(/"/g, '').replace(/:/g, '')
+ : question,
})
}
)
@@ -2367,24 +2386,20 @@
}
function OpenErrorPage(e) {
- let path = 'lred'
+ const queries = []
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)
- }
- path += '___version:' + info().script.version
- path = SUtils.RemoveSpecialChars(path)
+ Object.keys(e).forEach(key => {
+ if (e[key]) {
+ queries.push(`${key}=${encodeURIComponent(e[key])}`)
+ }
+ })
+ queries.push('version=' + encodeURIComponent(info().script.version))
+ queries.push('uid=' + encodeURIComponent(uid))
+ queries.push('cid=' + encodeURIComponent(cid))
} catch (e) {
Exception(e, 'error at setting error stack/msg link')
}
- path = path.replace(/ /g, '_')
- openInTab(serverAdress + path, {
+ openInTab(serverAdress + 'lred?' + queries.join('&'), {
active: true,
})
}