0

I am trying to append a script to any web site, using for example Chrome extensions. When the extension is on, the JavaScript would listen to the mouseenter event but not click event (because it would usually make the page jump to an other page)

My question is: can I cache the all the click events on page when my extension is on and recover them when off? Like:

//on 
for node in document
  old-click = node.click
  node.click = null
  node.addEventListener 'off', (e)->
    node.click = old-click

Or can I add a mask to the page that can stop click event to bubble but allow the mousemove event to bubble to the below element (only one but not bubble to all elements below)?

//click event 
$(document).on 'click', '*', (event)->
  event.stopPropagation()

$(document).on 'mousemove', '*', (event)->
  //event.bubbleToNextBelowElement
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
user2666750
  • 582
  • 1
  • 7
  • 11

0 Answers0