Use div instead of p where sensible.

This commit is contained in:
tastytea 2019-11-02 06:54:59 +01:00
parent 862de9a288
commit 7e4bfba35d
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
3 changed files with 9 additions and 7 deletions

View File

@ -65,6 +65,8 @@ The generated HTML uses these classes:
.mastodon-api-comment .mastodon-api-comment
{ {
margin-left: 1em; margin-left: 1em;
margin-bottom: 0.4em;
padding: 0 0.4em;
border: 0.1em solid black; border: 0.1em solid black;
} }
.mastodon-api-comment:nth-child(even) .mastodon-api-comment:nth-child(even)

View File

@ -2,7 +2,7 @@
{{ $status_id := .Get "status_id" | default "" }} {{ $status_id := .Get "status_id" | default "" }}
{{ partial "mastodon-api-comments-scripts.html" . }} {{ partial "mastodon-api-comments-scripts.html" . }}
<p id="mastodon-api-comments_{{ $status_id }}" class="mastodon-api-comments"></p> <div id="mastodon-api-comments_{{ $status_id }}" class="mastodon-api-comments"></div>
<noscript><p>Comments only work with JavaScript enabled.</p></noscript> <noscript><p>Comments only work with JavaScript enabled.</p></noscript>
<script type="application/javascript"> <script type="application/javascript">
fetch_mastodon_api_comments("{{ $instance }}", "{{ $status_id }}"); fetch_mastodon_api_comments("{{ $instance }}", "{{ $status_id }}");

View File

@ -51,9 +51,9 @@ function write_comments(root, data)
'<img style="height: 1em;" src="' + emoji.url + '">'); '<img style="height: 1em;" src="' + emoji.url + '">');
} }
const p = document.createElement("p"); const div = document.createElement("div");
p.setAttribute("class", "mastodon-api-comment"); div.setAttribute("class", "mastodon-api-comment");
p.appendChild(author_html(status)); div.appendChild(author_html(status));
if (status.spoiler_text.length > 0) if (status.spoiler_text.length > 0)
{ {
const subject_p = document.createElement("p"); const subject_p = document.createElement("p");
@ -61,13 +61,13 @@ function write_comments(root, data)
const subject = document.createElement("strong"); const subject = document.createElement("strong");
subject.appendChild(document.createTextNode(status.spoiler_text)); subject.appendChild(document.createTextNode(status.spoiler_text));
subject_p.appendChild(subject); subject_p.appendChild(subject);
p.appendChild(subject_p); div.appendChild(subject_p);
} }
const content_p = document.createElement("p"); const content_p = document.createElement("p");
content_p.setAttribute("class", "mastodon-api-comment-content"); content_p.setAttribute("class", "mastodon-api-comment-content");
content_p.innerHTML = content; content_p.innerHTML = content;
p.appendChild(content_p); div.appendChild(content_p);
root.appendChild(p); root.appendChild(div);
} }
} }