mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
User specific motd changes (again)
This commit is contained in:
parent
77dbde87e8
commit
0a27b737cc
1 changed files with 16 additions and 12 deletions
|
@ -128,7 +128,7 @@
|
|||
const minMessageOpacity = 0.2
|
||||
let infoExpireTime = 60 // Every n seconds basic info should be loaded from server
|
||||
var motd = ''
|
||||
var userSpecificMotd = {}
|
||||
var userSpecificMotd = undefined
|
||||
var lastestVersion = ''
|
||||
var subjInfo
|
||||
|
||||
|
@ -1140,13 +1140,16 @@
|
|||
if (getUid() !== inf.uid) {
|
||||
setVal('userId', inf.uid)
|
||||
}
|
||||
userSpecificMotd = inf.userSpecificMotd
|
||||
subjInfo = inf.subjinfo
|
||||
setVal('userId', inf.uid)
|
||||
|
||||
userSpecificMotd = inf.userSpecificMotd
|
||||
if (userSpecificMotd) {
|
||||
overlay.querySelector('#mailButton').style.cursor = 'pointer'
|
||||
overlay.querySelector('#mailButton').innerText = userSpecificMotd.seen
|
||||
? '📭'
|
||||
: '📬'
|
||||
}
|
||||
|
||||
overlay.querySelector('#infoMainDiv').innerText = `${
|
||||
subjInfo.subjects
|
||||
} tárgy, ${subjInfo.questions} kérdés. User ID: ${getUid()}`
|
||||
|
@ -1970,7 +1973,6 @@
|
|||
mailButton.setAttribute('id', 'mailButton')
|
||||
SetStyle(mailButton, {
|
||||
fontSize: '30px',
|
||||
cursor: 'pointer',
|
||||
position: 'absolute',
|
||||
left: '0px',
|
||||
bottom: '0px',
|
||||
|
@ -1979,17 +1981,19 @@
|
|||
})
|
||||
mailButton.addEventListener('mousedown', e => {
|
||||
e.stopPropagation()
|
||||
if (!userSpecificMotd.seen) {
|
||||
if (userSpecificMotd && !userSpecificMotd.seen) {
|
||||
mailButton.innerText = '📭'
|
||||
clearAllMessages()
|
||||
ShowMessage(
|
||||
'Üzenet oldal készítéjétől (csak te látod):\n' +
|
||||
userSpecificMotd.msg
|
||||
)
|
||||
post('infos', {
|
||||
userSpecificMotdSeen: true,
|
||||
})
|
||||
}
|
||||
if (!userSpecificMotd) {
|
||||
return
|
||||
}
|
||||
clearAllMessages()
|
||||
ShowMessage(
|
||||
'Üzenet oldal készítéjétől (csak te látod):\n' + userSpecificMotd.msg
|
||||
)
|
||||
})
|
||||
|
||||
var tbl = document.createElement('table')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue