hookFetch

only hookFetch

目前為 2023-05-04 提交的版本,檢視 最新版本

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.gf.qytechs.cn/scripts/465483/1185277/hookFetch.js

作者
XiaoYingYo
版本
0.0.1.20230504071357
建立日期
2023-05-04
更新日期
2023-05-04
尺寸
6.8 KB
授權條款
未知
English: Please note that whether you are a grease monkey script or any form of Js code injection, please uniformly get the window of the web page context, not the window in the grease monkey script
中文: 请注意无论您是油猴脚本还是任何形式的 Js 代码注入形式,请统一获取到网页上下文的window,而非在油猴脚本中的window
var win = window.unsafeWindow || document.defaultView || window;
FetchCallback : { add , del }
add: (pathname, callback) -> return index
... pathname 
...... English: Path Of Webpage, Does Not Need To Contain The Domain Name, Does Not Need To Contain The Get Parameters, Must Start With /
...... Chinese: 网页路径 无需包含域名 无需包含Get参数 必须以 / 开头
... callback : (_object, period)
...... _object -> (args,text)
...... period -> preRequest / done
del: (pathname, index) -> return true / false
let index = win['__hookRequest__'].FetchCallback.add('/api/auth/session', (_object, period) => {
    if (period !== 'done') { 
        return;
    }
});
Delete
win['__hookRequest__'].FetchCallback.del('/api/auth/session', index);
// English: If it is Xhr, then FetchCallback is changed to XhrCallback
// 中文: 如果是Xhr,则 FetchCallback 改为 XhrCallback
win['__hookRequest__'].XhrCallback.add(...);
XhrCallback : { add , del }
add: (pathname, callback) -> return index
... pathname 
...... English: Path Of Webpage, Does Not Need To Contain The Domain Name, Does Not Need To Contain The Get Parameters, Must Start With /
...... Chinese: 网页路径 无需包含域名 无需包含Get参数 必须以 / 开头
... callback : (_object, period)
...... _object -> (args,text)
...... period -> preRequest / done
del: (pathname, index) -> return true / false

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址