count.js: allow customizing no comments text

Optional 'data-hide-no-comments-count' allows to hide comments count
when there are no comments.
This commit is contained in:
pawurb 2019-04-17 18:48:03 +02:00
parent f37e26bfc2
commit ff04981cf5

View File

@ -55,7 +55,13 @@
count = resp.commentCounts[paths[i]];
}
doms[i].innerText = count + " " + (count === 1 ? "comment" : "comments");
var useCustomCommentsText = doms[i].getAttribute("data-custom-comments-text") !== null;
if(useCustomCommentsText) {
doms[i].innerText = eval(doms[i].getAttribute("data-custom-comments-text"))(count);
} else {
doms[i].innerText = count + " " + (count === 1 ? "comment" : "comments");
}
}
});
}