This commit is contained in:
kek7198 2021-12-09 16:33:19 -06:00
parent b3301da0e7
commit 8d05a79464
2 changed files with 6 additions and 7 deletions

View file

@ -4,10 +4,9 @@ function timestamp(str, ti) {
};
function collapse_comment(comment_id) {
const comment = "comment-" + comment_id
const element = document.getElementById(comment)
const closed = element.classList.toggle("collapsed")
const top = element.getBoundingClientRect().y
const comment = `comment-${comment_id}`;
const closed = comment.classList.toggle("collapsed");
const top = comment.getBoundingClientRect().y;
const text = document.getElementById(`comment-text-${comment_id}`)
const actions = document.getElementById(`comment-${comment_id}-actions`)
@ -16,10 +15,10 @@ function collapse_comment(comment_id) {
const arr = [text, actions, repliesOf];
arr.map(x => x.classList.toggle('hidden')); // hide comment elements
comment.classList.toggle('items-center opacity-50') // apply flex alignment and opacity to comment parent wrapping div
comment.classList.toggle('items-center opacity-50'); // apply flex alignment and opacity to comment parent wrapping div
if (closed && top < 0) {
element.scrollIntoView()
comment.scrollIntoView()
window.scrollBy(0, - 100)
}
};

View file

@ -37,7 +37,7 @@
{% endif %}
<script defer src="/assets/js/popover.js?v=16"></script>
<script defer src="/assets/js/comments.js?v=8"></script>
<script defer src="/assets/js/comments.js?v=9"></script>
{% include "expanded_image_modal.html" %}