diff --git a/js/card.js b/js/card.js index e0580d6..1873d37 100644 --- a/js/card.js +++ b/js/card.js @@ -157,7 +157,7 @@ export const card = (() => { const renderContent = (comment, is_parent) => { return `
-
+
${renderBody(comment, is_parent)}
${renderTracker(comment)} diff --git a/js/comment.js b/js/comment.js index 6730bf7..d18583d 100644 --- a/js/comment.js +++ b/js/comment.js @@ -358,6 +358,7 @@ export const comment = (() => { showHide.set('hidden', traverse(res.data, showHide.get('hidden'))); comments.innerHTML = res.data.map((c) => card.renderContent(c)).join(''); res.data.forEach(fetchTracker); + res.data.forEach(addEventLike); return res; }); @@ -405,6 +406,15 @@ export const comment = (() => { anchor.setAttribute('data-show', isCollapsed ? 'true' : 'false'); }; + const addEventLike = (comment) => { + if (comment.comments) { + comment.comments.forEach(addEventLike); + } + + const bodyLike = document.getElementById(`body-content-${comment.uuid}`); + bodyLike.addEventListener('touchend', () => like.tapTap(bodyLike)); + }; + const fetchTracker = (comment) => { if (!session.isAdmin()) { return;