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
|
const minMessageOpacity = 0.2
|
||||||
let infoExpireTime = 60 // Every n seconds basic info should be loaded from server
|
let infoExpireTime = 60 // Every n seconds basic info should be loaded from server
|
||||||
var motd = ''
|
var motd = ''
|
||||||
var userSpecificMotd = {}
|
var userSpecificMotd = undefined
|
||||||
var lastestVersion = ''
|
var lastestVersion = ''
|
||||||
var subjInfo
|
var subjInfo
|
||||||
|
|
||||||
|
@ -1140,13 +1140,16 @@
|
||||||
if (getUid() !== inf.uid) {
|
if (getUid() !== inf.uid) {
|
||||||
setVal('userId', inf.uid)
|
setVal('userId', inf.uid)
|
||||||
}
|
}
|
||||||
userSpecificMotd = inf.userSpecificMotd
|
|
||||||
subjInfo = inf.subjinfo
|
subjInfo = inf.subjinfo
|
||||||
setVal('userId', inf.uid)
|
setVal('userId', inf.uid)
|
||||||
|
userSpecificMotd = inf.userSpecificMotd
|
||||||
|
if (userSpecificMotd) {
|
||||||
|
overlay.querySelector('#mailButton').style.cursor = 'pointer'
|
||||||
overlay.querySelector('#mailButton').innerText = userSpecificMotd.seen
|
overlay.querySelector('#mailButton').innerText = userSpecificMotd.seen
|
||||||
? '📭'
|
? '📭'
|
||||||
: '📬'
|
: '📬'
|
||||||
|
}
|
||||||
|
|
||||||
overlay.querySelector('#infoMainDiv').innerText = `${
|
overlay.querySelector('#infoMainDiv').innerText = `${
|
||||||
subjInfo.subjects
|
subjInfo.subjects
|
||||||
} tárgy, ${subjInfo.questions} kérdés. User ID: ${getUid()}`
|
} tárgy, ${subjInfo.questions} kérdés. User ID: ${getUid()}`
|
||||||
|
@ -1970,7 +1973,6 @@
|
||||||
mailButton.setAttribute('id', 'mailButton')
|
mailButton.setAttribute('id', 'mailButton')
|
||||||
SetStyle(mailButton, {
|
SetStyle(mailButton, {
|
||||||
fontSize: '30px',
|
fontSize: '30px',
|
||||||
cursor: 'pointer',
|
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
left: '0px',
|
left: '0px',
|
||||||
bottom: '0px',
|
bottom: '0px',
|
||||||
|
@ -1979,17 +1981,19 @@
|
||||||
})
|
})
|
||||||
mailButton.addEventListener('mousedown', e => {
|
mailButton.addEventListener('mousedown', e => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
if (!userSpecificMotd.seen) {
|
if (userSpecificMotd && !userSpecificMotd.seen) {
|
||||||
mailButton.innerText = '📭'
|
mailButton.innerText = '📭'
|
||||||
clearAllMessages()
|
|
||||||
ShowMessage(
|
|
||||||
'Üzenet oldal készítéjétől (csak te látod):\n' +
|
|
||||||
userSpecificMotd.msg
|
|
||||||
)
|
|
||||||
post('infos', {
|
post('infos', {
|
||||||
userSpecificMotdSeen: true,
|
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')
|
var tbl = document.createElement('table')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue