39 lines
1.2 KiB
JavaScript
39 lines
1.2 KiB
JavaScript
const loggerOfflineLogin = LoggerUtil1('%c[LoginOffline]', 'color: #000668; font-weight: bold')
|
|
|
|
const loginOfflineButton = document.getElementById('loginOfflineButton')
|
|
const loginOfflineCancelContainer = document.getElementById('loginOfflineCancelContainer')
|
|
const loginOfflineCancelButton = document.getElementById('loginOfflineCancelButton')
|
|
|
|
function loginOfflineDisabled(v){
|
|
if(loginOfflineButton.disabled !== v){
|
|
loginOfflineButton.disabled = v
|
|
}
|
|
}
|
|
|
|
function formOfflineDisabled(v){
|
|
loginOfflineDisabled(v)
|
|
loginOfflineUsername.disabled = v
|
|
}
|
|
|
|
|
|
|
|
loginOfflineButton.addEventListener('click', () => {
|
|
formOfflineDisabled(true)
|
|
AuthManager.addOfflineAccount(loginOfflineUsername.value).then((value) =>{
|
|
switchView(VIEWS.loginOffline, VIEWS.landing, 500, 500)
|
|
|
|
})
|
|
loginOfflineUsername = ''
|
|
})
|
|
|
|
loginOfflineCancelButton.addEventListener('click', () => {
|
|
if (Object.keys(ConfigManager.getAuthAccounts()).length === 0) {
|
|
loginOfflineUsername.value = ''
|
|
switchView(VIEWS.loginOffline, VIEWS.loginOptions, 500, 500)
|
|
}
|
|
else
|
|
{
|
|
loginOfflineUsername.value = ''
|
|
switchView(VIEWS.loginOffline, VIEWS.landing, 500, 500)
|
|
}
|
|
}) |