[Greasemonkey] Script scoping

Andrew Hayward greasemonkey at mooncalf.me.uk
Mon May 2 18:43:49 EDT 2005

I've just got round to installing GM0.3b, after finally getting fed up 
of not having the new features at my disposal. However, I noticed the 
following in the change log...

> Improved error handling by isolating scripts from one another. Errors
> in one script will no longer stop other scripts from running. Errors
> loading a script will not stop other scripts from being loaded.

That's all well and good, but what happens if I actually want to access 
another script?

As things stand, I've written a library script for a site (Flickr, for 
those interested), which holds a load of common functionality (it's not 
wrapped up as an anonymous function, but was discreet enough so as not 
to cause any problems), so that I don't have to rewrite it all in the 
various other scripts I've written for the same site.

Of course, I can't now see that library script from the others... which 
is a right pain in the proverbial. If there's some easy way of getting 
round this (#include?) that I've missed along the way, please let me 
know. Otherwise, my user scripts are going to start getting... unusable!



More information about the Greasemonkey mailing list