From b2b8d1b5d0667a5aadc47f809c5198bfa2970b01 Mon Sep 17 00:00:00 2001 From: Adhityaa Chandrasekar Date: Sun, 6 Oct 2019 16:55:06 -0700 Subject: [PATCH] commento.js: hide deleted if children are deleted This also adds a data-hide-deleted data tag that allows you to hide deleted comments even if they have undeleted children. --- frontend/js/commento.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/frontend/js/commento.js b/frontend/js/commento.js index 2745f16..072b75b 100644 --- a/frontend/js/commento.js +++ b/frontend/js/commento.js @@ -68,6 +68,7 @@ var root = null; var cssOverride; var noFonts; + var hideDeleted; var autoInit; var isAuthenticated = false; var comments = []; @@ -1008,9 +1009,19 @@ append(card, header); append(card, contents); + + console.log(children); + if (comment.deleted && (hideDeleted === "true" || children === null)) { + return; + } + append(cards, card); }); + if (cards.childNodes.length === 0) { + return null; + } + return cards; } @@ -1937,6 +1948,8 @@ } noFonts = attrGet(scripts[i], "data-no-fonts"); + + hideDeleted = attrGet(scripts[i], "data-hide-deleted"); } } }