Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
38 lines (33 loc) · 1.14 KB

File metadata and controls

38 lines (33 loc) · 1.14 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// ==UserScript==
// @name early start script
// @namespace https://bbs.tampermonkey.net.cn/
// @version 0.1.0
// @description 使用 early-start 可以比网页更快的加载脚本进行执行,但是会存在一些性能问题与GM API使用限制
// @author You
// @run-at document-start
// @grant GM_getValue
// @grant GM_setValue
// @grant CAT_scriptLoaded
// @early-start
// @match http://test-case.ggnb.top/is_trusted/is_trusted.html
// ==/UserScript==
console.log("early-start 获取值", GM_getValue("test"));
console.log("early-start 设置值", GM_setValue("test", Math.random()));
const realAdd = document.addEventListener;
document.addEventListener = function (type, fuc) {
if (type == "click") {
const realFuc = fuc;
fuc = function (e) {
const obj = { isTrusted: true, target: e.target };
Object.setPrototypeOf(obj, MouseEvent.prototype);
realFuc.call(this, obj);
};
}
realAdd.call(this, type, fuc);
};
unsafeWindow.onload = () => {
document.querySelector("#btn").click();
};
CAT_scriptLoaded().then(() => {
console.log("脚本完全加载完成");
});
Morty Proxy This is a proxified and sanitized view of the page, visit original site.