mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
Merge branch 'JSON_Post'
This commit is contained in:
commit
cc8de2e15f
1 changed files with 11 additions and 4 deletions
|
@ -1019,7 +1019,7 @@
|
|||
sentData.id = GetId()
|
||||
sentData.quiz = quiz
|
||||
console.log('SENT DATA', sentData)
|
||||
SendXHRMessage('datatoadd=' + JSON.stringify(sentData)).then((res) => {
|
||||
SendXHRMessage(JSON.stringify(sentData)).then((res) => {
|
||||
next(res.success, sentData, res.newQuestions)
|
||||
})
|
||||
} catch (e) {
|
||||
|
@ -1623,9 +1623,14 @@
|
|||
|
||||
if (now > lastCheck + (infoExpireTime * 1000)) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const url = apiAdress +
|
||||
'infos?version=true&motd=true&subjinfo=true&cversion=' +
|
||||
info().script.version +
|
||||
'&cid=' + GetId()
|
||||
|
||||
xmlhttpRequest({
|
||||
method: 'GET',
|
||||
url: apiAdress + 'infos?version=true&motd=true&subjinfo=true&cversion=' + info().script.version,
|
||||
url: url,
|
||||
onload: function (response) {
|
||||
try {
|
||||
setVal('lastInfoCheckTime', now)
|
||||
|
@ -1668,7 +1673,9 @@
|
|||
}
|
||||
params.push(key + '=' + encodeURIComponent(val))
|
||||
})
|
||||
url += params.join('&')
|
||||
url += params.join('&') +
|
||||
'&cversion=' + info().script.version +
|
||||
'&cid=' + GetId()
|
||||
|
||||
xmlhttpRequest({
|
||||
method: 'GET',
|
||||
|
@ -1712,7 +1719,7 @@
|
|||
url: url,
|
||||
data: message,
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
onerror: function (e) {
|
||||
Log('Data send error', e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue