[Greasemonkey] Script scoping

Edward Lee edilee at gmail.com
Mon May 2 21:43:42 EDT 2005


On 5/2/05, Mark Pilgrim <pilgrim at gmail.com> wrote:
> In this case, I don't like the idea (@scriptinclude, cross-user-script
> dependencies).  If you have more than one script's worth of code, make
> an extension.  We even have a compiler for that now.

Well, the thing is that it's not really more than "one script's worth
of code." At least from what I've coded, I've reused a lot of basic
functionality such as the "overlay" function that provides an easy
interface to visit each node based on xpath and then replace or insert
stuff. Right now I just copy/paste that function as well as some other
ones into each of my user scripts. It would be nice if I had just one
file to modify if I decide to update something.

One way to get around that is to include the (single) include and have
the rest run on event listeners or maybe even timeout.

-- 
Ed


More information about the Greasemonkey mailing list