diff options
Diffstat (limited to 'js')
| -rw-r--r-- | js/acountLogin.js | 18 | ||||
| -rw-r--r-- | js/desktop.js | 19 |
2 files changed, 28 insertions, 9 deletions
diff --git a/js/acountLogin.js b/js/acountLogin.js index 53cb4b8..3b50e2f 100644 --- a/js/acountLogin.js +++ b/js/acountLogin.js @@ -62,17 +62,17 @@ function DELoader() { let width = 0; function loadMeter() { - if (width < 100) { - if (100 - width < 10) { - width = 100; - } else { - width += Math.round(Math.random() * 10); - } - meterLoaderElement.style.width = width + "%"; - } else { + // if (width < 100) { + // if (100 - width < 10) { + // width = 100; + // } else { + // width += Math.round(Math.random() * 10); + // } + // meterLoaderElement.style.width = width + "%"; + // } else { loadingDesktopExperienceElement.style.display = "none"; document.getElementById('desktop').style.display = "block"; - } + // } } (function loop() { diff --git a/js/desktop.js b/js/desktop.js new file mode 100644 index 0000000..cef0d7b --- /dev/null +++ b/js/desktop.js @@ -0,0 +1,19 @@ +const parsedAccounts = JSON.parse(localAccounts); +const currentAccount = parsedAccounts.find( + (account) => account.fullName === currentLoggedInUser +); +const currentIndex = parsedAccounts.findIndex( + (account) => account.fullName === currentLoggedInUser +); +const desktop = document.getElementById("desktop"); +const wallpaperRoute = "./images/wallpapers"; +const wallpaperExtension = ".jpeg"; + +if(!currentAccount.wallpaper) { + currentAccount['wallpaper'] = 'Wallpaper1'; + parsedAccounts[currentIndex] = currentAccount; + localStorage.setItem('accounts', JSON.stringify(parsedAccounts)); + desktop.style.backgroundImage = `url("${wallpaperRoute}/${currentAccount.wallpaper}${wallpaperExtension}")`; +} else { + desktop.style.backgroundImage = `url("${wallpaperRoute}/${currentAccount.wallpaper}${wallpaperExtension}")`; +} |
