Add depth of each comment to the json. When creating the html, determine if the comment is an even or odd depth for css.

This commit is contained in:
Shaun Collins
2020-12-17 17:17:20 -05:00
parent 2bffbcdf0b
commit c695a392d6
3 changed files with 30 additions and 142 deletions
+2 -2
View File
@@ -38,7 +38,7 @@ module.exports = function() {
edited_span = `<span title="this comment is edited">*</span>`
}
comments_html = `
<div class="comment" id="${comments.id}">
<div class="comment ${comments.depth % 2 === 0 ? 'even-depth' : 'odd-depth'}" id="${comments.id}">
<details open>
<summary>
<p class="author">${commentAuthor(comments, classlist, submitter && submitter_link, moderator && moderator_badge)}</p>
@@ -124,7 +124,7 @@ module.exports = function() {
edited_span = `<span title="this comment is edited">*</span>`
}
comments_html += `
<div class="comment" id="${comment.id}">
<div class="comment ${comment.depth % 2 === 0 ? 'even-depth' : 'odd-depth'} id="${comment.id}">
<details open>
<summary>
<p class="author">${commentAuthor(comment, classlist, submitter && submitter_link, moderator && moderator_badge)}</p>