mirror of
https://github.com/dscalzi/HeliosLauncher.git
synced 2024-10-31 19:36:39 -07:00
50 lines
1.6 KiB
JavaScript
50 lines
1.6 KiB
JavaScript
|
const loginOptionsCancelContainer = document.getElementById('loginOptionCancelContainer')
|
||
|
const loginOptionMicrosoft = document.getElementById('loginOptionMicrosoft')
|
||
|
const loginOptionMojang = document.getElementById('loginOptionMojang')
|
||
|
const loginOptionsCancelButton = document.getElementById('loginOptionCancelButton')
|
||
|
|
||
|
let loginOptionsCancellable = false
|
||
|
|
||
|
let loginOptionsViewOnLoginSuccess
|
||
|
let loginOptionsViewOnLoginCancel
|
||
|
let loginOptionsViewOnCancel
|
||
|
let loginOptionsViewCancelHandler
|
||
|
|
||
|
function loginOptionsCancelEnabled(val){
|
||
|
if(val){
|
||
|
$(loginOptionsCancelContainer).show()
|
||
|
} else {
|
||
|
$(loginOptionsCancelContainer).hide()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
loginOptionMicrosoft.onclick = (e) => {
|
||
|
switchView(getCurrentView(), VIEWS.waiting, 500, 500, () => {
|
||
|
ipcRenderer.send(
|
||
|
MSFT_OPCODE.OPEN_LOGIN,
|
||
|
loginOptionsViewOnLoginSuccess,
|
||
|
loginOptionsViewOnLoginCancel
|
||
|
)
|
||
|
})
|
||
|
}
|
||
|
|
||
|
loginOptionMojang.onclick = (e) => {
|
||
|
switchView(getCurrentView(), VIEWS.login, 500, 500, () => {
|
||
|
loginViewOnSuccess = loginOptionsViewOnLoginSuccess
|
||
|
loginViewOnCancel = loginOptionsViewOnLoginCancel
|
||
|
loginCancelEnabled(true)
|
||
|
})
|
||
|
}
|
||
|
|
||
|
loginOptionsCancelButton.onclick = (e) => {
|
||
|
switchView(getCurrentView(), loginOptionsViewOnCancel, 500, 500, () => {
|
||
|
// Clear login values (Mojang login)
|
||
|
// No cleanup needed for Microsoft.
|
||
|
loginUsername.value = ''
|
||
|
loginPassword.value = ''
|
||
|
if(loginOptionsViewCancelHandler != null){
|
||
|
loginOptionsViewCancelHandler()
|
||
|
loginOptionsViewCancelHandler = null
|
||
|
}
|
||
|
})
|
||
|
}
|