[Greasemonkey] Problem with script execution

Bill Donnelly donnelly at snowcrest.net
Tue May 3 22:27:41 EDT 2005


Okay, I figured out what is happening.

My Color Corrector GmScript isn't working for sites
that are created using JS open window, document
write, etc. being executed as a bookmarklet.
(I thought no scripts were executing,
but the Debug Script (alert) is executing)

What seems to be occurring is that my code
to execute on load isn't working:

this.addEventListener ("load", checkColors, false);

I verified the checkColors() function is not being called.
I installed Gm 0.3b, btw. (same scenario in 0.3a)

Any ideas? Suggestions? Hints? Tips?

FYI: This is my Color Corrector script:

http://www.snowcrest.net/donnelly/gmscripts/colorfix.user.js

This is an example bookmarklet that displays the
page source without hitting the server again.
(like FF view source does) view-DOM-source
I exploded it out for easier reading:

javascript:
var o = document.documentElement,
   p,
   w = window.open ('', '_blank'),
   d = w.document;
d.write ('<html><body><pre>');
z ('<' + o.tagName);

for (var i = 0; p = o.attributes[i], i != o.attributes.length; i++)

   if (p.specified)
      z (' ' + p.nodeName + '=%22' + p.nodeValue + '%22');

z ('>' + o.innerHTML + '</' + o.tagName + '>');
d.write ('</pre></body></html>');
d.close();

function z(s) {
d.write (s.replace (/&/g,'&amp;').replace (/</g,'&lt;').replace
   (/>/g,'&gt;').replace (/%22/g,'&quot;'));
}


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mozdev.org/pipermail/greasemonkey/attachments/20050503/5dd39eb7/attachment-0001.htm


More information about the Greasemonkey mailing list