[Greasemonkey] Need help with script

John Taylor john at fcs.uga.edu
Mon Apr 11 10:58:52 EDT 2005

We have a 3rd party application that works under IE, but not under FF.
We would love to get this working with FF as it is the last major
hurdle for us in switching all of our users over.  Under FF, this is
what you see when the web page is accessed:

function initialize()
	  location=" (url deleted) ";
	<style>BODY { Font-Family : helvetica, arial ; Background-Color : white ; Font-Weight : Normal }</style>
<BODY onload="initialize();">

The problem is that there are no quotes around the word "Javascript".
I created a page by hand that has them and then the page works correctly.
I tried to fix this by modifying code from DumbQuotes (from the
greasemonkey website):

(function() {
    var replacements = new Array();
    replacements["<SCRIPT LANGUAGE=JavaScript>"] = "<SCRIPT LANGUAGE=\"JavaScript\">";

    var regex = new Array();
    for (key in replacements) {
	regex[key] = new RegExp(key, 'g');

    var textnodes = document.evaluate("//body//text()", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
    var node, i, s;
    for(node = null, i = 0; node = textnodes.snapshotItem(i); i++) {
	s = node.data;
	for (key in replacements) {
	    s = s.replace(regex[key], replacements[key]);
    	node.data = s;

However, this did not work.  All it does now, is display the same page,
except that there are quotes around Javascript.

Any ideas would be greatly appreciated.

-John Taylor

More information about the Greasemonkey mailing list