FunctionHooker.js

Hook most functions on runtime via the function name

Ezt a szkriptet nem ajánlott közvetlenül telepíteni. Ez egy könyvtár más szkriptek számára, amik tartalmazzák a // @require https://update.greatest.deepsurf.us/scripts/469993/1214452/FunctionHookerjs.js hivatkozást.

Fejlesztő
TetteDev
Verzió
0.1
Létrehozva
2023.07.02.
Frissítve
2023.07.02.
Size
4 KB
Licensz
Ismeretlen

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]);
});