Here is a JavaScript bookmarklet to make the comments in Hacker News collapsible (reddit style) by clicking on the [-] icon next to each comment.
(Drag the above link to your bookmarks bar or right click and add to your bookmarks.)
Usage: When the page is loaded, click on the [-] icon in your bookmarks bar. Each comment in the page will show a small handle [-] to collapse the comment and its children. Once you click and collapse the comment, the icon changes to [+] and you can click again to expand the comment (and its children).

This fixes a few issues with the script by Alexander Kirk, like collapsed child comments expanding when the parent is expanded. In addition to these this script will work in the threads page of hacker news. Also this bookmarklet will load faster than the script by Alexander since there is no call to any external JS file from my server. The only file you have to load is the latest jQuery from the jQuery website and chances are good that the file is already present in your browser cache. (The downside is that you will not be able to get the latest version when I update the code).
If you want to play around with the code, head to github: Collapsible comments for Hacker News
You my also want to checkout the no-nonsense URL shortener bookmarklet. It is super-fast and does not redirect you anywhere. It just displays the shortened URL in the corner of your web page.

(Drag the above link to your bookmarks bar or right click and add to your bookmarks.)
Usage: When the page is loaded, click on the [-] icon in your bookmarks bar. Each comment in the page will show a small handle [-] to collapse the comment and its children. Once you click and collapse the comment, the icon changes to [+] and you can click again to expand the comment (and its children).
This fixes a few issues with the script by Alexander Kirk, like collapsed child comments expanding when the parent is expanded. In addition to these this script will work in the threads page of hacker news. Also this bookmarklet will load faster than the script by Alexander since there is no call to any external JS file from my server. The only file you have to load is the latest jQuery from the jQuery website and chances are good that the file is already present in your browser cache. (The downside is that you will not be able to get the latest version when I update the code).
If you want to play around with the code, head to github: Collapsible comments for Hacker News
You my also want to checkout the no-nonsense URL shortener bookmarklet. It is super-fast and does not redirect you anywhere. It just displays the shortened URL in the corner of your web page.
No comments:
Post a Comment