diff options
author | Minteck <contact@minteck.org> | 2022-07-11 18:54:20 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-07-11 18:54:20 +0200 |
commit | f2824f51f8ed407a8633ba968d35d56ea6a36f49 (patch) | |
tree | db0c625ccd8ae4ada52f4e30956a9627270dec31 /assets/load.js | |
parent | 5abe8cba55965f70e07e1163239bcc9d797c864a (diff) | |
download | bits-client-mane.tar.gz bits-client-mane.tar.bz2 bits-client-mane.zip |
Diffstat (limited to 'assets/load.js')
-rw-r--r-- | assets/load.js | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/assets/load.js b/assets/load.js index fc3f464..ade61cb 100644 --- a/assets/load.js +++ b/assets/load.js @@ -1,23 +1,35 @@ window.onload = async () => { - if (!isNodeJS) { - document.getElementById("mobile-css").removeAttribute("disabled"); - } + setTimeout(() => { + document.getElementById("loader-text").innerText = "Loading..."; + updateLoader(); - setTimeout(async () => { - loginStatus = JSON.parse(await (await window.fetch("https://money-v1.equestria.dev/Authentication/Test/")).text()).status; - if (loginStatus === 1) { - if (isNodeJS) { - console.info("Starting authentication procedure (Electron)"); - const { ipcRenderer } = require('electron'); - ipcRenderer.send("login"); - } else { + if (!isNodeJS) { + document.getElementById("mobile-css").removeAttribute("disabled"); + } + + setTimeout(async () => { + document.getElementById("loader-text").innerText = "Authenticating with the server..."; + updateLoader(); + loginStatus = JSON.parse(await (await window.fetch("https://money-v1.equestria.dev/Authentication/Test/")).text()).status; + if (loginStatus === 1) { + document.getElementById("loader-text").innerText = "Redirecting to login page..."; + updateLoader(); console.info("Starting authentication procedure (Mobile)"); - location.href = "https://money-v1.equestria.dev/Authentication/Mobile/" - } - } else { - console.info("Authenticated successfully"); + location.href = "https://money-v1.equestria.dev/Authentication/Mobile2/" + } else { + console.info("Authenticated successfully"); - await refresh(); - } + await plural(); + await refresh(); + } + }, 1000) }, 1000) +} + +let currentLoad = 0; +function updateLoader() { + let step = 6.25; + currentLoad = currentLoad + step; + + document.getElementById("loader-img").style.background = "linear-gradient(-90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0) " + (100 - currentLoad) + "%, var(--mdc-theme-primary) " + (100 - currentLoad) + "%, var(--mdc-theme-primary) 100%)"; }
\ No newline at end of file |