|
发表于
2024-1-9 21:21:17
|
显示全部楼层
本帖最后由 JML 于 2024-1-9 21:23 编辑
admin 发表于 2024-1-9 16:17
给个失败的脚本例子 - // ==UserScript==
- // [url=home.php?mod=space&uid=23356]@name[/url] 测试
- // @namespace no
- // @version 1.0
- // @description 测试
- // @author 1skiwen
- // [url=home.php?mod=space&uid=52134]@match[/url] https://www.kdocs.cn/l/*
- // @match https://www.kdocs.cn/view/l/*
- // @icon https://v.flomoapp.com/favicon.ico
- // @run-at document-start
- // @grant none
- // ==/UserScript==
- const origOpen = XMLHttpRequest.prototype.open;
- XMLHttpRequest.prototype.open = function () {
- const xhr = this;
- const getter = Object.getOwnPropertyDescriptor(
- XMLHttpRequest.prototype,
- "response"
- ).get;
- Object.defineProperty(xhr, "responseText", {
- get: () => {
- let result = getter.call(xhr);
- if (arguments[1].includes('/metadata?with_link=true') || arguments[1].includes('/metadata?from=preview') || arguments[1].includes('/metadata?include=group') || arguments[1].includes('?review=true')) {
- console.log("测试测试。");
- let json = JSON.parse(result);
- json.user_acl = { "comment": 1, "copy": 1, "delete": 1, "download": 1, "history": 1, "manage_perm": 1, "move": 1, "new_empty": 1, "read": 1, "rename": 1, "saveas": 1, "secret": 0, "share": 1, "update": 1, "upload": 1 };
- result = JSON.stringify(json);
- }
- return result;
- },
- });
- return origOpen.apply(xhr, arguments);
- };
复制代码
|
|