diff --git a/stable.user.js b/stable.user.js index e6a09cf..5270a20 100755 --- a/stable.user.js +++ b/stable.user.js @@ -57,13 +57,13 @@ /* eslint-enable */ var addEventListener // add event listener function - // const serverAdress = 'https://qmining.frylabs.net/' - const serverAdress = 'http://localhost:8080/' + const serverAdress = 'https://qmining.frylabs.net/' + // const serverAdress = 'http://localhost:8080/' // forcing pages for testing. unless you test, do not set these to true! // only one of these should be true for testing const forceTestPage = false - const forceResultPage = true + const forceResultPage = false const forceDefaultPage = false const logElementGetting = false const log = true @@ -746,23 +746,12 @@ } catch (e) { Log('Some weird error trying to set new verison') } - var greetMsg = '' // message to show at the end - var timeout = null // the timeout. if null, it wont be hidden - if (lastestVersion !== undefined && info().script.version !== lastestVersion) { - timeout = 5 - greetMsg = 'Moodle/Elearning/KMOOC segéd v. ' + info().script.version + '. ' - greetMsg += 'Új verzió elérhető: ' + lastestVersion - timeout = undefined - } - if (newVersion) { // -------------------------------------------------------------------------------------------------------------- - greetMsg = 'Moodle/Elearning/KMOOC segéd v. ' + info().script.version + '. Verzió frissítve ' + info().script.version + '-re. Changelog:\n' + texts.lastChangeLog - setVal('lastVerson', info().script.version) // setting lastVersion - } + + let showMOTD = false if (!SUtils.EmptyOrWhiteSpace(motd)) { var prevmotd = getVal('motd') if (prevmotd !== motd) { - greetMsg += '\nMOTD:\n' + motd - timeout = null + showMOTD = true setVal('motdcount', motdShowCount) setVal('motd', motd) } else { @@ -774,12 +763,32 @@ motdcount-- if (motdcount > 0) { - greetMsg += '\nMOTD:\n' + motd - timeout = null + showMOTD = true setVal('motdcount', motdcount) } } } + let isNewVersionAvaible = lastestVersion !== undefined && info().script.version !== lastestVersion + var greetMsg = '' // message to show at the end + var timeout = null // the timeout. if null, it wont be hidden + + if (isNewVersionAvaible || newVersion || showMOTD) { + greetMsg = 'Moodle/Elearning/KMOOC segéd v. ' + info().script.version + '. ' + } + if (isNewVersionAvaible) { + timeout = 5 + greetMsg += 'Új verzió elérhető: ' + lastestVersion + timeout = undefined + } + if (newVersion) { // -------------------------------------------------------------------------------------------------------------- + greetMsg += 'Verzió frissítve ' + info().script.version + '-re. Changelog:\n' + texts.lastChangeLog + setVal('lastVerson', info().script.version) // setting lastVersion + } + if (showMOTD) { + greetMsg += '\nMOTD:\n' + motd + timeout = null + } + ShowMessage({ m: greetMsg, isSimple: true