Sorting Comments

post by troll · 2013-04-24T16:35:49.720Z · LW · GW · Legacy · 11 comments

I'd like to be able to sort comments as a list, too.

An example of this would be sorting comments by new as a list so all the comments you read will be new ones.

11 comments

Comments sorted by top scores.

comment by jamesf · 2013-04-24T23:39:53.524Z · LW(p) · GW(p)
  1. Open thread
  2. There's not a "person who makes all the site changes people want". Site changes seem to always be on a volunteer basis (meaning, do it yourself if you want it badly).
Replies from: troll
comment by troll · 2013-04-25T01:25:17.978Z · LW(p) · GW(p)

Open thread? What?

Nice! How do I go about adding a feature to the site that everyone can use?

Replies from: Qiaochu_Yuan
comment by faul_sname · 2013-04-24T23:52:48.159Z · LW(p) · GW(p)

Open the web console. Paste the following in. Hit enter.

if(jQuery('.new-comment').length > 0) jQuery('.comment').not('.new-comment').children().filter('.entry').hide()
Replies from: troll
comment by troll · 2013-04-25T01:14:28.641Z · LW(p) · GW(p)

Thanks!

Is there any way to make this a little more automatic for the future?

Replies from: endoself
comment by endoself · 2013-04-25T02:21:59.279Z · LW(p) · GW(p)

You can make it into a bookmarklet and add it to your bookmarks bar. I don't know what browser you're looking for, but you can google for specific instructions if you don't know how.

Replies from: troll
comment by troll · 2013-04-25T03:35:17.290Z · LW(p) · GW(p)

Yup. I did that first thing.

But how do I sort the comments by new (and as a list?) Seeing only new comments is useful, but what about chronological ordering for all comments?

Replies from: endoself
comment by endoself · 2013-04-25T17:43:21.533Z · LW(p) · GW(p)
(function($) {if($('.new-comment').length > 0) { var time = function(c) { return parseInt(jQuery(c).find('.comment-date').attr('time')); }; var new_comments = $('.new-comment').sort(function(a, b) { return time(b) - time(a); }); $('.realcomment').after(new_comments); }})(jQuery);

This should work. I put the newest ones first, but you can switch that by changing

time(b) - time(a)

to

time(a) - time(b)
comment by Decius · 2013-04-24T19:37:07.207Z · LW(p) · GW(p)

How does that differ from "Sort By:New"?

Replies from: troll, Vladimir_Nesov
comment by troll · 2013-04-24T21:55:06.289Z · LW(p) · GW(p)

That's in a tree. (new posts under old ones won't be before the old ones)

comment by Vladimir_Nesov · 2013-04-24T20:16:34.914Z · LW(p) · GW(p)

Flat instead of nested.