Replace emojicodes with emojis in subject.
Este commit está contenido en:
padre
034c79bf53
commit
d5ffb1669a
|
@ -43,13 +43,7 @@ function write_comments(root, data)
|
|||
{
|
||||
for (const status of data.descendants)
|
||||
{
|
||||
let content = status.content;
|
||||
for (const emoji of status.emojis)
|
||||
{
|
||||
content = content.replace(
|
||||
':' + emoji.shortcode + ':',
|
||||
'<img class="mastodon-api-comment-emoji" src="' + emoji.url + '">');
|
||||
}
|
||||
const content = add_emojis(status.content, status.emojis);
|
||||
|
||||
const div = document.createElement("div");
|
||||
div.setAttribute("class", "mastodon-api-comment");
|
||||
|
@ -66,6 +60,18 @@ function write_comments(root, data)
|
|||
}
|
||||
}
|
||||
|
||||
function add_emojis(text, emojis)
|
||||
{
|
||||
for (const emoji of emojis)
|
||||
{
|
||||
text = text.replace(
|
||||
':' + emoji.shortcode + ':',
|
||||
'<img class="mastodon-api-comment-emoji" src="' + emoji.url + '">');
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
function author_html(status)
|
||||
{
|
||||
const p = document.createElement("p");
|
||||
|
@ -92,7 +98,7 @@ function subject_html(status)
|
|||
const p = document.createElement("p");
|
||||
p.setAttribute("class", "mastodon-api-comment-subject");
|
||||
const subject = document.createElement("strong");
|
||||
subject.appendChild(document.createTextNode(status.spoiler_text));
|
||||
subject.innerHTML += add_emojis(status.spoiler_text, status.emojis);
|
||||
p.appendChild(subject);
|
||||
return p;
|
||||
}
|
||||
|
|
Cargando…
Referencia en una nueva incidencia