JS changes
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
// Main
|
||||
(() => {
|
||||
|
||||
const UiState = (()=> {
|
||||
function _isWalletLocked() {
|
||||
return window.uiState.isWalletLocked;
|
||||
}
|
||||
|
||||
function _isWalletConfigured() {
|
||||
return window.uiState.isWalletConfigured;
|
||||
}
|
||||
|
||||
return {
|
||||
isWalletLocked: _isWalletLocked,
|
||||
isWalletConfigured: _isWalletConfigured
|
||||
};
|
||||
})();
|
||||
|
||||
function setMainWindow(name) {
|
||||
const elem = document.getElementById(name);
|
||||
const mainWindow = document.getElementById('main_window');
|
||||
if (mainWindow.childElementCount === 1) {
|
||||
const curElem = mainWindow.firstChild;
|
||||
mainWindow.removeChild(curElem);
|
||||
curElem.classList.add('hidden-element');
|
||||
document.body.appendChild(curElem);
|
||||
}
|
||||
|
||||
elem.parentElement.removeChild(elem);
|
||||
elem.classList.remove('hidden-element');
|
||||
mainWindow.appendChild(elem);
|
||||
}
|
||||
|
||||
document.addEventListener('load', ()=> {
|
||||
if (UiState.isWalletConfigured()) {
|
||||
if (UiState.isWalletLocked()) {
|
||||
setMainWindow('unlock_window')
|
||||
} else {
|
||||
setMainWindow('app_window')
|
||||
}
|
||||
} else {
|
||||
setMainWindow('create_window')
|
||||
}
|
||||
});
|
||||
|
||||
})();
|
Reference in New Issue
Block a user