Greasemonkey questions: addEventListener

I have a username:

document.addEventListener('click', alert('hello monkey'), true);

There were two problems:

  • "hello monkey" is only warned when the browser is updated, and not when the window is clicked.

  • Using GM's “manage user script” to edit the script, no change occurs. (The source code on the local drive has been changed.)

+3
source share
1 answer

You need to bind it so that it doesn't run automatically ...

document.addEventListener('click', function(){alert('hello monkey')}, true);

Not sure about # 2.

+9
source

Source: https://habr.com/ru/post/1754911/


All Articles