From f2824f51f8ed407a8633ba968d35d56ea6a36f49 Mon Sep 17 00:00:00 2001 From: Minteck Date: Mon, 11 Jul 2022 18:54:20 +0200 Subject: Stuff --- assets/load.js | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) (limited to 'assets/load.js') 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 -- cgit