Last active
August 16, 2017 08:30
-
-
Save Maccimo/3ec42d94125cc5558859 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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