[Greasemonkey] "Bloglines Keep All New Link" User script
Lenny Domnitser
ldrhcp at gmail.com
Mon Jun 13 10:17:52 EDT 2005
On 6/13/05, Mark Wubben <markwubben at gmail.com> wrote:
> On 6/9/05, Jeremy Dunck <jdunck at gmail.com> wrote:
> > But the point is, all GM scripts are wrapped, and if you want to
> > access them outside of the originally injected scope chain, you'll
> > need to export them. Put another way: by adding window.foo, you're
> > guaranteeing that foo is in any further JS's scope chain.
In most cases, exporting functions to window is not necessary. It is
needed if a link is to javascript:myLocalGreasyFunction(), as in the
Nicola's Bloglines script, but what I have done in my user scripts is
to have href="javascript:;" and then set onclick to the local
function. Here's an example I pulled out of a script of mine:
var delLink = document.createElement('a');
delLink.href = 'javascript:;';
delLink.onclick = function() {
if(confirm('Delete?')) {
deleteClip(href);
}
}
More information about the Greasemonkey
mailing list