[Greasemonkey] Event Listener - Context Menu Cut/Paste

Bill Donnelly donnelly at snowcrest.net
Mon Feb 13 19:04:15 EST 2006


Then that is the answer.
Not a great answer, necessarily, but probably the best you will get.
(unless there is a better way)
I just tested it myself to see why it wasn't working.
And it does work.
You get an event for "onMouseUp", which occurs when the person
lets up on the mouse click. I think you can even check whether it
was a left or right click.
Then, what I meant by 'timing involved' is that you will need to
perform some function for some amount of time every, say,
10 milleseconds, or so, looking for the paste-change, and then
perform whatever you want when you find it. You will need to
reset the timed-check at some point. Either after so many iterations,
or until you get a keypress, or another click, or you get a blur event,
or when you think you have given the user enough time to paste,
which is a questionable thing, but it doesn't hurt to iterate through
the check loop for awhile.
At some point, they have either pasted, or decided not to paste.
It's not a terribly hard routine to write, and kind of a sucky work-around,
but it would work.
You could also just run an infinite loop checking for a paste-change
rather than wait for a click. Checking every 10 milleseconds probably
won't kill anyone's computer. And should give sufficient reaction time.
You could just do that and not use any other event checks, like keypress.

Matt Sargent wrote:

>Tried both of those. Thanks, though.
>
>On 13 Feb 2006 at 14:56, Bill Donnelly wrote:
>
>  
>
>>maybe check for an onclick (and/or onmouseup) and use that
>>to check to see if anything is pasted?
>>there might be some timing involved
>>
>>-- 
>>Where is the OUTRAGE???
>>   What is WRONG with 'We The People'???
>>      pResidential 'elections' 2000 and 2004 (and 2008??.....)
>>
>>_______________________________________________
>>Greasemonkey mailing list
>>Greasemonkey at mozdev.org
>>http://mozdev.org/mailman/listinfo/greasemonkey
>>
>>    
>>
>
>
>_______________________________________________
>Greasemonkey mailing list
>Greasemonkey at mozdev.org
>http://mozdev.org/mailman/listinfo/greasemonkey
>
>  
>

-- 
Where is the OUTRAGE???
   What is WRONG with 'We The People'???
      pResidential 'elections' 2000 and 2004 (and 2008??.....)



More information about the Greasemonkey mailing list