[Website usability] Scroll to new comments (v0.3)
I wrote a short userscript1 that allows for jumping to the next (or previous) new comment in a page (those marked with green). I have tested it on Firefox nightly with the Greasemonkey addon and Chromium. Unfortunately, I think that user scripts only work in Chromium/Google Chrome and Firefox (with Greasemonkey).
Download here (Clicking the link should offer a install prompt, and that is all the work that needs to be done.)
It inserts a small box in the lower right-hand corner that indicates the number of new messages and has a “next” and a “previous” link like so:
Clicking either link should scroll the browser to the top of the appropriate comment (wrapping around at the top and bottom).
The ”!” link shows a window for error logging. If a bug occurs, clicking the “Generate log” button inside this window will create a box with some information about the running of the script2, copying and pasting that information here will make debugging easier.
I have only tested on the two browsers listed above, and only on Linux, so feedback about any bugs/improvements would be useful.
(Technical note: It is released under the MIT License, and this link is to exactly the same file as above but renamed so that the source can be viewed more easily. The file extension needs to be changed to “user.js” to be able to run as a user script properly)
Changelog
v0.1 - First version
v0.2 - Logging & indication of number of new messages
v0.3 - Correctly update when hidden comments are loaded (and license change). NOTE: Upgrading to v0.3 on Chrome is likely to cause a “Downgrading extension error” (I’d made a mistake with the version numbers previously), the fix is to uninstall and then reinstall the new version. (uninstall via Tools > Extensions)
1 A segment of javascript that runs in the web browser as the page is loaded. It can modify the page, e.g. inserting a bit of html as this script does.
2 Specifically: the url, counts of different sets of comments, some info about the new comments, and also a list of the clicks on “prev” and “next”.
- 1 May 2012 9:17 UTC; 8 points) 's comment on Open Thread, May 1-15, 2012 by (
- 2 Feb 2017 9:37 UTC; 3 points) 's comment on How often do you check this forum? by (
- 30 Aug 2011 8:38 UTC; 1 point) 's comment on Making it even easier to find new comments in a thread by (
Awesome. Thank you.
Bug report: The next button doesn’t always work. I can’t pin down exactly what circumstances cause this but it seems to happen only if the comment I’m currently on has no children.
I using Firefox 5 on Windows 7, and have comments sorted by “Old”.
Thanks!
How does it not work? e.g. doesn’t do anything, or scrolls to a random spot.
Doesn’t do anything.
Hmmm, I have an tiny idea what might be happening, but I haven’t been able to reproduce it yet, so I’m unwilling to dive in and change things.
If that bug occurs to you (or anyone else) again, could you post a link to the specific comment(s) it occurs on? Thanks!
I accessed this post while it had 27 comments. For me, they were all unread. The “next” button failed to do anything when I was on this comment (i.e. when the top of my screen was aligned with the top of that comment).
Pressing the “prev” button did nothing when the top of my screen was aligned with these comments: http://lesswrong.com/lw/70c/why_are_certain_trends_so_precisely_exponential/4mce
http://lesswrong.com/lw/70c/why_are_certain_trends_so_precisely_exponential/4mcf
http://lesswrong.com/lw/70c/why_are_certain_trends_so_precisely_exponential/4mcc
http://lesswrong.com/lw/70c/why_are_certain_trends_so_precisely_exponential/4mcd
http://lesswrong.com/lw/70c/why_are_certain_trends_so_precisely_exponential/4men
Thank you for that! Unfortunately, I can’t reproduce your bug (and it’s not what I thought it might be): I went through and added the “new comment” marker to those comments and their children, to try to simulate the circumstances, but everything worked fine for me. I’ll update the script to include some logging (EDIT: done).
Has it happened on any other pages?
Aha! The problem is at my end, I’ve been viewing LessWrong zoomed-in slightly. Resetting to the default level of zoom prevents the error from happening.
Nice! Thanks for the effort nonetheless.
This makes my life easier. Have some karma!
was using this for a long time on one computer, just switched to another. This is invaluable.