Using Greasemonkey for Forum Friday

I read Declans post on Forum Friday as an addition to Show-and-Tell-Thursday and I think it’s a good idea. There was some discussion about a similar idea (Question Wedneyday) at the blogger BOF. If I’m to respond to posts in the Notes 8 forum (my primary focus) I want a nicer default footer.

I’m already using a Greasemonkey script I blogged about a while back for the LDD6/7 forum. Unfortunately there’s a difference between the HTML markup between the Notes 6/7 forum and the Notes 8 forum so the Greasemonkey script needs to take this into account.

Here’s the updated script (updates in bold):

// ==UserScript==
// @name          Notes/Domino 6/7/8 Forum Signature
// @namespace     https://lekkimworld.com/greasemonkey/ldd_signature
// @description	  Inserts my LDD Forum signature
// @include       http*://www-10.lotus.com/ldd/nd6forum.nsf/*?OpenForm*
// @include       http*://www-10.lotus.com/ldd/nd8forum.nsf/*?OpenForm*
// ==/UserScript==

// get elements
var e_subject = document.getElementById("Subject");
var e_body = document.getElementById("Body");

// handle Notes 8 forum
if (null == e_subject) {
	e_subject = document.forms[0].elements[1];
	e_body = document.forms[0].elements[2];
	e_body.style.fontFamily = "Verdana";
	e_body.style.fontSize = "11px";
}

// compose signature
var signature = "nn/Mikkel HeisterbergnVisit my Notes/Domino blog " +
    "@ http://lekkimworld.comnfor posts on Notes, Domino, Sametime " +
    "and how to use Java in Notes/Domino...";

// set signature
e_body.value = signature;

// set focus
if (e_subject.value == "") {
   e_subject.focus();
} else {
   e_body.focus();
   e_body.setSelectionRange(0, 0);
}

Feel free to copy the script and modify to your liking. Installation guide is in my previous post.