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.
This commit is contained in:
Adhityaa Chandrasekar 2019-10-06 16:55:06 -07:00
parent c2bda4abc6
commit b2b8d1b5d0

View File

@ -68,6 +68,7 @@
var root = null; var root = null;
var cssOverride; var cssOverride;
var noFonts; var noFonts;
var hideDeleted;
var autoInit; var autoInit;
var isAuthenticated = false; var isAuthenticated = false;
var comments = []; var comments = [];
@ -1008,9 +1009,19 @@
append(card, header); append(card, header);
append(card, contents); append(card, contents);
console.log(children);
if (comment.deleted && (hideDeleted === "true" || children === null)) {
return;
}
append(cards, card); append(cards, card);
}); });
if (cards.childNodes.length === 0) {
return null;
}
return cards; return cards;
} }
@ -1937,6 +1948,8 @@
} }
noFonts = attrGet(scripts[i], "data-no-fonts"); noFonts = attrGet(scripts[i], "data-no-fonts");
hideDeleted = attrGet(scripts[i], "data-hide-deleted");
} }
} }
} }