Created
October 1, 2024 13:43
-
-
Save hatrd/847f3600552c8218858675180cefa17f to your computer and use it in GitHub Desktop.
通用事件监听阻止
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name 通用事件监听阻止 | |
// @namespace http://tampermonkey.net/ | |
// @version 2024-02-05 | |
// @description 阻止你想要阻止的事件监听 | |
// @author hatrd | |
// @match http://*/* | |
// @match https://*/* | |
// @run-at document-start | |
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== | |
// @grant none | |
// @license MIT | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
let oldadd=EventTarget.prototype.addEventListener | |
EventTarget.prototype.addEventListener=function (...args){ | |
if(window.onblur!==null){ | |
window.onblur=null; | |
} | |
if(args.length!==0 && ['copy', ].includes(args[0])){ | |
console.log('[+] 阻止 ' + args[0] + ' 监听成功!') | |
return; | |
} | |
return oldadd.call(this,...args) | |
} | |
// Your code here... | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment