Fixed loading channel bugs
This commit is contained in:
parent
e49360fba1
commit
5d84518b50
7 changed files with 20 additions and 70 deletions
|
@ -446,7 +446,9 @@ class Channel {
|
||||||
return new Message(json[0], this);
|
return new Message(json[0], this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static genid = 0;
|
||||||
async getHTML() {
|
async getHTML() {
|
||||||
|
const id = ++Channel.genid;
|
||||||
if (this.guild !== this.localuser.lookingguild) {
|
if (this.guild !== this.localuser.lookingguild) {
|
||||||
this.guild.loadGuild();
|
this.guild.loadGuild();
|
||||||
}
|
}
|
||||||
|
@ -459,6 +461,9 @@ class Channel {
|
||||||
const prom = Message.wipeChanel();
|
const prom = Message.wipeChanel();
|
||||||
await this.putmessages();
|
await this.putmessages();
|
||||||
await prom;
|
await prom;
|
||||||
|
if (id !== Channel.genid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.makereplybox();
|
this.makereplybox();
|
||||||
this.buildmessages();
|
this.buildmessages();
|
||||||
history.pushState(null, null, "/channels/" + this.guild_id + "/" + this.id);
|
history.pushState(null, null, "/channels/" + this.guild_id + "/" + this.id);
|
||||||
|
|
|
@ -98,6 +98,7 @@ class Group extends Channel {
|
||||||
return div;
|
return div;
|
||||||
}
|
}
|
||||||
async getHTML() {
|
async getHTML() {
|
||||||
|
const id = ++Channel.genid;
|
||||||
if (this.guild !== this.localuser.lookingguild) {
|
if (this.guild !== this.localuser.lookingguild) {
|
||||||
this.guild.loadGuild();
|
this.guild.loadGuild();
|
||||||
}
|
}
|
||||||
|
@ -106,6 +107,9 @@ class Group extends Channel {
|
||||||
this.localuser.channelfocus = this;
|
this.localuser.channelfocus = this;
|
||||||
await this.putmessages();
|
await this.putmessages();
|
||||||
await prom;
|
await prom;
|
||||||
|
if (id !== Channel.genid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.buildmessages();
|
this.buildmessages();
|
||||||
history.pushState(null, null, "/channels/" + this.guild_id + "/" + this.id);
|
history.pushState(null, null, "/channels/" + this.guild_id + "/" + this.id);
|
||||||
document.getElementById("channelname").textContent = "@" + this.name;
|
document.getElementById("channelname").textContent = "@" + this.name;
|
||||||
|
|
|
@ -324,40 +324,6 @@ class Message {
|
||||||
this.div = div;
|
this.div = div;
|
||||||
return this.generateMessage(premessage);
|
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) {
|
function formatTime(date) {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
|
|
|
@ -453,7 +453,9 @@ class Channel{
|
||||||
return new Message(json[0],this);
|
return new Message(json[0],this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static genid:number=0;
|
||||||
async getHTML(){
|
async getHTML(){
|
||||||
|
const id=++Channel.genid;
|
||||||
if(this.guild!==this.localuser.lookingguild){
|
if(this.guild!==this.localuser.lookingguild){
|
||||||
this.guild.loadGuild();
|
this.guild.loadGuild();
|
||||||
}
|
}
|
||||||
|
@ -466,6 +468,9 @@ class Channel{
|
||||||
const prom=Message.wipeChanel();
|
const prom=Message.wipeChanel();
|
||||||
await this.putmessages();
|
await this.putmessages();
|
||||||
await prom;
|
await prom;
|
||||||
|
if(id!==Channel.genid){
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.makereplybox();
|
this.makereplybox();
|
||||||
this.buildmessages();
|
this.buildmessages();
|
||||||
history.pushState(null, null,"/channels/"+this.guild_id+"/"+this.id);
|
history.pushState(null, null,"/channels/"+this.guild_id+"/"+this.id);
|
||||||
|
|
|
@ -100,6 +100,7 @@ class Group extends Channel{
|
||||||
return div;
|
return div;
|
||||||
}
|
}
|
||||||
async getHTML(){
|
async getHTML(){
|
||||||
|
const id=++Channel.genid;
|
||||||
if(this.guild!==this.localuser.lookingguild){
|
if(this.guild!==this.localuser.lookingguild){
|
||||||
this.guild.loadGuild();
|
this.guild.loadGuild();
|
||||||
}
|
}
|
||||||
|
@ -108,6 +109,9 @@ class Group extends Channel{
|
||||||
this.localuser.channelfocus=this;
|
this.localuser.channelfocus=this;
|
||||||
await this.putmessages();
|
await this.putmessages();
|
||||||
await prom;
|
await prom;
|
||||||
|
if(id!==Channel.genid){
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.buildmessages();
|
this.buildmessages();
|
||||||
history.pushState(null, null,"/channels/"+this.guild_id+"/"+this.id);
|
history.pushState(null, null,"/channels/"+this.guild_id+"/"+this.id);
|
||||||
document.getElementById("channelname").textContent="@"+this.name;
|
document.getElementById("channelname").textContent="@"+this.name;
|
||||||
|
|
|
@ -332,40 +332,6 @@ class Message{
|
||||||
this.div=div;
|
this.div=div;
|
||||||
return this.generateMessage(premessage);
|
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) {
|
function formatTime(date) {
|
||||||
|
|
|
@ -487,9 +487,9 @@ p {
|
||||||
.startreply {
|
.startreply {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
width: 22px;
|
width: 25px;
|
||||||
margin-left: 25px;
|
|
||||||
border-color: var(--reply-border);
|
border-color: var(--reply-border);
|
||||||
|
margin-left: 26px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.replypfp {
|
.replypfp {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue