LiveJournal Thread Expander with Expand All
http://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
(
Read more... )
--- userjs_off/LJ_Thread_Expander.js 2009-11-30 18:55:28.000000000 +0300
+++ userjs/LJ_Thread_Expander.js 2009-11-30 20:23:01.152321910 +0300
@@ -21,14 +21,24 @@
// @include http://*.dreamwidth.org/*
// ==/UserScript==
+/*
+ globals
+*/
+
+var myWindow;
+var info;
+var needIndent;
+var allExpand;
+
+function LJ_Thread_Expander_init()
+{
/* Experimental feature: don't handle nested frames (e.g. the ads).
However, this means you can't embed your journal in a frameset. */
-if (window != window.parent) exit;
+if (window != window.parent) return;
/* unsafeWindow is a GreaseMonkey variable that gives you access to
the document's original window object. If it's not defined
(Opera?) then try defaulting back to the original window. */
-var myWindow;
if (typeof unsafeWindow == "undefined") myWindow = window;
else myWindow = unsafeWindow;
@@ -38,14 +48,14 @@
/* Need the "LJ_cmtinfo" meta-info from the original comment page */
if (JSdisabled) myWindow.LJ_cmtinfo = getLJcmtinfo(document);
-var info = myWindow.LJ_cmtinfo;
+info = myWindow.LJ_cmtinfo;
if (info == undefined) return;
/* used later for copyIndent function */
-var needIndent=1;
+needIndent=1;
/* First find out whether LiveJournal has put Expand links on */
-var allExpand = xpath("//a[contains(@onClick,'Expander')]");
+allExpand = xpath("//a[contains(@onClick,'Expander')]");
/* If it has, fix them up - if not, create them */
makeExpandLinks(info);
@@ -54,6 +64,9 @@
if (allExpand.length) addExpandAll();
/* That's all, except the function definitions... */
+}
+//LJ_Thread_Expander_init();
+document.addEventListener('load',LJ_Thread_Expander_init, false);
/* getLJcmtinfo(context)
* If JavaScript is disabled, this function searches through the
Reply
Leave a comment