mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
showing peer selector on login, minor login improvements
This commit is contained in:
parent
9220466561
commit
2ee9731fdf
1 changed files with 37 additions and 30 deletions
|
@ -198,6 +198,7 @@
|
|||
donate: 'Donate',
|
||||
retry: 'Újra',
|
||||
invalidPW: 'Hibás jelszó: ',
|
||||
loggingIn: 'Belépés ...',
|
||||
connecting: 'Csatlakozás: ',
|
||||
connect: 'Csatlakozás',
|
||||
login: 'Belépés',
|
||||
|
@ -1653,6 +1654,9 @@
|
|||
}
|
||||
|
||||
function Auth(pw) {
|
||||
SafeGetElementById('infoMainDiv', (elem) => {
|
||||
elem.innerText = texts.loggingIn
|
||||
})
|
||||
post('login', { pw: pw, script: true }).then((res) => {
|
||||
if (res.result === 'success') {
|
||||
infoExpireTime = -1
|
||||
|
@ -1844,6 +1848,9 @@
|
|||
SafeGetElementById('loginDiv', (elem) => {
|
||||
elem.style.display = 'flex'
|
||||
})
|
||||
SafeGetElementById('peerSelector', (elem) => {
|
||||
elem.style.display = ''
|
||||
})
|
||||
}
|
||||
|
||||
function addNewHost() {
|
||||
|
@ -2734,6 +2741,36 @@
|
|||
textAlign: 'center',
|
||||
},
|
||||
},
|
||||
loginContainer: {
|
||||
id: 'loginDiv',
|
||||
style: {
|
||||
display: 'none',
|
||||
},
|
||||
children: {
|
||||
loginInput: {
|
||||
customElem: () => {
|
||||
const loginInput = document.createElement('input')
|
||||
loginInput.setAttribute('id', 'pwInput')
|
||||
loginInput.type = 'text'
|
||||
loginInput.placeholder = texts.pwHere
|
||||
SetStyle(loginInput, {
|
||||
width: '100%',
|
||||
textAlign: 'center',
|
||||
})
|
||||
return loginInput
|
||||
},
|
||||
},
|
||||
loginButton: {
|
||||
innerText: texts.login,
|
||||
style: buttonStyle,
|
||||
onClick: () => {
|
||||
SafeGetElementById('pwInput', (elem) => {
|
||||
Auth(elem.value.trim())
|
||||
})
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
peerSelector: {
|
||||
customElem: () => {
|
||||
try {
|
||||
|
@ -2782,36 +2819,6 @@
|
|||
}
|
||||
},
|
||||
},
|
||||
loginContainer: {
|
||||
id: 'loginDiv',
|
||||
style: {
|
||||
display: 'none',
|
||||
},
|
||||
children: {
|
||||
loginInput: {
|
||||
customElem: () => {
|
||||
const loginInput = document.createElement('input')
|
||||
loginInput.setAttribute('id', 'pwInput')
|
||||
loginInput.type = 'text'
|
||||
loginInput.placeholder = texts.pwHere
|
||||
SetStyle(loginInput, {
|
||||
width: '100%',
|
||||
textAlign: 'center',
|
||||
})
|
||||
return loginInput
|
||||
},
|
||||
},
|
||||
loginButton: {
|
||||
innerText: texts.login,
|
||||
style: buttonStyle,
|
||||
onClick: () => {
|
||||
SafeGetElementById('pwInput', (elem) => {
|
||||
Auth(elem.value)
|
||||
})
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
hostInputContainer: {
|
||||
id: 'hostInputContainer',
|
||||
style: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue