LiveJournal Thread Expander with Expand Allhttp://userscripts.org/scripts/show/27128
I've hacked up a Thread Expander script for Greasemonkey. It has only been tested on a small number of layouts, but it seems to work for me so please bang on it and report any breakages here.
For recent updates see below.
What does it do?We've all encountered this behaviour before and been irritated by it: if a LiveJournal post has 50 or more comments on it, LiveJournal will start collapsing the threads so that the deepest comments are only visible as one-line summaries. If you click on one, it opens a separate page with just that subthread on it. This Greasemonkey script adds an "Expand" link which expands the thread in-place so that you can read the thread in its original context. In addition, you get an "Expand All" link at the top (and bottom) of the comments page.
How do I install it?It is a Greasemonkey script. If you are using Firefox and don't have Greasemonkey installed then you must first download it. Then, when you visit the userscripts.org link above and press "Install this script" you should see a dialogue offering to install it.
The script has been extensively tested on Seamonkey 1.x and should therefore also work on Firefox 2.x. I am aware that there is a Greasemonkey for Internet Explorer, but it is unlikely to work on that. It may work on Safari and/or Opera — I have no information about those browsers so try it and see.
Doesn't LiveJournal offer this functionality now?Yes, but only for paid users (or if you are viewing a paid journal). If the script detects Expand links already on the page, it won't add any more (unlike some of the other Greasemonkey scripts available). You also get the following benefits:
- Open to all, not just paid users;
- A very useful Expand All link, and
Some points to noteThe Expand All function tries hard to expand each thread only once, which means it is lightning fast compared to all previous attempts to implement an unfold-all feature. This does mean, however, that it might not succeed in opening all threads fully on the first click. Just click on it again if any collapsed threads remain after the first go. The advantage of doing it this way is that you don't unwittingly tie up your browser for hours if you try to expand a page that is very deeply nested with hundreds of comments.
Some parts of this script are layout-dependent and one bit of it also depends on the "Thread" links on the page being in English (however, this is only for adding an Expand link to the parent of a collapsed thread, so it only matters if you don't already have Expand links on the page and it should still successfully create the Expand links for collapsed comments). It is layout-dependent because it needs to know where to add the "Expand All" link at the top of the page and where to add an Expand link to the parent of a collapsed thread. It has been extensively tested on site-scheme comment pages; it has also been lightly tested on Expressive and Generator layouts. Other layouts can probably be added if you direct me to an example of said layout (although if it's one that uses images rather than text for the thread links on each comment then adding the word Expand might look slightly out of place).
If you are viewing LiveJournal from within a frameset then the script currently won't work for you (but you could try removing the first line of code to fix this if you felt up to it).
BackgroundIn the beginning there was Tim Babych's LJ Thread Unfolder. This looks like it is still being maintained to some extent, but does not have an Unfold All option. That option was hacked in by Henrik N in LJ Thread Unfolder with Unfold all. However, Henrik's script broke when LiveJournal introduced its own thread expander — click on the Unfold link and the whole thread disappears. Meanwhile, LJ Thread Unfolder &mdash Unfold All, All layouts was a different variation on the original script, this time by MrMord, which still carried on working. The disadvantage of MrMord's variation is that it only unfolds a single comment each time you click on an Unfold link. I once rendered my browser unusable for 90 minutes by clicking on the Unfold All from this script on a particularly nasty thread in news. My script returns in under a minute on that page, but this is due to the advantage of not attempting to expand every single comment: it still leaves quite long sections of the thread unexpanded on the first click, whereupon you can then decide whether it is worth expanding them further. The second click takes a slightly less impressive eight minutes and still leaves a few of the deepest threads collapsed.
Although this script borrows some ideas (and possibly a few lines of code) from its predecessors and also from LiveJournal's own thread expander, it is a complete rewrite from scratch.
- 2009-05-05: Added dreamwidth.org to list of included sites and fixed the script to work on one of their styles (the one used for dw_news). Made a few fixes to try to make it more Opera-friendly.