开发者

Firefox addon - how to listen to a text highlight event in a webpage

开发者 https://www.devze.com 2023-02-03 11:06 出处:网络
I am writing an addon which needs to do capture the no of times someone has highlighted any tex开发者_运维百科t on a webpage. Is there any way I can listen to this event?

I am writing an addon which needs to do capture the no of times someone has highlighted any tex开发者_运维百科t on a webpage. Is there any way I can listen to this event?

Thanks, Kapil


There is not a particular event for this. But you can listen to the mouseup event and check whether the selection returned by window.getSelection() is not empty and/or whether it differs from the previous selection.


You could add a selection listener. The Source window (viewSource.js) does this so that it can keep the row and column number up-to-date.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号