diff --git a/stable.user.js b/stable.user.js index d07c281..9493a70 100755 --- a/stable.user.js +++ b/stable.user.js @@ -46,7 +46,7 @@ // : Script header {{{ // ==UserScript== // @name Moodle/Elearning/KMOOC test help -// @version 2.1.3.6 +// @version 2.1.3.7 // @description Online Moodle/Elearning/KMOOC test help // @author MrFry // @match https://elearning.uni-obuda.hu/* @@ -120,7 +120,7 @@ const forcedMatchString = isDevel ? 'default' : null // only one of these should be true for testing const forceTestPage = isDevel && false - const forceResultPage = isDevel && true + const forceResultPage = isDevel && false const forceDefaultPage = isDevel && false // ------------------------------------------------------------------------------ @@ -132,7 +132,7 @@ let serverAdress = 'https://qmining.frylabs.net/' let apiAdress = 'https://api.frylabs.net/' - const motdShowCount = 3 /* Ammount of times to show motd */ + const motdShowCount = 5 /* Ammount of times to show motd */ const messageOpacityDelta = 0.1 const minMessageOpacity = 0.2 let infoExpireTime = 60 * 5 // Every n seconds basic info should be loaded from server @@ -1700,10 +1700,22 @@ // : UI handling {{{ + function isNewDay() { + const now = new Date() + const lastLoad = getVal('lastLoadDate') + + if (new Date(lastLoad).getDay() !== now.getDay()) { + setVal('lastLoadDate', now.toString()) + return true + } + + return false + } + function shouldShowMotd() { if (!emptyOrWhiteSpace(motd)) { var prevmotd = getVal('motd') - if (prevmotd !== motd) { + if (prevmotd !== motd || isNewDay()) { setVal('motdcount', motdShowCount) setVal('motd', motd) return true