function buildCommentHTML(comment) { var iconSmallOverflowHorizontal = ``; var iconCollapse = ``; var iconExpand = ``; var depthClass = ""; var customClass = ""; var detailsStartHTML = ""; var detailsEndHTML = ""; var commentHeader = ""; var commentFooter = ""; var commentAvatar = ""; var commentBody = ""; if ( comment.depth == 0 ) { depthClass += "root "; } else { depthClass += "child " } if ( comment.depth > 3 ) { depthClass += "comment--too-deep "; } if (comment.newly_created) { customClass = "comment-created-via-fetch" } if (comment.depth < 3) { detailsStartHTML = `
${ iconCollapse } ${ iconExpand } `; detailsEndHTML = `
`; } commentAvatar = ` ${ comment.user.username } profile `; commentHeader = `
${ comment.user.name }
`; commentFooter = ``; commentBody = `${ detailsStartHTML }
${ commentAvatar }
${ commentHeader }
${ comment.body_html }
${ commentFooter }
${ detailsEndHTML }`; return commentBody; } function reply(comment) { var iconSmallComment = ``; var replyButton = ` ${ iconSmallComment } `; if (comment.newly_created) { return replyButton; } } function react(comment) { var reactedClass = ""; var num = 0; var iconSmallHeart = ``; var iconSmallHeartFilled = ``; if (comment.newly_created) { num = 1; } else { num = comment.public_reactions_count; } if (comment.newly_created || comment.heart_ids.indexOf(userData().id) > -1) { reactedClass = "reacted" } var reactButton = ``; return reactButton; }