add account switcher to loading screen
This commit is contained in:
parent
6ac1a4e904
commit
ef2d228b70
6 changed files with 178 additions and 133 deletions
|
@ -14,17 +14,7 @@ const users = getBulkUsers();
|
|||
if (!users.currentuser) {
|
||||
window.location.href = '/login.html';
|
||||
}
|
||||
let thisuser = new Localuser(users.users[users.currentuser]);
|
||||
thisuser.initwebsocket().then(_ => {
|
||||
thisuser.loaduser();
|
||||
thisuser.init();
|
||||
document.getElementById("loading").classList.add("doneloading");
|
||||
document.getElementById("loading").classList.remove("loading");
|
||||
console.log("done loading");
|
||||
});
|
||||
{
|
||||
const userinfo = document.getElementById("userinfo");
|
||||
userinfo.addEventListener("click", function (event) {
|
||||
function showAccountSwitcher() {
|
||||
const table = document.createElement("div");
|
||||
for (const thing of Object.values(users.users)) {
|
||||
const specialuser = thing;
|
||||
|
@ -78,8 +68,34 @@ thisuser.initwebsocket().then(_ => {
|
|||
Contextmenu.currentmenu = table;
|
||||
console.log(table);
|
||||
document.body.append(table);
|
||||
event.stopImmediatePropagation();
|
||||
}
|
||||
{
|
||||
const userinfo = document.getElementById("userinfo");
|
||||
userinfo.addEventListener("click", _ => {
|
||||
_.stopImmediatePropagation();
|
||||
showAccountSwitcher();
|
||||
});
|
||||
const switchaccounts = document.getElementById("switchaccounts");
|
||||
switchaccounts.addEventListener("click", _ => {
|
||||
_.stopImmediatePropagation();
|
||||
showAccountSwitcher();
|
||||
});
|
||||
console.log("this ran");
|
||||
}
|
||||
let thisuser;
|
||||
try {
|
||||
thisuser = new Localuser(users.users[users.currentuser]);
|
||||
thisuser.initwebsocket().then(_ => {
|
||||
thisuser.loaduser();
|
||||
thisuser.init();
|
||||
document.getElementById("loading").classList.add("doneloading");
|
||||
document.getElementById("loading").classList.remove("loading");
|
||||
console.log("done loading");
|
||||
});
|
||||
}
|
||||
catch {
|
||||
document.getElementById("load-desc").textContent = "Account unable to start";
|
||||
thisuser = new Localuser(-1);
|
||||
}
|
||||
{
|
||||
const menu = new Contextmenu("create rightclick");
|
||||
|
|
|
@ -36,6 +36,9 @@ class Localuser {
|
|||
errorBackoff = 0;
|
||||
mfa_enabled;
|
||||
constructor(userinfo) {
|
||||
if (userinfo === -1) {
|
||||
return;
|
||||
}
|
||||
this.token = userinfo.token;
|
||||
this.userinfo = userinfo;
|
||||
this.serverurls = this.userinfo.serverurls;
|
||||
|
@ -104,7 +107,9 @@ class Localuser {
|
|||
this.outoffocus();
|
||||
this.guilds = [];
|
||||
this.guildids = new Map();
|
||||
if (this.ws) {
|
||||
this.ws.close(4001);
|
||||
}
|
||||
SnowFlake.clear();
|
||||
User.clear();
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
<img src="/logo.svg" width="1in" height="1in">
|
||||
<h1>Jank Client is loading</h1>
|
||||
<h2 id="load-desc">This shouldn't take long</h2>
|
||||
<h1 id="switchaccounts">Switch Accounts</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flexltr" id="page">
|
||||
|
|
|
@ -19,17 +19,8 @@ if(!users.currentuser){
|
|||
window.location.href = '/login.html';
|
||||
}
|
||||
|
||||
let thisuser=new Localuser(users.users[users.currentuser]);
|
||||
thisuser.initwebsocket().then(_=>{
|
||||
thisuser.loaduser();
|
||||
thisuser.init();
|
||||
document.getElementById("loading").classList.add("doneloading");
|
||||
document.getElementById("loading").classList.remove("loading");
|
||||
console.log("done loading")
|
||||
});
|
||||
{
|
||||
const userinfo=document.getElementById("userinfo");
|
||||
userinfo.addEventListener("click",function(event){
|
||||
|
||||
function showAccountSwitcher(){
|
||||
const table=document.createElement("div");
|
||||
for(const thing of Object.values(users.users)){
|
||||
const specialuser=thing as Specialuser;
|
||||
|
@ -87,9 +78,35 @@ thisuser.initwebsocket().then(_=>{
|
|||
Contextmenu.currentmenu=table;
|
||||
console.log(table);
|
||||
document.body.append(table);
|
||||
event.stopImmediatePropagation();
|
||||
})
|
||||
}
|
||||
{
|
||||
const userinfo=document.getElementById("userinfo");
|
||||
userinfo.addEventListener("click",_=>{
|
||||
_.stopImmediatePropagation();
|
||||
showAccountSwitcher();
|
||||
})
|
||||
const switchaccounts=document.getElementById("switchaccounts");
|
||||
switchaccounts.addEventListener("click",_=>{
|
||||
_.stopImmediatePropagation();
|
||||
showAccountSwitcher();
|
||||
})
|
||||
console.log("this ran")
|
||||
}
|
||||
let thisuser:Localuser;
|
||||
try{
|
||||
thisuser=new Localuser(users.users[users.currentuser]);
|
||||
thisuser.initwebsocket().then(_=>{
|
||||
thisuser.loaduser();
|
||||
thisuser.init();
|
||||
document.getElementById("loading").classList.add("doneloading");
|
||||
document.getElementById("loading").classList.remove("loading");
|
||||
console.log("done loading")
|
||||
});
|
||||
}catch{
|
||||
document.getElementById("load-desc").textContent="Account unable to start";
|
||||
thisuser=new Localuser(-1);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
const menu=new Contextmenu("create rightclick");
|
||||
|
|
|
@ -39,7 +39,10 @@ class Localuser{
|
|||
connectionSucceed=0;
|
||||
errorBackoff=0;
|
||||
mfa_enabled:boolean;
|
||||
constructor(userinfo:Specialuser){
|
||||
constructor(userinfo:Specialuser|-1){
|
||||
if(userinfo===-1){
|
||||
return;
|
||||
}
|
||||
this.token=userinfo.token;
|
||||
this.userinfo=userinfo;
|
||||
this.serverurls=this.userinfo.serverurls;
|
||||
|
@ -110,7 +113,9 @@ class Localuser{
|
|||
this.outoffocus();
|
||||
this.guilds=[];
|
||||
this.guildids=new Map();
|
||||
if(this.ws){
|
||||
this.ws.close(4001)
|
||||
}
|
||||
SnowFlake.clear();
|
||||
User.clear();
|
||||
}
|
||||
|
|
|
@ -1058,6 +1058,7 @@ span {
|
|||
max-height: 80vh;
|
||||
overflow: auto;
|
||||
border:solid var(--black) .035in;
|
||||
z-index: 102;
|
||||
}
|
||||
.switchtable{
|
||||
transition: background .3s;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue