[Greasemonkey] Patterns

Aaron Boodman zboogs at gmail.com
Tue Apr 12 23:33:55 EDT 2005


You don't need to open a window from script to use this approach.

window.addEventListener("mousedown", function(e) {
  if (e.target.tagName == "A") {
    e.target.href = "http://youngpup.net?muahaha-youve-been-yp'd!";
  }
}, false);

On 4/12/05, Julien Couvreur <julien.couvreur at gmail.com> wrote:
> On 4/12/05, Aaron Boodman <zboogs at gmail.com> wrote:
> > Another pattern I like, especially for links or other clickable
> > things, is listening for clicks instead of modifying the links.
> >
> > It's probably snappier, and I think way easier to read.
> 
> I like it to and actually re-wrote my "mailto: to Gmail" user script.
> But then I found one reason to really not like it: because the link is
> opened by a script, the user doesn't get the choice of opening in the
> current tab, a new tab or a new window.
> 
> On the other hand, the link re-writing approach (that I reverted back
> to) breaks some other features of Firefox, namely the context menu for
> "Copy email address"...
> 
> Cheers,
> Julien
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
>


More information about the Greasemonkey mailing list