Firefox插件 - 如何聆听网页中的文字高亮事件 [英] Firefox addon - how to listen to a text highlight event in a webpage

查看:144
本文介绍了Firefox插件 - 如何聆听网页中的文字高亮事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个插件,它需要捕捉网页上某个人突出显示任何文字的次数。有什么方法可以听这个事件?

谢谢,
Kapil

解决方案

对此没有特别的事件。但是,您可以收听 mouseup 事件,并检查选择 /developer.mozilla.org/en/DOM/window.getSelectionrel =nofollow> window.getSelection() 不是空的和/或是否它与以前的选择不同。


I am writing an addon which needs to do capture the no of times someone has highlighted any text 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.

这篇关于Firefox插件 - 如何聆听网页中的文字高亮事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆