FunctionHooker.js

Hook most functions on runtime via the function name

このスクリプトは単体で利用できません。右のようなメタデータを含むスクリプトから、ライブラリとして読み込まれます: // @require https://update.greasyfork.org/scripts/469993/1214452/FunctionHookerjs.js

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください。
作者
TetteDev
バージョン
0.1
作成日
2023/07/02
更新日
2023/07/02
ライセンス
不明

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