mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
Added user specific motd support
This commit is contained in:
parent
389e64e1ee
commit
146e352411
1 changed files with 15 additions and 4 deletions
|
@ -21,7 +21,7 @@
|
|||
|
||||
// ==UserScript==
|
||||
// @name Moodle/Elearning/KMOOC test help
|
||||
// @version 2.0.1.14
|
||||
// @version 2.0.1.15
|
||||
// @description Online Moodle/Elearning/KMOOC test help
|
||||
// @author MrFry
|
||||
// @match https://elearning.uni-obuda.hu/main/*
|
||||
|
@ -93,10 +93,11 @@
|
|||
const motdShowCount = 3 /* Ammount of times to show motd */
|
||||
let infoExpireTime = 60 // Every n seconds basic info should be loaded from server
|
||||
var motd = ''
|
||||
var userSpecificMotd = ''
|
||||
var lastestVersion = ''
|
||||
var subjInfo
|
||||
|
||||
// setVal('ISDEVEL', true)
|
||||
setVal('ISDEVEL', false)
|
||||
|
||||
if (getVal('ISDEVEL')) {
|
||||
console.log('Moodle script running in developement mode!')
|
||||
|
@ -1159,6 +1160,7 @@
|
|||
}
|
||||
lastestVersion = inf.version
|
||||
motd = inf.motd
|
||||
userSpecificMotd = inf.userSpecificMotd
|
||||
subjInfo = inf.subjinfo
|
||||
overlay.querySelector(
|
||||
'#infoMainDiv'
|
||||
|
@ -1260,12 +1262,14 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
const showUserSpecificMOTD = !!userSpecificMotd
|
||||
|
||||
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) {
|
||||
if (isNewVersionAvaible || newVersion || showMOTD || showUserSpecificMOTD) {
|
||||
greetMsg =
|
||||
'Moodle/Elearning/KMOOC segéd v. ' + info().script.version + '. '
|
||||
}
|
||||
|
@ -1287,6 +1291,10 @@
|
|||
greetMsg += '\nMOTD:\n' + motd
|
||||
timeout = null
|
||||
}
|
||||
if (showUserSpecificMOTD) {
|
||||
greetMsg += '\nFelhasználó MOTD (ezt csak te látod):\n' + userSpecificMotd
|
||||
timeout = null
|
||||
}
|
||||
|
||||
ShowMessage(
|
||||
{
|
||||
|
@ -1787,6 +1795,10 @@
|
|||
simpleMessageParagrapg.appendChild(mesageNode)
|
||||
mesageNode.style.margin = defMargin // fancy margin
|
||||
|
||||
Array.from(mesageNode.getElementsByTagName('a')).forEach(anchorElem => {
|
||||
anchorElem.style.color = 'lightblue'
|
||||
})
|
||||
|
||||
mainDiv.appendChild(simpleMessageParagrapg) // adding text box to main div
|
||||
} else {
|
||||
// if its a fucking complicated message
|
||||
|
@ -2103,7 +2115,6 @@
|
|||
SetStyle(loginButton, buttonStyle)
|
||||
|
||||
loginInput.addEventListener('keyup', e => {
|
||||
console.log(e.target.value)
|
||||
if (e.target.value === clientId) {
|
||||
loginButton.innerText = texts.requestPWInsteadOfLogin
|
||||
} else if (e.target.value !== '') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue