[Greasemonkey] Removing anonymous event handlers

Blake West blakewest at gmail.com
Mon Dec 5 06:47:30 EST 2005


I think you need to go after the rmpost() function instead of the event
handler on the link. The event handler still gets called, but rmpost doesn't
do anyhting.

unsafeWindow.rmPost = function(){return;};

Seems to work on my setup: WinXp, FF 1.5, GM 0.6.4

-Blake

On 12/4/05, Gavri Fernandez <gavri.fernandez at gmail.com> wrote:
>
> Hi,
>
> del.icio.us code adds an anonymous function to a link's "onlick" (
> o.onclick = function(){ return rmPost(this) } )
>
> And now, in my GM script, I can't remove the event like I did before (
> o.onclick = null ) because I've got to do it the _right way_ in the
> new Greasemonkey versions. And I don't have a function pointer I can
> pass to removeEventListener().
> But the web-page did it the wrong way and I can't help that, can I?
> (This is beginning to sound like a rant. Sorry.)
> Isn't this going to be a problem for many of the scripts out there? Or
> is there an easy way to get around this?
>
> http://userscripts.org/scripts/source/1777.user.js (Check out the
> script. It's only two lines and a for-loop. And it's broken. Don't
> install.)
>
> Thanks.
> --
> gavri
> http://www.livejournal.com/users/ga_woo/
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
>



--
Blake


More information about the Greasemonkey mailing list