diff --git a/.dist/channel.js b/.dist/channel.js index 4bc2f27..1a4ff61 100644 --- a/.dist/channel.js +++ b/.dist/channel.js @@ -446,7 +446,9 @@ class Channel { return new Message(json[0], this); } } + static genid = 0; async getHTML() { + const id = ++Channel.genid; if (this.guild !== this.localuser.lookingguild) { this.guild.loadGuild(); } @@ -459,6 +461,9 @@ class Channel { const prom = Message.wipeChanel(); await this.putmessages(); await prom; + if (id !== Channel.genid) { + return; + } this.makereplybox(); this.buildmessages(); history.pushState(null, null, "/channels/" + this.guild_id + "/" + this.id); diff --git a/.dist/direct.js b/.dist/direct.js index bfa5b6e..d51c3f9 100644 --- a/.dist/direct.js +++ b/.dist/direct.js @@ -98,6 +98,7 @@ class Group extends Channel { return div; } async getHTML() { + const id = ++Channel.genid; if (this.guild !== this.localuser.lookingguild) { this.guild.loadGuild(); } @@ -106,6 +107,9 @@ class Group extends Channel { this.localuser.channelfocus = this; await this.putmessages(); await prom; + if (id !== Channel.genid) { + return; + } this.buildmessages(); history.pushState(null, null, "/channels/" + this.guild_id + "/" + this.id); document.getElementById("channelname").textContent = "@" + this.name; diff --git a/.dist/message.js b/.dist/message.js index 121a872..1c3894c 100644 --- a/.dist/message.js +++ b/.dist/message.js @@ -324,40 +324,6 @@ class Message { this.div = div; return this.generateMessage(premessage); } - createunknown(fname, fsize, src) { - const div = document.createElement("table"); - div.classList.add("unknownfile"); - const nametr = document.createElement("tr"); - div.append(nametr); - const fileicon = document.createElement("td"); - nametr.append(fileicon); - fileicon.append("🗎"); - fileicon.classList.add("fileicon"); - fileicon.rowSpan = 2; - const nametd = document.createElement("td"); - if (src) { - const a = document.createElement("a"); - a.href = src; - a.textContent = fname; - nametd.append(a); - } - else { - nametd.textContent = fname; - } - nametd.classList.add("filename"); - nametr.append(nametd); - const sizetr = document.createElement("tr"); - const size = document.createElement("td"); - sizetr.append(size); - size.textContent = "Size:" + this.filesizehuman(fsize); - size.classList.add("filesize"); - div.appendChild(sizetr); - return div; - } - filesizehuman(fsize) { - var i = fsize == 0 ? 0 : Math.floor(Math.log(fsize) / Math.log(1024)); - return +((fsize / Math.pow(1024, i)).toFixed(2)) * 1 + ' ' + ['Bytes', 'Kilobytes', 'Megabytes', 'Gigabytes', 'Terabytes'][i]; - } } function formatTime(date) { const now = new Date(); diff --git a/webpage/channel.ts b/webpage/channel.ts index 5c9b330..4ab0871 100644 --- a/webpage/channel.ts +++ b/webpage/channel.ts @@ -453,7 +453,9 @@ class Channel{ return new Message(json[0],this); } } + static genid:number=0; async getHTML(){ + const id=++Channel.genid; if(this.guild!==this.localuser.lookingguild){ this.guild.loadGuild(); } @@ -466,6 +468,9 @@ class Channel{ const prom=Message.wipeChanel(); await this.putmessages(); await prom; + if(id!==Channel.genid){ + return; + } this.makereplybox(); this.buildmessages(); history.pushState(null, null,"/channels/"+this.guild_id+"/"+this.id); diff --git a/webpage/direct.ts b/webpage/direct.ts index 98f17b9..63c2aff 100644 --- a/webpage/direct.ts +++ b/webpage/direct.ts @@ -100,6 +100,7 @@ class Group extends Channel{ return div; } async getHTML(){ + const id=++Channel.genid; if(this.guild!==this.localuser.lookingguild){ this.guild.loadGuild(); } @@ -108,6 +109,9 @@ class Group extends Channel{ this.localuser.channelfocus=this; await this.putmessages(); await prom; + if(id!==Channel.genid){ + return; + } this.buildmessages(); history.pushState(null, null,"/channels/"+this.guild_id+"/"+this.id); document.getElementById("channelname").textContent="@"+this.name; diff --git a/webpage/message.ts b/webpage/message.ts index 5d2bd28..27f3f41 100644 --- a/webpage/message.ts +++ b/webpage/message.ts @@ -332,40 +332,6 @@ class Message{ this.div=div; return this.generateMessage(premessage); } - createunknown(fname,fsize,src){ - const div=document.createElement("table"); - div.classList.add("unknownfile"); - const nametr=document.createElement("tr"); - div.append(nametr); - const fileicon=document.createElement("td"); - nametr.append(fileicon); - fileicon.append("🗎"); - fileicon.classList.add("fileicon"); - fileicon.rowSpan=2; - const nametd=document.createElement("td"); - if(src){ - const a=document.createElement("a"); - a.href=src; - a.textContent=fname; - nametd.append(a); - }else{ - nametd.textContent=fname; - } - - nametd.classList.add("filename"); - nametr.append(nametd); - const sizetr=document.createElement("tr"); - const size=document.createElement("td"); - sizetr.append(size); - size.textContent="Size:"+this.filesizehuman(fsize); - size.classList.add("filesize"); - div.appendChild(sizetr) - return div; - } - filesizehuman(fsize){ - var i = fsize == 0 ? 0 : Math.floor(Math.log(fsize) / Math.log(1024)); - return +((fsize / Math.pow(1024, i)).toFixed(2)) * 1 + ' ' + ['Bytes', 'Kilobytes', 'Megabytes', 'Gigabytes', 'Terabytes'][i]; - } } function formatTime(date) { diff --git a/webpage/style.css b/webpage/style.css index 0aed969..6da3c81 100644 --- a/webpage/style.css +++ b/webpage/style.css @@ -487,9 +487,9 @@ p { .startreply { display: inline-block; vertical-align: middle; - width: 22px; - margin-left: 25px; + width: 25px; border-color: var(--reply-border); + margin-left: 26px; } .replypfp {