[Greasemonkey] Arrgghh!!! it runs asynch!!! (was: Looking for a hotshot GM coder...)

Anton Berezin tobez at tobez.org
Wed Jun 28 11:20:38 EDT 2006


On Wed, Jun 28, 2006 at 01:06:35AM -0700, Tom Emerson wrote:

> by the the first "GM_xmlhttprequest" completes, the script is over and
> done with the entire page -- only the last image gets updated!

The closures bite!  The closures bite!  Tom is confused.  :-)

> Now that I'm down to that last niggling detail, here is the
> script-thus-far:

You just need a separate instance of thisCell variable by the time onload
function fires up.  So basically, replace

	var allCells, thisCell;

with

	var allCells;

and the replace

	thisCell = allCells.snapshotItem(i);

with

	var thisCell = allCells.snapshotItem(i);

Then everything should become fine and dandy.

Hope this helps,
\Anton.
-- 
An undefined problem has an infinite number of solutions.
-- Robert A. Humphrey


More information about the Greasemonkey mailing list