[Greasemonkey] Script firing twice?

Dave Land land at aol.com
Sat Jan 7 17:37:38 EST 2006


Folks,

To learn about GM_setValue/getValue, I cooked up an idea for a script  
that would count how "lucky" I really  am when using Google by  
counting how often I click the 1st, 2nd, 3rd (and so forth) links...

So I started, as I always do, by writing a brain-dead simple script  
that just writes something using setValue, reads it back using  
getValue and logs what it read...

Oddly, I get two logged events, about 120 milliseconds apart from the  
following script:

// ==UserScript==
// @namespace   http://www.ryanland.com/greasemonkey
// @name    How Lucky?
// @include *.google.tld/*
// @description How lucky ARE you feeling?
// ==/UserScript==

now = new(Date);
milli = now.getMilliseconds();
GM_setValue("howlucky",milli);
GM_log("howlucky = " + GM_getValue("howlucky"));

/* -- end -- */

Why does it fire twice?

I turned off all scripts that target Google or "*" to see if one of  
them was doing a reload or something, but that doesn't seem to be it.

It's probably something stupid that one of my fine GreaseMonkey  
friends will point out in an instant.

Dave


More information about the Greasemonkey mailing list