-
Notifications
You must be signed in to change notification settings - Fork 17
/
global.d.ts
113 lines (108 loc) · 2.95 KB
/
global.d.ts
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/* eslint-disable @typescript-eslint/no-explicit-any */
export const enum XhrMethod {
POST = 'POST',
GET = 'GET',
}
export const enum XhrResponseType {
ARRAYBUFFER = 'arraybuffer',
BLOB = 'blob',
JSON = 'json',
TEXT = 'text',
DOCUMENT = 'document',
FORM = 'application/x-www-form-urlencoded',
}
export type XhrOptions = {
responseType: XhrResponseType;
usermethod: XhrMethod;
contentType: XhrResponseType;
};
declare global {
const PRODUCTION: boolean;
const FILENAME: string;
interface MonkeyXhrResponse {
finalUrl: string;
readyState: number;
status: number;
statusText: string;
responseHeaders: any;
response: any;
responseXML: Document;
responseText: string;
}
interface MonkeyXhrBasicDetails {
url: string;
method?: 'GET' | 'POST' | 'HEAD';
headers?: { [name: string]: string };
data?: string;
binary?: boolean;
timeout?: number;
context?: any;
responseType?: XhrResponseType;
overrideMimeType?: string;
anonymous?: boolean;
fetch?: boolean;
username?: string;
password?: string;
}
interface MonkeyXhrDetails extends MonkeyXhrBasicDetails {
onabort?: (response: MonkeyXhrResponse) => void;
onerror?: (response: MonkeyXhrResponse) => void;
onloadstart?: (response: MonkeyXhrResponse) => void;
onprogress?: (response: MonkeyXhrResponse) => void;
onreadystatechange?: (response: MonkeyXhrResponse) => void;
ontimeout?: (response: MonkeyXhrResponse) => void;
onload?: (response: MonkeyXhrResponse) => void;
}
type RunAtOptions = 'document-start' | 'document-end' | 'document-idle' | 'document-body' | 'context-menu';
interface MonkeyInfo {
script: {
author: string;
copyright: string;
description: string;
excludes: string[];
homepage: string;
icon: string;
icon64: string;
includes: string[];
lastUpdated: number;
matches: string[];
downloadMode: string;
name: string;
namespace: string;
options: {
awareOfChrome: boolean;
compat_arrayleft: boolean;
compat_foreach: boolean;
compat_forvarin: boolean;
compat_metadata: boolean;
compat_prototypes: boolean;
compat_uW_gmonkey: boolean;
noframes: boolean;
override: {
excludes: false;
includes: false;
orig_excludes: string[];
orig_includes: string[];
use_excludes: string[];
use_includes: string[];
};
run_at: RunAtOptions;
};
position: number;
resources: string[];
'run-at': RunAtOptions;
system: boolean;
unwrap: boolean;
version: string;
};
scriptMetaStr: string;
scriptSource: string;
scriptUpdateURL: string;
scriptWillUpdate: boolean;
scriptHandler: string;
isIncognito: boolean;
version: string;
}
function GM_xmlhttpRequest(details: MonkeyXhrDetails): { abort: () => void };
}
export {};