mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
Info getting only every x seconds fix if server is not avaible, removed unnecesarry logging
This commit is contained in:
parent
bf2b44ee56
commit
bbb0cfbf3a
1 changed files with 4 additions and 5 deletions
|
@ -21,7 +21,7 @@
|
|||
|
||||
// ==UserScript==
|
||||
// @name Moodle/Elearning/KMOOC test help
|
||||
// @version 2.0.0.5
|
||||
// @version 2.0.0.6
|
||||
// @description Online Moodle/Elearning/KMOOC test help
|
||||
// @author MrFry
|
||||
// @match https://elearning.uni-obuda.hu/main/*
|
||||
|
@ -60,8 +60,9 @@
|
|||
|
||||
var addEventListener // add event listener function
|
||||
const serverAdress = 'https://qmining.frylabs.net/'
|
||||
const apiAdress = 'https://api.frylabs.net/'
|
||||
// const serverAdress = 'http://localhost:8080/'
|
||||
const apiAdress = 'https://api.frylabs.net/'
|
||||
// const apiAdress = 'http://localhost:8080/'
|
||||
const ircAddress = 'https://kiwiirc.com/nextclient/irc.sub.fm/#qmining'
|
||||
|
||||
// forcing pages for testing. unless you test, do not set these to true!
|
||||
|
@ -1621,14 +1622,13 @@
|
|||
}
|
||||
|
||||
if (now > lastCheck + (infoExpireTime * 1000)) {
|
||||
console.log('GETTING DATA FROM SREVER')
|
||||
setVal('lastInfoCheckTime', now)
|
||||
return new Promise((resolve, reject) => {
|
||||
xmlhttpRequest({
|
||||
method: 'GET',
|
||||
url: apiAdress + 'infos?version=true&motd=true&subjinfo=true&cversion=' + info().script.version,
|
||||
onload: function (response) {
|
||||
try {
|
||||
setVal('lastInfoCheckTime', now)
|
||||
const res = JSON.parse(response.responseText)
|
||||
setVal('lastInfo', response.responseText)
|
||||
resolve(res)
|
||||
|
@ -1645,7 +1645,6 @@
|
|||
})
|
||||
})
|
||||
} else {
|
||||
console.log('USING OLD')
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
resolve(JSON.parse(getVal('lastInfo')))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue