[Greasemonkey] Grab text string in TD

Scott R. Turner srt at aero.org
Mon Apr 25 09:38:41 EDT 2005


On Fri, 22 Apr 2005, Aaron Boodman wrote:
> Sorry, should have advised you to add to the onload handler. A slight
> complication which will soon be fixed.
>
> Like so:
>
> window.addEventListener("onload", function() {
>  document.body.innerHTML = document.body.innerHTML.replace(/foo/gi, "bar");
> }, false);
>
> I think this is an FAQ.

Hmm.  The following script doesn't work for me; I get the "Added
listener" alert but not the "Executed listener" alert.  Am I doing
something incorrect?

It's amazing how hard it is to get this "simple" script working :-)

-- Scott

// ==UserScript==
// @name          Goggle
// @namespace     none
// @description	  Text replacement
// @include       http://*.google.com/*
// ==/UserScript==

(function() {
  window.addEventListener("onload", function() {
   alert("Executed listener");
   document.body.innerHTML =
   document.body.innerHTML.replace(/Google/gi, "Goggle"); }, false);
  alert("Added listener."); 
}) ();


More information about the Greasemonkey mailing list