Various improvements and checks
This commit is contained in:
parent
a2abc91a2a
commit
1608d00beb
30 changed files with 541 additions and 360 deletions
|
@ -62,7 +62,7 @@ class Embed{
|
|||
authorline.append(img);
|
||||
}
|
||||
const a=document.createElement("a");
|
||||
a.textContent=this.json.author.name
|
||||
a.textContent=this.json.author.name as string;
|
||||
if(this.json.author.url){
|
||||
a.href=this.json.author.url
|
||||
}
|
||||
|
@ -70,14 +70,15 @@ class Embed{
|
|||
authorline.append(a);
|
||||
embed.append(authorline);
|
||||
}
|
||||
const title=document.createElement("a");
|
||||
title.append(new MarkDown(this.json.title,this.channel).makeHTML());
|
||||
if(this.json.url){
|
||||
title.href=this.json.url;
|
||||
if(this.json.title){
|
||||
const title=document.createElement("a");
|
||||
title.append(new MarkDown(this.json.title,this.channel).makeHTML());
|
||||
if(this.json.url){
|
||||
title.href=this.json.url;
|
||||
}
|
||||
title.classList.add("embedtitle");
|
||||
embed.append(title);
|
||||
}
|
||||
title.classList.add("embedtitle");
|
||||
embed.append(title);
|
||||
|
||||
if(this.json.description){
|
||||
const p=document.createElement("p");
|
||||
p.append(new MarkDown(this.json.description,this.channel).makeHTML());
|
||||
|
@ -155,7 +156,7 @@ class Embed{
|
|||
table.classList.add("embed","linkembed");
|
||||
const trtop=document.createElement("tr");
|
||||
table.append(trtop);
|
||||
{
|
||||
if(this.json.url&&this.json.title){
|
||||
const td=document.createElement("td");
|
||||
const a=document.createElement("a");
|
||||
a.href=this.json.url;
|
||||
|
@ -179,9 +180,11 @@ class Embed{
|
|||
}
|
||||
const bottomtr=document.createElement("tr");
|
||||
const td=document.createElement("td");
|
||||
const span=document.createElement("span");
|
||||
span.textContent=this.json.description;
|
||||
td.append(span);
|
||||
if(this.json.description){
|
||||
const span=document.createElement("span");
|
||||
span.textContent=this.json.description;
|
||||
td.append(span);
|
||||
}
|
||||
bottomtr.append(td);
|
||||
table.append(bottomtr)
|
||||
return table;
|
||||
|
@ -200,14 +203,16 @@ class Embed{
|
|||
div.append(provider);
|
||||
}
|
||||
const a=document.createElement("a");
|
||||
a.href=this.json.url;
|
||||
a.textContent=this.json.title;
|
||||
div.append(a);
|
||||
|
||||
const description=document.createElement("p");
|
||||
description.textContent=this.json.description;
|
||||
div.append(description);
|
||||
|
||||
if(this.json.url&&this.json.url){
|
||||
a.href=this.json.url;
|
||||
a.textContent=this.json.url;
|
||||
div.append(a);
|
||||
}
|
||||
if(this.json.description){
|
||||
const description=document.createElement("p");
|
||||
description.textContent=this.json.description;
|
||||
div.append(description);
|
||||
}
|
||||
if(this.json.thumbnail){
|
||||
const img=document.createElement("img");
|
||||
img.classList.add("bigembedimg");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue