Rename everything from fediverse-comments to mastodon-api-comments.
This commit is contained in:
parent
5e065e4cd8
commit
adde9a2aa1
|
@ -3,7 +3,7 @@
|
|||
|
||||
<!-- Comments via Mastodon-API -->
|
||||
{{ partial "mastodon-api-comments-scripts.html" . }}
|
||||
<p id="fediverse-comments"></p>
|
||||
<p class="mastodon-api-comments"></p>
|
||||
<script type="application/javascript">
|
||||
fetch_fediverse_comments("{{ $instance }}", "{{ $status_id }}");
|
||||
fetch_mastodon_api_comments("{{ $instance }}", "{{ $status_id }}");
|
||||
</script>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* globals MastodonAPI */
|
||||
|
||||
function fetch_fediverse_comments(instance, status_id)
|
||||
function fetch_mastodon_api_comments(instance, status_id)
|
||||
{
|
||||
const root = document.getElementById("fediverse-comments");
|
||||
const root = document.getElementById("mastodon-api-comments");
|
||||
|
||||
let api = new MastodonAPI(
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ function comments_intro(url)
|
|||
const p = document.createElement("p");
|
||||
const a = document.createElement("a");
|
||||
p.appendChild(document.createTextNode("You can "));
|
||||
p.setAttribute("class", "fediverse-comment-intro");
|
||||
p.setAttribute("class", "mastodon-api-comment-intro");
|
||||
a.setAttribute("href", url);
|
||||
a.appendChild(
|
||||
document.createTextNode("comment on this post in the Fediverse"));
|
||||
|
@ -41,7 +41,7 @@ function comments_intro(url)
|
|||
|
||||
function write_comments(data)
|
||||
{
|
||||
const root = document.getElementById("fediverse-comments");
|
||||
const root = document.getElementById("mastodon-api-comments");
|
||||
|
||||
for (const status of data.descendants)
|
||||
{
|
||||
|
@ -54,20 +54,20 @@ function write_comments(data)
|
|||
}
|
||||
|
||||
const p = document.createElement("p");
|
||||
p.setAttribute("class", "fediverse-comment");
|
||||
p.appendChild(author_html(status));
|
||||
p.setAttribute("class", "mastodon-api-comment");
|
||||
p.appendChild(author_html(status.account));
|
||||
p.innerHTML += content;
|
||||
root.appendChild(p);
|
||||
}
|
||||
}
|
||||
|
||||
function author_html(status)
|
||||
function author_html(account)
|
||||
{
|
||||
const p = document.createElement("p");
|
||||
p.setAttribute("class", "fediverse-comment-author");
|
||||
p.setAttribute("class", "mastodon-api-comment-author");
|
||||
const strong = document.createElement("strong");
|
||||
strong.appendChild(document.createTextNode(status.display_name));
|
||||
strong.appendChild(document.createTextNode(account.display_name));
|
||||
p.appendChild(strong);
|
||||
p.appendChild(document.createTextNode(" (" + status.acct + ") wrote:"));
|
||||
p.appendChild(document.createTextNode(" (" + account.acct + ") wrote:"));
|
||||
return p;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue