3 ms·
Nice, I'd really like one to collapse all second-level comments. There's enough 1000+ comment links now that the top comment takes up the entire page and every
by BelenusMordred 5y ago
Nice, I'd really like one to collapse all second-level comments. There's enough 1000+ comment links now that the top comment takes up the entire page and everyone wandering in tends to just respond to that or the children rather than numerous others making valid points.
- leephillips 5y agoThe extension “Refined Hacker News” for Chrome lets you click to collapse a comment thread.
- rashkov 5y agoThis is now a feature of hacker news itself, as of a year or two ago (?). No extension required. I think the parent comment wants a feature to collapse all comment threads at the same time, so only the top level comments are visible.
- appleflaxen 5y agoCan you elaborate? The feature seems nice, but I access HN on multiple browsers for which a plugin isn't workable. Looking at settings and links on the page I don't see any functionality like you describe.
- jraph 5y agoClick on [–] at the end of a comment header with JavaScript enabled.
- leephillips 5y agoAh, that’s right. (It’s the [-] link in the comment header.) RFN does have a link at the top of the story page called "toggle all commments," but I guess it’s broken, as it only seems to toggle the first comment. The extension does have a convenient feature, a [collapse root] link on each comment in a thread, so you can collapse the thread from within it, without having to find its origin.
- plibither8 5y agoHi! Creater of Refined Hacker New here :). You mentioned that the "toggle all comments" button is broken, could you elaborate a bit more on that, and if possible open a GitHub issue for it? Thanks a lot :D. Apart from that, with RHN you can navigate through the comments using the "J" and "K" keyboard keys and Press "Enter" on the highlighted comment to toggle it. Hope that helps too, cheers :)
- leephillips 5y agoThanks for the great extension, it makes reading HN more...refined. Well, I tried the [toggle all comments] button on a couple of stories before posting my comment, and it was only toggling the first comment. But I did more testing for this reply, and now it’s working as advertised. I can’t explain that, but if I every figure out the conditions that prevent it from working, I’ll open an issue.
- plibither8 5y agoAlright, glad it's working now! And thanks for the kind words, appreciate it.
- deleted 5y ago[deleted]
- leppr 5y agoThis should do the trick: [ ...document.querySelectorAll('td.ind[indent="1"] + td.votelinks + td.default .comhead > .togg') ].forEach(div => div.click())
- Mindless2112 5y agohttps://hackerweb.app/ https://hackerweb.app/ does this for items with a lot of comments. HN should copy this feature. The top thread dominates the discussion all too often.
- qiqitori 5y agoNot the same, but similar? I sometimes use this bookmarklet to jump to the next root thread: javascript:if (typeof hn_next_comment_to_jump_to == 'undefined') { pkqcbcnll = 0 }; document.querySelectorAll("img[src='s.gif'][width='0']")[hn_next_comment_to_jump_to++].scrollIntoView(true);
- sillysaurusx 5y agoThere was a typo (pkqcbcnll should've been hn_next_comment_to_jump_to). Here's a fixed version: javascript:if (typeof hn_next_comment_to_jump_to == 'undefined') { hn_next_comment_to_jump_to = 0 }; document.querySelectorAll("img[src='s.gif'][width='0']")[hn_next_comment_to_jump_to++].scrollIntoView(true); Thanks for this!
- alin23 5y agoAdding the following lines to the script posted by OP should add buttons for doing just that: var collapseButton = document.createElement("button") collapseButton.textContent = "Collapse level 2 comments" collapseButton.onclick = (event) => document .querySelectorAll('td[indent="1"]+td+td.default .togg') .forEach((button) => { if (button.textContent == "[–]") { button.click() } }) var expandButton = document.createElement("button") expandButton.textContent = "Expand level 2 comments" expandButton.onclick = (event) => document .querySelectorAll('td[indent="1"]+td+td.default .togg') .forEach((button) => { if (button.textContent != "[–]") { button.click() } }) var table = document.querySelector("table.comment-tree") table.parentNode.insertBefore(collapseButton, table) table.parentNode.insertBefore(expandButton, table)