Reply GUI
This commit is contained in:
parent
a05c74bb3c
commit
e49360fba1
8 changed files with 116 additions and 22 deletions
|
@ -39,7 +39,7 @@ class Channel{
|
|||
message_notifications:number;
|
||||
allthewayup:boolean;
|
||||
static contextmenu=new Contextmenu("channel menu");
|
||||
replyingto:HTMLDivElement;
|
||||
replyingto:Message;
|
||||
static setupcontextmenu(){
|
||||
Channel.contextmenu.addbutton("Copy channel id",function(){
|
||||
console.log(this)
|
||||
|
@ -412,6 +412,38 @@ class Channel{
|
|||
headers:this.headers
|
||||
})
|
||||
}
|
||||
setReplying(message:Message){
|
||||
if(this.replyingto){
|
||||
this.replyingto.div.classList.remove("replying");
|
||||
}
|
||||
this.replyingto=message;
|
||||
console.log(message);
|
||||
this.replyingto.div.classList.add("replying");
|
||||
this.makereplybox();
|
||||
|
||||
}
|
||||
makereplybox(){
|
||||
const replybox=document.getElementById("replybox");
|
||||
if(this.replyingto){
|
||||
replybox.innerHTML="";
|
||||
const span=document.createElement("span");
|
||||
span.textContent="Replying to "+this.replyingto.author.username;
|
||||
const X=document.createElement("button");
|
||||
X.onclick=_=>{
|
||||
this.replyingto.div.classList.remove("replying");
|
||||
replybox.classList.add("hideReplyBox");
|
||||
this.replyingto=null;
|
||||
replybox.innerHTML="";
|
||||
}
|
||||
replybox.classList.remove("hideReplyBox");
|
||||
X.textContent="⦻";
|
||||
X.classList.add("cancelReply");
|
||||
replybox.append(span);
|
||||
replybox.append(X);
|
||||
}else{
|
||||
replybox.classList.add("hideReplyBox");
|
||||
}
|
||||
}
|
||||
async getmessage(id:string):Promise<Message>{
|
||||
if(this.messageids[id]){
|
||||
return this.messageids[id];
|
||||
|
@ -434,6 +466,7 @@ class Channel{
|
|||
const prom=Message.wipeChanel();
|
||||
await this.putmessages();
|
||||
await prom;
|
||||
this.makereplybox();
|
||||
this.buildmessages();
|
||||
history.pushState(null, null,"/channels/"+this.guild_id+"/"+this.id);
|
||||
document.getElementById("channelname").textContent="#"+this.name;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue