[Greasemonkey] User input

Vectorspace vectorspace at ntlworld.com
Wed Mar 29 10:55:29 EST 2006


Wait, I see... EventMgr is something you defined yourself based on 
obj.addEventListener and obj.removeEventListener
I think I'm getting it now...

Johan Sundström wrote:
>> Johan Sundström wrote:
>>     
>>> I agree. You can make very good user interfaces if you are the
>>> slightest bit ambitious about it. I like the approach I took with one
>>> of my recent more ambitious hacks, in setting up a home page for it
>>> with docs, new releases and configuration interface, all in one:
>>>
>>> http://ecmanaut.blogspot.com/2006/02/mark-my-links-configuration-updates.htm
>>>       
>
> On 3/27/06, Vectorspace <vectorspace at ntlworld.com> wrote:
>   
>> That's really cool.
>> Question - how does the GM script know that you clicked Save Changes?
>> My JavaScript is amateurish at best, so use simple speak :)
>>     
>
> I register an onclick handler on the Save Changes button that invokes
> my save action. I'm afraid you'll probably have to get a bit technical
> about the DOM, event handlers and the like to implement solutions like
> the above with today's (short supply of) supporting scaffolding to do
> good UI:s.
>
> If you borrow some code from my script, it might become a bit easier;
> there is a gob of EventMgr code (lifted off this list) I use to
> register (and automatically unregister, hoping to avoid the memory
> leaks otherwise associated with using event handlers sloppily in
> greasemonkey scripts) the event handlers.
>
> Assuming you have a config page with a button with an id="save"
> attribute, you can then invoke your own save() function using this
> code:
>
> EventMgr.add( document.getElementById("save"), "click", save, false );
>
> --
>  / Johan Sundström, http://ecmanaut.blogspot.com/
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
>
>   


More information about the Greasemonkey mailing list