Adds a [+] link next to message links on the developerWorks forums to view them inline instead of having to open multiple pages.
This used to be a Greasemonkey script designed to be used with the forums on the Notes.net/LDD/Lotus developerWorks site. ( http://www.lotus.com/ldd )
This has since been reworked into a Chrome extension.
If you have no idea what Greasemonkey used to be, start here:
Firefox users (the original):
http://greasemonkey.mozdev.org/
IE users (the copy):
http://www.daishar.com/blog/archives/2005/03/greasemonkey_fo.html
I've only tested this script with Firefox, so I have no idea how well it
does or doesn't work with IE.
===========================
The problem with the LDD forums is that you can't see the text of any of the
responses associated with a particular message. You get a list of links to the
responses at the bottom of the page, but you can only open a single message at
a time -- which is a huge pain if there are more than about 2 responses to a
message.
What this script does (thanks to the magic of Greasemonkey) is to add a little
[+] next to each response link at the bottom of the page. If you click on that
[+], it will open a <div> beneath the link that will get populated with the
message body for that particular response. Click it again, and the response
body disappears.
As of version 1.3 of the script, the [+] is added on any LDD page that has an
?OpenDocument link, not just a message. So the script works when you're viewing
a message, or the main view of a forum, or even a list of search results.
If none of this makes sense, just go to: http://www-10.lotus.com/ldd/nd6forum.nsf
and open a message that has several responses, and then try to read the responses
with and without this script enabled.
===========================
A few efficiencies I've added to this script:
1. None of the response messages are retrieved until you actually click the [+].
This means when you view a message that has a large number of responses, your
page will still load quickly (i.e. -- the browser won't be trying to get all
of the responses when the page opens). The text of the responses is only
retrieved when you click the [+].
2. If you click on a [+] to view a response message and then click it again to
make it disappear, it will remember what the message is. So if you click it
again to expand the response message before you refresh the page, you won't
have to make another round trip to the server in order to get the message
again -- it'll just come right up.
3. The responses are retrieved using asynchronous XML HTTP requests, which grab
the response doc, parse the message text, and insert it into a <div> (this
process is normally referred to as "Ajax" these days).
===========================
ISSUES:
1. I had to hardcode several things in here, because the LDD forums don't really
package up the messages in any kind of easily parsable way (say, with divs).
Some or all of this script could break tomorrow if the LDD folks decide to rename
some of their image files.
2. There's probably a much more elegant way of doing some or all of this using
regular expressions. I don't know how that way might work, and I don't really care.
This method seems to work, and it's easy to troubleshoot.
3. There may be a few links on the page that get the [+] appended to them that
get an "Error finding beginning of body" message when you try to expand them (like
the FAQ link). This is because the links don't actually point to messages, but other
pages that don't parse like a message will. I thought about adding some code that
explicitly ignores these kinds of links, but all of the exclusions would just
muddy up the code, and I'd probably have to keep adding new ones. So rather than
try to account for all the exceptions, I'm going to assume that my users are smart
enough not to worry about those sorts of things. (UPDATE: in version 1.4 I added the
ignoreList array to deal with at least some of these cases.)
===========================
HISTORY:
version 1.0 -- April 16, 2005
Initial release.
version 1.1 -- April 16, 2005
Fixed bug where the </table> tag I was using to determine the start of the body
block didn't exist when you were logged in, so you wouldn't get message text
if you were logged in.
version 1.2 -- April 17, 2005
Modified the script to make the display div block style "display: none;" when the
div was hidden, to get rid of the extra whitespace/linefeed that was appearing
between each of the response links.
version 1.3 -- April 19, 2005
Changed the script to run against any ?OpenDocument link, not just the response
links that were found at the bottom of a message. This way it will work not only
on message pages, but also on views and search results. Unfortunately, this also
puts a [+] next to some links that won't expand properly (like the forum FAQ links
at the right of the page). I thought about filtering those links out manually,
but it's probably better to have a few links that don't work right rather than
hardcoding several exceptions in this code (there's too much hardcoding as it is).
Also made a small change to account for a different separator graphic on the
ND7 forums, and made the [+] change to [-] when it's "expanded".
version 1.4 -- May 10, 2005
Added the ignoreList array (and relevant ignoreList processing), so we won't
process links that we know will not work. Thanks to Christopher Byrne
(http://controlscaddy.com) for the suggestion and an example of what to ignore.
version 1.5 -- August 14, 2005
Added the endOfBody array (and relevant processing) to account for multiple
possible endings of the body part of the forum message. The forums were slightly
redesigned in late July/early August, and they started using a different graphic
at the end of the body. With the new array, it'll be easier to add new end-of-body
conditions in the future.
version 1.6 -- December 3, 2005
LDDMonkey stopped working when Firefox got upgraded to 1.5. Kurt Higley
(http://www.higs.net) fixed it within a day! His changes included:
* expander.onclick = ... changed to expander.addEventListener('click', ...)
* calls to XMLHttpRequest changed to GM_xmlhttpRequest
* restructure getResponseText() function to split it out a little better
I made a few changes to the URL processing, but otherwise included the changes
as-is. Thanks Kurt!
I also added "https://*.lotus.com/ldd*"; to the @include list for when you're
logged in to the forum, and made it possible for the script to try to reload
a response message if an earlier attempt never returned anything (which seems
to happen at times).
Tested with Firefox 1.0.7/Greasemonkey 0.5.1 and Firefox 1.5/Greasemonkey 0.6.4
version 1.7 -- July 18, 2006, Peter LaComb
1: At the end of getXMLText, just before inserting the body into the DIV I added this line:
bodyText = bodyText.replace(/<img\b(.*?)10x10.gif[^>]*>/g,"");
This removes all the annoying blank boxes that show up.
2: Updated so that when used in a view, it will retrieve the response list,
and allow you to expand the responses.
version 1.8 -- September 16, 2010, Lars Berntrop-Bos
Added 1.7 version history and formatted code. Submitted to Julian for publication on OpenNTF
===========================
This is version 1.8 of the lddresponse.user.js script
by Lars Berntrop-Bos ( http://www.nsftools.com )
June 3, 2014
You can do anything you'd like with this script, just don't hold me liable for
anything, and don't pretend like you wrote it yourself.
The latest release should always be available at the OpenNTF site, at:
http://www.OpenNTF.org/projects/pmt.nsf/ProjectLookup/LDDMonkey
Statistics
Installs
40
history
Category
Rating
0.0 (0 votes)
Last update / version
2014-06-03 / 2.0
Listing languages
en