FunctionHooker.js

Hook most functions on runtime via the function name

À partir de 2023-07-02. Voir la dernière version.

Ce script ne devrait pas être installé directement. C'est une librairie créée pour d'autres scripts. Elle doit être inclus avec la commande // @require https://update.greasyforks.org/scripts/469993/1214452/FunctionHookerjs.js

Auteur
TetteDev
Version
0.1
Créer
2023-07-02
Mis à jour
2023-07-02
Taille
3,6 ko
Licence
S/O

Example Usage

const hooker = new FunctionHooker();
hooker.hook('window.addEventListener', (...args) => 
{
    const dissallowedEvents = ["pagehide"]
    if (dissallowedEvents.includes(args[0])) return;

    // gets the unhooked original function if you need to call it in the hook
    const o = hooker.getOriginal("window.addEventListener");

    // addEventListener only has either 2 or 3 arguments
    if (args.length == 3) o(args[0], args[1], args[2]);
    else if (args.length == 2) o(args[0], args[1]);
});
长期地址
遇到问题?请前往 GitHub 提 Issues。