Greasy Fork is available in English.

Hook.js

Javascript function hook

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.greasyfork.org/scripts/443030/1037826/Hookjs.js

作者
invobzvr
版本
0.1
建立日期
2022-04-09
更新日期
2022-04-09
授權條款
GPL-3.0

Hook.js

Description

Javascript function hook

Example

fetch.hook(function () {
    if (arguments[0].endsWith('/log')) {
        return new Response('{"error":0,"data":"ok"}');
    }
});
History.prototype.pushState.hook({
    scope: History.prototype,
    before: function () {
        dispatchEvent(new CustomEvent('pushstate', { detail: arguments[2] }));
    },
});