From 7915032462c18a6a5a8654dc564bbac5a28037d9 Mon Sep 17 00:00:00 2001 From: MathMan05 Date: Fri, 6 Sep 2024 11:49:10 -0500 Subject: [PATCH] remember channels you were in last --- .dist/channel.js | 2 ++ .dist/guild.js | 2 +- .dist/infiniteScroller.js | 2 +- webpage/channel.ts | 2 ++ webpage/guild.ts | 5 +++-- webpage/infiniteScroller.ts | 2 +- 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.dist/channel.js b/.dist/channel.js index 5e49924..e6b2868 100644 --- a/.dist/channel.js +++ b/.dist/channel.js @@ -676,6 +676,8 @@ class Channel extends SnowFlake { this.myhtml.classList.add("viewChannel"); } this.guild.prevchannel = this; + this.guild.perminfo.prevchannel = this.id; + this.localuser.userinfo.updateLocal(); this.localuser.channelfocus = this; const prom = this.infinite.delete(); history.pushState(null, "", "/channels/" + this.guild_id + "/" + this.id); diff --git a/.dist/guild.js b/.dist/guild.js index f96b144..27d3b9f 100644 --- a/.dist/guild.js +++ b/.dist/guild.js @@ -90,7 +90,6 @@ class Guild extends SnowFlake { this.properties = json.properties; this.roles = []; this.roleids = new Map(); - this.prevchannel = undefined; this.message_notifications = 0; for (const roley of json.roles) { const roleh = new Role(roley, this); @@ -127,6 +126,7 @@ class Guild extends SnowFlake { this.headchannels.push(thing); } } + this.prevchannel = this.channelids[this.perminfo.prevchannel]; } get perminfo() { return this.localuser.perminfo.guilds[this.id]; diff --git a/.dist/infiniteScroller.js b/.dist/infiniteScroller.js index ca15df1..860db5c 100644 --- a/.dist/infiniteScroller.js +++ b/.dist/infiniteScroller.js @@ -97,7 +97,7 @@ class InfiniteScroller { snapBottom() { const scrollBottom = this.scrollBottom; return () => { - if (this.scroll && scrollBottom < 30) { + if (this.scroll && scrollBottom < 10) { this.scroll.scrollTop = this.scroll.scrollHeight + 20; } }; diff --git a/webpage/channel.ts b/webpage/channel.ts index 99c2cee..752fcb6 100644 --- a/webpage/channel.ts +++ b/webpage/channel.ts @@ -686,6 +686,8 @@ class Channel extends SnowFlake{ this.myhtml.classList.add("viewChannel"); } this.guild.prevchannel=this; + this.guild.perminfo.prevchannel=this.id; + this.localuser.userinfo.updateLocal(); this.localuser.channelfocus=this; const prom=this.infinite.delete(); history.pushState(null, "","/channels/"+this.guild_id+"/"+this.id); diff --git a/webpage/guild.ts b/webpage/guild.ts index 8c4d8d7..9a8311f 100644 --- a/webpage/guild.ts +++ b/webpage/guild.ts @@ -9,7 +9,7 @@ import{Permissions}from"./permissions.js"; import{ SnowFlake }from"./snowflake.js"; import{ channeljson, guildjson, emojijson, memberjson }from"./jsontypes.js"; import{ User }from"./user.js"; -import{ Message }from"./message.js"; + class Guild extends SnowFlake{ owner:Localuser; headers:Localuser["headers"]; @@ -100,7 +100,7 @@ class Guild extends SnowFlake{ this.properties=json.properties; this.roles=[]; this.roleids=new Map(); - this.prevchannel=undefined; + this.message_notifications=0; for(const roley of json.roles){ const roleh=new Role(roley,this); @@ -135,6 +135,7 @@ class Guild extends SnowFlake{ this.headchannels.push(thing); } } + this.prevchannel=this.channelids[this.perminfo.prevchannel]; } get perminfo(){ return this.localuser.perminfo.guilds[this.id]; diff --git a/webpage/infiniteScroller.ts b/webpage/infiniteScroller.ts index 71c8a00..5968839 100644 --- a/webpage/infiniteScroller.ts +++ b/webpage/infiniteScroller.ts @@ -97,7 +97,7 @@ class InfiniteScroller{ snapBottom(){ const scrollBottom=this.scrollBottom; return()=>{ - if(this.scroll&&scrollBottom<30){ + if(this.scroll&&scrollBottom<10){ this.scroll.scrollTop=this.scroll.scrollHeight+20; } };