remember colasped catagories

This commit is contained in:
MathMan05 2024-09-02 17:59:27 -05:00
parent c2d657d889
commit a47772dd01
8 changed files with 91 additions and 8 deletions

View file

@ -248,6 +248,13 @@ class Channel {
this.lastmessageid = undefined;
}
this.setUpInfiniteScroller();
this.perminfo ??= {};
}
get perminfo() {
return this.guild.perminfo.channels[this.id];
}
set perminfo(e) {
this.guild.perminfo.channels[this.id] = e;
}
isAdmin() {
return this.guild.isAdmin();
@ -393,21 +400,32 @@ class Channel {
}
childrendiv.classList.add("channels");
setTimeout(_ => {
childrendiv.style.height = childrendiv.scrollHeight + "px";
if (!this.perminfo.collapsed) {
childrendiv.style.height = childrendiv.scrollHeight + "px";
}
}, 100);
decdiv.onclick = function () {
div.appendChild(childrendiv);
if (this.perminfo.collapsed) {
decoration.classList.add("hiddencat");
childrendiv.style.height = "0px";
}
decdiv.onclick = () => {
if (childrendiv.style.height !== "0px") {
decoration.classList.add("hiddencat");
//childrendiv.classList.add("colapsediv");
this.perminfo.collapsed = true;
this.localuser.userinfo.updateLocal();
childrendiv.style.height = "0px";
}
else {
decoration.classList.remove("hiddencat");
this.perminfo.collapsed = false;
this.localuser.userinfo.updateLocal();
//childrendiv.classList.remove("colapsediv")
console.log("This ran?");
childrendiv.style.height = childrendiv.scrollHeight + "px";
}
};
div.appendChild(childrendiv);
}
else {
div.classList.add("channel");

View file

@ -117,6 +117,7 @@ class Guild {
}
});
}
this.perminfo ??= { channels: {} };
for (const thing of json.channels) {
const temp = new Channel(thing, this);
this.channels.push(temp);
@ -130,6 +131,12 @@ class Guild {
}
}
}
get perminfo() {
return this.localuser.perminfo.guilds[this.id];
}
set perminfo(e) {
this.localuser.perminfo.guilds[this.id] = e;
}
notisetting(settings) {
this.message_notifications = settings.message_notifications;
}

View file

@ -38,12 +38,19 @@ class Localuser {
name: "Unknown",
};
mfa_enabled;
get perminfo() {
return this.userinfo.localuserStore;
}
set perminfo(e) {
this.userinfo.localuserStore = e;
}
constructor(userinfo) {
if (userinfo === -1) {
return;
}
this.token = userinfo.token;
this.userinfo = userinfo;
this.perminfo.guilds ??= {};
this.serverurls = this.userinfo.serverurls;
this.initialized = false;
this.info = this.serverurls;
@ -99,6 +106,7 @@ class Localuser {
user.relationshipType = thing.type;
}
this.pingEndpoint();
this.userinfo.updateLocal();
}
outoffocus() {
const servers = document.getElementById("servers");

View file

@ -109,6 +109,7 @@ class Specialuser {
this.token = json.token;
this.loggedin = json.loggedin;
this.json = json;
this.json.localuserStore ??= {};
if (!this.serverurls || !this.email || !this.token) {
console.error("There are fundamentally missing pieces of info missing from this user");
}
@ -128,6 +129,13 @@ class Specialuser {
get username() {
return this.json.username;
}
set localuserStore(e) {
this.json.localuserStore = e;
this.updateLocal();
}
get localuserStore() {
return this.json.localuserStore;
}
get uid() {
return this.email + this.serverurls.wellknown;
}

View file

@ -260,6 +260,13 @@ class Channel{
this.lastmessageid=undefined;
}
this.setUpInfiniteScroller();
this.perminfo??={};
}
get perminfo(){
return this.guild.perminfo.channels[this.id];
}
set perminfo(e){
this.guild.perminfo.channels[this.id]=e;
}
isAdmin(){
return this.guild.isAdmin();
@ -408,20 +415,32 @@ class Channel{
}
childrendiv.classList.add("channels");
setTimeout(_=>{
childrendiv.style.height = childrendiv.scrollHeight + "px";
if(!this.perminfo.collapsed){
childrendiv.style.height = childrendiv.scrollHeight + "px";
}
},100);
decdiv.onclick=function(){
div.appendChild(childrendiv);
if(this.perminfo.collapsed){
decoration.classList.add("hiddencat");
childrendiv.style.height = "0px";
}
decdiv.onclick=()=>{
if(childrendiv.style.height!=="0px"){
decoration.classList.add("hiddencat");
//childrendiv.classList.add("colapsediv");
this.perminfo.collapsed=true;
this.localuser.userinfo.updateLocal();
childrendiv.style.height = "0px";
}else{
decoration.classList.remove("hiddencat");
this.perminfo.collapsed=false;
this.localuser.userinfo.updateLocal();
//childrendiv.classList.remove("colapsediv")
console.log("This ran?")
childrendiv.style.height = childrendiv.scrollHeight + "px";
}
};
div.appendChild(childrendiv);
}else{
div.classList.add("channel");
if(this.hasunreads){

View file

@ -94,6 +94,7 @@ class Guild{
if(json.stickers.length){
console.log(json.stickers,":3");
}
this.emojis = json.emojis;
this.owner=owner;
this.headers=this.owner.headers;
@ -125,7 +126,7 @@ class Guild{
}
});
}
this.perminfo??={channels:{}};
for(const thing of json.channels){
const temp=new Channel(thing,this);
this.channels.push(temp);
@ -139,6 +140,12 @@ class Guild{
}
}
}
get perminfo(){
return this.localuser.perminfo.guilds[this.id];
}
set perminfo(e){
this.localuser.perminfo.guilds[this.id]=e;
}
notisetting(settings){
this.message_notifications=settings.message_notifications;
}

View file

@ -43,12 +43,19 @@ class Localuser{
name: "Unknown",
};
mfa_enabled:boolean;
get perminfo(){
return this.userinfo.localuserStore;
}
set perminfo(e){
this.userinfo.localuserStore=e;
}
constructor(userinfo:Specialuser|-1){
if(userinfo===-1){
return;
}
this.token=userinfo.token;
this.userinfo=userinfo;
this.perminfo.guilds??={};
this.serverurls=this.userinfo.serverurls;
this.initialized=false;
this.info=this.serverurls;
@ -109,6 +116,7 @@ class Localuser{
}
this.pingEndpoint();
this.userinfo.updateLocal();
}
outoffocus():void{
const servers=document.getElementById("servers") as HTMLDivElement;

View file

@ -111,6 +111,7 @@ class Specialuser{
this.token=json.token;
this.loggedin=json.loggedin;
this.json=json;
this.json.localuserStore??={};
if(!this.serverurls||!this.email||!this.token){
console.error("There are fundamentally missing pieces of info missing from this user");
}
@ -130,6 +131,13 @@ class Specialuser{
get username(){
return this.json.username;
}
set localuserStore(e){
this.json.localuserStore=e;
this.updateLocal();
}
get localuserStore(){
return this.json.localuserStore;
}
get uid(){
return this.email+this.serverurls.wellknown;
}