Remote Random Gmail Signature for Firefox 3.5

By Chuck Goodwin Last update Nov 5, 2009 — Installed 567 times. Daily Installs: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 9, 5, 0, 0, 0, 0, 1, 3, 3, 0, 3, 2, 3, 5, 2, 1, 1, 1

There are 7 previous versions of this script.

// ==UserScript==
// @name          Remote Random Gmail Signature for Firefox 3
// @version       .61beta
// @namespace     http://gmail.com
// @description   Add  random signature to Gmail
// @include       http://mail.google.com/*
// @include       https://mail.google.com/*
// @include       http://gmail.google.com/*
// @include       https://gmail.google.com/*
// @author        ravard@gmail.com
// ==/UserScript==

//User changeable variables
var sigHeader = '<br><br>-----------------<br>'
var urlString = 'http://CHANGEME.com/sigs.txt'
var txtType = 1 //1 for Plain text, 2 for HTML code
//End of user changeable variables

var allBody = document.evaluate("//body[@class='editable  LW-yrriRe']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);

if (allBody.snapshotItem(0)) {

        var htmlSignature = changeSignature();
        allBody.snapshotItem(0).innerHTML = htmlSignature + allBody.snapshotItem(0).innerHTML;
}

function changeSignature() {
          var dynamic_part;
	  GM_xmlhttpRequest({
	    method: 'GET',
	    url: urlString,
	    headers: {
	        'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
	        'Accept': 'text/plain',
	    },
	    onload: function(responseDetails) {
	      tagline_array = responseDetails.responseText.split('%');
	      if (txtType==1) {
	      dynamic_part = sigHeader + '<pre style="font-size: normal; font-family:arial">' + tagline_array[Math.floor(Math.random()*tagline_array.length)] + '</pre>';
	      	}
	      	else
	      	{
		dynamic_part = sigHeader + tagline_array[Math.floor(Math.random()*tagline_array.length)];
		}
              GM_setValue("sig", dynamic_part);
	    }
	});
    //return(dynamic_part);
  return GM_getValue("sig", "Default")
};