Back cancel button on offline login view

This commit is contained in:
cyber-dream 2022-08-04 06:03:54 +03:00
parent cd757112b3
commit 960214efdf
3 changed files with 96 additions and 14 deletions

View File

@ -450,6 +450,79 @@ body, button {
transition: 0.25s ease; transition: 0.25s ease;
} }
/* loginOffline cancel button styles. */
#loginOfflineCancelContainer {
position: absolute;
top: 5%;
right: 5%;
}
/* loginOffline cancel button styles. */
#loginOfflineCancelButton {
background: none;
border: none;
outline: none;
cursor: pointer;
transition: 0.25s ease;
}
#loginOfflineCancelButton:hover #loginOfflineCancelIcon,
#loginOfflineCancelButton:hover #loginOfflineCancelText,
#loginOfflineCancelButton:focus #loginOfflineCancelIcon,
#loginOfflineCancelButton:focus #loginOfflineCancelText {
text-shadow: 0px 0px 20px white;
}
#loginOfflineCancelButton:hover #loginOfflineCancelIcon,
#loginOfflineCancelButton:focus #loginOfflineCancelIcon {
box-shadow: 0px 0px 20px white;
}
#loginOfflineCancelButton:active #loginOfflineCancelIcon,
#loginOfflineCancelButton:active #loginOfflineCancelText {
text-shadow: 0px 0px 20px rgba(255, 255, 255, 0.75);
color: rgba(255, 255, 255, 0.75);
border-color: rgba(255, 255, 255, 0.75);
}
#loginOfflineCancelButton:active #loginOfflineCancelIcon {
box-shadow: 0px 0px 20px rgba(255, 255, 255, 0.75);
}
#loginOfflineCancelButton:disabled {
pointer-events: none;
}
#loginOfflineCancelButton:disabled #loginOfflineCancelIcon,
#loginOfflineCancelButton:disabled #loginOfflineCancelText {
color: rgba(255, 255, 255, 0.75);
border-color: rgba(255, 255, 255, 0.75);
}
/* The X in a circle icon for the cancel button. */
#loginOfflineCancelIcon {
border-radius: 50%;
border: 1px solid white;
box-sizing: border-box;
height: 30px;
width: 30px;
font-size: 19px;
line-height: 30px;
margin: 0 auto;
margin-bottom: 5px;
transition: 0.25s ease;
}
/* Text for the loginOffline cancel button. */
#loginOfflineCancelText {
font-size: 15px;
transition: 0.25s ease;
}
/* Login content wrapper. */ /* Login content wrapper. */
#loginContent { #loginContent {
display: flex; display: flex;

View File

@ -1,6 +1,8 @@
const loggerOfflineLogin = LoggerUtil1('%c[LoginOffline]', 'color: #000668; font-weight: bold') const loggerOfflineLogin = LoggerUtil1('%c[LoginOffline]', 'color: #000668; font-weight: bold')
const loginOfflineButton = document.getElementById('loginOfflineButton') const loginOfflineButton = document.getElementById('loginOfflineButton')
const loginOfflineCancelContainer = document.getElementById('loginOfflineCancelContainer')
const loginOfflineCancelButton = document.getElementById('loginOfflineCancelButton')
function loginOfflineDisabled(v){ function loginOfflineDisabled(v){
if(loginOfflineButton.disabled !== v){ if(loginOfflineButton.disabled !== v){
@ -10,21 +12,28 @@ function loginOfflineDisabled(v){
function formOfflineDisabled(v){ function formOfflineDisabled(v){
loginOfflineDisabled(v) loginOfflineDisabled(v)
//loginCancelButton.disabled = v
loginOfflineUsername.disabled = v loginOfflineUsername.disabled = v
/*loginPassword.disabled = v
if(v){
checkmarkContainer.setAttribute('disabled', v)
} else {
checkmarkContainer.removeAttribute('disabled')
}
loginRememberOption.disabled = v*/
} }
loginOfflineButton.addEventListener('click', () => {
loginOfflineButton.addEventListener('click', () => {
formOfflineDisabled(true) formOfflineDisabled(true)
AuthManager.addOfflineAccount(loginOfflineUsername.value).then((value) =>{ AuthManager.addOfflineAccount(loginOfflineUsername.value).then((value) =>{
switchView(VIEWS.loginOffline, VIEWS.landing, 500, 500) 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)
}
}) })

View File

@ -1,8 +1,8 @@
<div id="loginOfflineContainer" style="display: none;"> <div id="loginOfflineContainer" style="display: none;">
<div id="loginCancelContainer" style="display: none;"> <div id="loginOfflineCancelContainer" > <!--Delete style="" as temp fix-->
<button id="loginCancelButton"> <button id="loginOfflineCancelButton">
<div id="loginCancelIcon">X</div> <div id="loginOfflineCancelIcon">X</div>
<span id="loginCancelText">Cancel</span> <span id="loginOfflineCancelText">Cancel</span>
</button> </button>
</div> </div>
<div id="loginContent"> <div id="loginContent">