top | item 8706496

Show HN: Collapse HN Comments

141 points| Igglyboo | 11 years ago |github.com | reply

Little chrome extension I made to collapse comments on HN, feel free to use it if you want.

57 comments

order
[+] sillysaurus3|11 years ago|reply
I've been using this: http://hckrnews.com/about.html#extensions

In addition to collapsing threads, it also tastefully identifies new comments: http://i.imgur.com/qs6FDRU.png

It doesn't mess with the layout beyond that, which I like.

By the way, http://hckrnews.com/ itself is wonderful. It's HN, but in chronological order. That seems like a bad thing, but in fact there are only a few dozen submissions per day, and it's easy to pick out the interesting ones.

[+] graedus|11 years ago|reply
Nice, I'll try that. Here's my bookmarklet for highlighting recent comments (subtly for <1h old, less subtly for <10m old):

  javascript:var jq=document.createElement("script");jq.src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";document.getElementsByTagName("head")[0].appendChild(jq);window.setTimeout(function(){jQuery.noConflict();jQuery("span.comhead:contains('minutes ago')").parent().parent().css("background","#fdfdf0");jQuery("span.comhead:contains(' 0 minutes ago'), span.comhead:contains(' 1 minutes ago'), span.comhead:contains(' 2 minutes ago'), span.comhead:contains(' 3 minutes ago'), span.comhead:contains(' 4 minutes ago'), span.comhead:contains(' 5 minutes ago'), span.comhead:contains( '6 minutes ago'), span.comhead:contains(' 7 minutes ago'), span.comhead:contains(' 8 minutes ago'), span.comhead:contains(' 9 minutes ago'), span.comhead:contains(' 10 minutes ago') ").parent().parent().css("background","#ffffe9")},500)
[+] nilkn|11 years ago|reply
I've seen this linked to, but I never understood what the selling point was. It turns out I never realized that it sorted the posts in chronological order according to when they first appeared on the front page. Pretty cool! This definitely feels good for someone like me who refreshes the front page repeatedly throughout the day. I don't have to expend energy trying to figure out what's new.
[+] Fuzzwah|11 years ago|reply
I've been using the Hacker News Enhancement Suite extension for Chrome for so long I couldn't imagine using the site with out it.

https://chrome.google.com/webstore/detail/hacker-news-enhanc...

edit: I'll also mention that I use http://hckrnews.com/ as my frontpage for HN.

[+] dubin|11 years ago|reply
Highly recommended. Of all the Hacker News styles I've tried, this has been the only one that I've used consistently.

Notably, it preserves the compactness of the front page. A lot of other styles tend to space out stories on the front page too much, which makes it harder to read through.

I do wish there was a similar theme for Firefox.

[+] throwaway_yy2Di|11 years ago|reply
I love how every comment here links to a different implementation.

I also made one (for Firefox/Greasemonkey),

https://github.com/tom-szczarkowski/hn-stuff

[+] brianpan|11 years ago|reply
It almost seems as if it's an essential feature for browsing HN in a sane way.

Naw, everyone replying to the top comment in a post in order to be seen is probably fine.

[+] rbdn|11 years ago|reply
I’ve also hacked bigger voting buttons (for the sake of Fitt’s law [1]) and some indentation marks [0] which I find quite helpful, both included with ~/.js [2].

[0]: https://i.imgur.com/Bp3ra28.png

[1]: https://en.wikipedia.org/wiki/Fitts%27s_law

[2]: https://github.com/defunkt/dotjs

    td { vertical-align: top }
    td > img { background: repeating-linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,0) 38px, rgba(0,0,0,0.3) 38px, rgba(0,0,0,0.3) 40px); margin-top: 4px; height: 12px!important }
    div.votearrow { padding-bottom: 3px; background: url('https://i.imgur.com/UVPQXRX.png') !important; width: 20px!important;}
[+] evo_9|11 years ago|reply
I still don't get why HN is against adding features like this or open links in new windows/tab AS AN OPTION.

I get that some people don't want anything to change on HN - no problem - but what is the harm in adding features that we individually can turn on that would not effect anyone else? Aka, add the features but have them off by default.

[+] trevmckendrick|11 years ago|reply
Their desired audience is hackers.

Pure speculation, but maybe they know the best hackers will find solutions around all this (e.g. all the extensions linked to in this thread).

[+] yzzxy|11 years ago|reply
I have it on good authority that comment collapse is rolling out at some point in the near future.
[+] 542458|11 years ago|reply
Cool! For non chrome people, I've been using this bookmarklet since forever

    javascript:(function()%7Bfunction%20getScript(url,success)%7Bvar%20script=document.createElement('script');script.src=url;var%20head=document.getElementsByTagName('head')%5B0%5D,done=false;script.onload=script.onreadystatechange=function()%7Bif(!done&&(!this.readyState%7C%7Cthis.readyState=='loaded'%7C%7Cthis.readyState=='complete'))%7Bdone=true;success();script.onload=script.onreadystatechange=null;head.removeChild(script)%7D%7D;head.appendChild(script)%7DgetScript('//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js',function()%7Bif(typeof%20jQuery!=='undefined')%7Bif(!$('body').hasClass('collapsible-comments'))%7B$('body').addClass('collapsible-comments');var%20span_html='%3Cspan%20style=%5C'cursor:pointer;margin-right:10px;%5C'%20class=%5C'expand-handle%5C'%3E%5B-%5D%3C/span%3E';if(window.location.href.indexOf('item?id=')!=-1)%7B$('center%20%3E%20table%20%3E%20tbody%20%3E%20tr:eq(2)%20%3E%20td%20%3E%20table:eq(1)%20span.comhead').prepend(span_html)%7Delse%20if(window.location.href.indexOf('threads?id=')!=-1)%7B$('center%20%3E%20table%20%3E%20tbody%20%3E%20tr%20%3E%20td%20%3E%20table%20span.comhead').prepend(span_html)%7D$('.expand-handle').live('click',function()%7Bcurrent_level_width=parseInt($(this).closest('tr').find('td:eq(0)%20%3E%20img').attr('width'),10);$(this).closest('table').closest('tr').nextAll().each(function(index,el)%7Bvar%20elWidth=parseInt($('tbody%20%3E%20tr%20%3E%20td%20%3E%20img',this).attr('width'),10);if(elWidth%3Ecurrent_level_width)%7Bif(elWidth%3C=inner_level_width)%7Binner_level_width=1000;$(this).hide()%7Dif(inner_level_width==1000&&$('.comment',this).css('display')=='none')%7Binner_level_width=elWidth%7D%7Delse%7Breturn%20false%7D%7D);inner_level_width=1000;$(this).text('%5B+%5D').addClass('expand-handle-collapsed').removeClass('expand-handle');$(this).closest('div').nextAll().hide();$(this).closest('div').parent().prev().hide();$(this).closest('div').css(%7B'margin-left':'18px','margin-bottom':'5px'%7D)%7D);$('.expand-handle-collapsed').live('click',function()%7Bcurrent_level_width=parseInt($(this).closest('tr').find('td%20%3E%20img').attr('width'),10);$(this).closest('table').closest('tr').nextAll().each(function(index,el)%7Bvar%20elWidth=parseInt($('tbody%20%3E%20tr%20%3E%20td%20%3E%20img',this).attr('width'),10);if(elWidth%3Ecurrent_level_width)%7Bif(elWidth%3C=inner_level_width)%7Binner_level_width=1000;$(this).show()%7Dif(inner_level_width==1000&&$('.comment',this).css('display')=='none')%7Binner_level_width=elWidth%7D%7Delse%7Breturn%20false%7D%7D);inner_level_width=1000;$(this).text('%5B-%5D').addClass('expand-handle').removeClass('expand-handle-collapsed');$(this).closest('div').nextAll().show();$(this).closest('div').parent().prev().show();$(this).closest('div').css(%7B'margin-left':'0','margin-bottom':'-10px'%7D)%7D)%7D%7D%7D);var%20current_level_width=0;var%20inner_level_width=1000%7D)();
[+] TazeTSchnitzel|11 years ago|reply
This works great! Firefox users: you can simply drag that text to your bookmarks bar.
[+] tux3|11 years ago|reply
Awesome! This goes right into my userscripts.
[+] rgbrenner|11 years ago|reply
Thanks. Works in chrome too btw
[+] Igglyboo|11 years ago|reply
Little chrome extension I made for personal use, feel free to use it if you want.

It will allow you to collapse comment trees on HN.

[+] diminish|11 years ago|reply
On HN Most discussions are stolen by remotely related comments.. This extension helps to dig them for me. Thanks.
[+] sanqui|11 years ago|reply
All I'd like is to be able to click on the left margin of a post to skip under it. Sometimes it's just that the first comment has too many replies and I'd like to jump past it easily.
[+] rcfox|11 years ago|reply
I have also wanted this for a long time. I think you'd have to go back to the top of the parent, or else you'd wind up jumping way past the end of that thread.
[+] teach|11 years ago|reply
That's a really nice HCI idea. Maybe not too discoverable but very very easy to "trigger" when you want it.
[+] reledi|11 years ago|reply
I've been using "Reddit-Style Comments for Hacker News" [1] for years, works great.

1: https://github.com/andrewheins/HN-Comment-Hider

edit: This has the collapse button between the voting arrows and username, just like reddit. Seems like something minor, but it's a big detail. (1) I'm used to that location from reddit, and (2) it doesn't move, which isn't the case with many other extensions that have it on the end.

[+] crescentfresh|11 years ago|reply
Dropped the .crx onto the Extensions page.

http://i.imgur.com/t46u0C5.png

Thanks Chrome!

[+] OzzyB|11 years ago|reply
On your Chrome's Extension page there should be a "Developer mode" checkbox on the top-left.

Check that and you should be presented with a "Load unpacked extension" that you can use to install extensions locally.

[+] Houshalter|11 years ago|reply
I would greatly appreciate if anyone knows how to get around this. I never thought I'd need to jailbreak my browser.
[+] thebrokencube|11 years ago|reply
Despite there being a whole bunch of implementations out there, I had also written one a while ago: https://github.com/thebrokencube/yahnes . It does need some updating, but seems to work well enough for my use (plus, I just wanted to scratch my own itch).

Probably best to sort of consolidate some of these into a few really good ones, but we'll see.