LiveJournal Thread Expander with Expand All
http://userscripts.org/scripts/show/2712I'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
- If you have JavaScript disabled then it will replace the non-working JavaScript actions on any existing Expand links so that you can still use them. Yes, I'm aware that I'm probably the only person in the world who browses with Greasemonkey enabled and JavaScript disabled…
Some points to note
The 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).
Background
In 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 inAlthough 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.
Updates
- 2010-06-30: LiveJournal made a small change that broke the script's JS-detection, meaning the script stopped working on browsers with JavaScript enabled — a small fix has been applied. Also changed one line that got left out of the previous Opera fixes.
- 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.
May 23 2008, 12:53:19 UTC 3 years ago
May 23 2008, 14:12:01 UTC 3 years ago
You did make me LOL with "probably the only person in the world who browses with Greasemonkey enabled and JavaScript disabled", but I suspect you're wrong - you can't be the only nutter in the world. ;)
May 23 2008, 14:22:20 UTC 3 years ago
Oh well. It demonstrates my LJ + Geek credentials though, no? ;-)
Um. What??
I know, it's probably a Firefox extension. I don't do Firefox extensions, because I use SeaMonkey — which brings me to…
Still sure? :-)
3 years ago
May 23 2008, 21:07:51 UTC 3 years ago
In opera...
... save as .user.js to clue opera in to greasemonkey notation(in particular, make the js run after the page has finished loading)
... have user js which supplies GM_ functions for opera
(maybe only needed for the GM_log debugging)
... top-level 'return' is a syntax error, I replaced with 'exit'
... unsafeWindow is a greaseMonkey object, replace instances with 'window'
seems to be working now. Ace.
(can we have a 'collapse again' in V2?)
May 5 2009, 15:11:35 UTC 3 years ago
Re: In opera...
A year late, but I've tried to incorporate the above points in the current version of the script.As for V2, I guess that's a long way off. ;-)
3 years ago
2 years ago
April 25 2009, 07:20:10 UTC 3 years ago
April 25 2009, 07:20:39 UTC 3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
May 4 2009, 16:31:11 UTC 3 years ago
"Expand all" function unavaiable on some journals, maybe it depends of a style used.
May 5 2009, 15:09:38 UTC 3 years ago
July 8 2009, 16:03:37 UTC 2 years ago
August 22 2009, 21:15:34 UTC 2 years ago
November 24 2009, 06:19:31 UTC 2 years ago
November 30 2009, 16:53:37 UTC 2 years ago
November 30 2009, 17:27:37 UTC 2 years ago
December 11 2009, 23:22:24 UTC 2 years ago
it adds (to developer's version of Chrome), but doesn't unfold anything
any plans for Chrome?
December 11 2009, 23:23:00 UTC 2 years ago
it adds itself, and many scripts work fine
2 years ago
2 years ago
January 20 2010, 13:47:10 UTC 2 years ago
Yes, I'm aware that I'm probably the only person in the world who browses with Greasemonkey enabled and JavaScript disabled…
Now there's an intriguing thought.
March 6 2010, 15:05:22 UTC 2 years ago
March 30 2010, 14:53:21 UTC 2 years ago
May 7 2010, 18:08:07 UTC 2 years ago
June 30 2010, 11:54:49 UTC 1 year ago
I've tried it on 2 different computers, both running Firefox 3.5.10 (I think it's the same version or very close to it) and running Mac OS 10.5.8 Leopard on Intel Macs.
I haven't changed anything on my side, and I've tried reinstalling the script to no avail. Perhaps LJ did something to break it?
June 30 2010, 13:38:05 UTC 1 year ago
I think I've found out what the problem is and made a small fix, so try fetching a new copy.
Anonymous
July 6 2010, 12:38:46 UTC 1 year ago
August 1 2010, 02:05:55 UTC 1 year ago
I installed Greasemonkey just fine. But when I went to install the script, the Install button at the top of the page refuses to do anything. It looks as if it's being depressed or clicked or whatever, but it just pops up again and doesn't do anything.
Any idea what the problem might be?
August 4 2010, 15:52:13 UTC 1 year ago
You should have restarted the browser after installing Greasemonkey, and you should then see a little monkey face in the status bar at the bottom right corner. Mousing over this should say "Greasemonkey is enabled", and right-clicking on it should give the Greasemonkey options menu. Left-clicking on it will turn it grey and disable Greasemonkey (click again to re-enable).
If that's all working, then clicking on Install on the web page for a Greasemonkey script should cause the Greasemonkey dialogue to appear. Otherwise… I'm not really sure what the problem is.
August 15 2010, 01:37:03 UTC 1 year ago
August 15 2010, 04:14:22 UTC 1 year ago
Any ideas of what might be causing this?
August 15 2010, 21:15:12 UTC 1 year ago
However, one time when I did it, it took a few minutes on high CPU before the save dialogue appeared. I'm guessing that the more comments there are on the page the more work it has to do, and I think it has to redraw the current document into a canvas which will be saved as an image — which means that more complicated documents (with lots of expanded comments) take longer and use more memory. But I've no idea how the Screen Capture extension works really so I don't think I can be much help in getting it to work, I'm afraid.
April 6 2011, 01:45:43 UTC 1 year ago
April 6 2011, 10:50:02 UTC 1 year ago
It seems that some LiveJournal styles display screened comments as collapsed comments from "anonymous". If the comment is screened rather than being truly anonymous then obviously expanding it won't work.
1 year ago
1 year ago
September 20 2011, 23:06:22 UTC 7 months ago
September 22 2011, 14:14:33 UTC 7 months ago