39

Edit

I just brought this up on Meta.SE. Although it isn't a very high priority, hopefully it'll get fixed. This bug is slowly starting to annoy me more and more.


I just noticed while upvoting a comment today, that right after it is upvoted, the color of the cool comment score became black:

Black vote count on comment

but, once the page is refreshed, and from then on, it became grey:

Grey vote count on comment

I also noticed that the HTML for the comment score that was initially upvoted (the non-colored one) was:

<td class=" comment-score">
    <span title="number of 'useful comment' votes received" class>1</span>
</td>

Whereas the HTML for the comment score after the page was refreshed is:

<td class=" comment-score">
    <span title="number of 'useful comment' votes received" class="cool">1</span>
</td>

It looks like it could be something that could have been by design, but, due to the fact that the Supernova class is missing in new design, and because it only happens with cool comments, I don't think it's meant. If it is meant, I don't think that it looks very good as-is.

This only happens on cool comments, and on both MSO and SO

7
  • 17
    looks like a javascript bug to me
    – tbodt
    Commented Jan 23, 2015 at 0:06
  • 9
    Oh god I'm really color blind. I see both of them dark blue.
    – GLHF
    Commented Jan 23, 2015 at 17:07
  • 23
    @tbodt lets use jQuery to fix it
    – Braiam
    Commented Jan 23, 2015 at 17:08
  • 8
    Why couldn't this be by design (to make it more obvious to you what you just voted on)?
    – Joe
    Commented Jan 23, 2015 at 17:20
  • 5
    I just run $('.comment-score span').addClass('hot'); in a user script because I am aroused by comments. Commented Jan 23, 2015 at 19:51
  • 6
    @Joe: Why does it need to be more obvious what you just voted on? You just voted on it... Commented Jan 24, 2015 at 18:37
  • 5
    Man, this title "What is a cool comment?" on the Hot Meta Posts board was very misleading Commented Jan 26, 2015 at 22:50

1 Answer 1

31

I found the bug. Here's the relevant JavaScript:

renderScore: function (score) {
    var result = "";
    if (score && score > 0) {
        var css = score < 5 ? '' : score <= 15 ? 'warm' : score <= 30 ? 'hot' : 'supernova';
        result += '<span title="' + "number of 'useful comment' votes received" + '" class="' + css + '">' + score + '</span>';
    }
    this.jComment.find(".comment-score").html(result);
}

For some insufficient reason, 'cool' was replaced by ' in line 4 of that snippet. The result is that comments with a score of less than 5 end up with a class of '', instead of 'cool'.

My best guess for why this happened is that someone removed the class at the request of a blackmailing unicorn.

4
  • 3
    FWIW, you can find the unminified JS code by changing the hostname from cnd.sstatic.net to cdn-dev.sstatic.net in the script URL. (Alas, it doesn't work for the chat JS, though.) Commented Jan 24, 2015 at 16:05
  • 3
    @IlmariKaronen Edited to include unmagnified code.
    – tbodt
    Commented Jan 24, 2015 at 21:26
  • 3
    I'm slightly red colorblind and didn't even notice that the colors changed based on votes before! Commented Jan 24, 2015 at 22:58
  • 2
    I've just added a client-side fix for this bug to the SOUP devel branch. It works by listening for comment (un)vote AJAX events (which are how the renderScore method gets called) and setting the score class to cool if it is empty. Thanks for figuring out where the problem was! Commented Feb 26, 2015 at 23:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .