Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Maccimo/3ec42d94125cc5558859 to your computer and use it in GitHub Desktop.
Save Maccimo/3ec42d94125cc5558859 to your computer and use it in GitHub Desktop.
(function() {
// Mark all comments on habrahabr as unread.
var nextNew = $("#xpanel .next_new");
var prevNew = $("#xpanel .prev_new");
var newCounter = $("#xpanel .new");
var allHeads = $(".comment__head");
var allComments = $(".content-list__item_comment");
allHeads.addClass("comment__head_new-comment");
allComments.addClass("js-comment_new");
var allCommentsCount = allComments.length;
var hasComments = (allCommentsCount > 0);
if (hasComments) {
newCounter.text(allCommentsCount);
}
newCounter.toggle(hasComments);
prevNew.toggle(hasComments);
nextNew.toggle(hasComments);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment