-
Notifications
You must be signed in to change notification settings - Fork 3
/
types.d.ts
131 lines (119 loc) · 3.69 KB
/
types.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// shim / compat
declare const WebKitMutationObserver: any
// greasemonkey
declare const GM_getValue: <T>(key: string, defaultValue: T) => T
declare const GM_setValue: <T>(key: string, value: T) => void
declare const GM_registerMenuCommand: (
message: string,
callback: () => void,
) => void
// Chart.js
declare const myPie: Function
declare const Chart: any
// google
declare const googleDocsUtil: any
declare interface GoogleDocNode {
index: number
line: number
lineIndex: number
node: Element
lineElement: Element
text: string
}
declare interface GoogleDoc {
nodes: GoogleDocNode[]
text: string[]
selectedText: string
caret: {
index: number
lineIndex: number
line: number
}
selectionRect: DOMRect
}
// piazza
declare const P: any
// youtube
declare const ytInitialData: any
declare const ytcfg: any
// FrankerFaceZ on Twitch
declare interface FFZHTMLVideoElement extends HTMLVideoElement {
_ffz_compressor?: DynamicsCompressorNode
}
/**
* Query for new DOM nodes matching a specified selector.
*
* @override
*/
declare const onElementReady: (
selector: string,
options: { findFirst?: boolean; findOnce?: boolean },
callback: (el: HTMLElement) => void,
) => void
/**
* Query for new DOM nodes matching a specified selector.
*
* @override
*/
declare const queryForElements: (
selector: string,
options: { findFirst?: boolean; findOnce?: boolean },
callback: (el: HTMLElement) => void,
) => void
/**
* <br>
*
* **converted this stupid type, when possible, to `HTMLElement`** */
declare interface Element {
nextElementSibling: HTMLElement | null
previousElementSibling: HTMLElement | null
onfullscreenchange: ((this: Element, ev: Event) => any) | null
onfullscreenerror: ((this: Element, ev: Event) => any) | null
getElementsByClassName(classNames: string): HTMLCollectionOf<HTMLElement>
getElementsByTagName(qualifiedName: string): HTMLCollectionOf<HTMLElement>
getElementsByTagNameNS(
namespaceURI: string,
localName: string,
): HTMLCollectionOf<HTMLElement>
insertAdjacentElement(
position: InsertPosition,
insertedElement: Element,
): HTMLElement | null
addEventListener<K extends keyof ElementEventMap>(
type: K,
listener: (this: Element, ev: ElementEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void
removeEventListener<K extends keyof ElementEventMap>(
type: K,
listener: (this: Element, ev: ElementEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void
}
declare interface Element {
style: CSSStyleDeclaration
firstElementChild: HTMLElement | null
lastElementChild: HTMLElement | null
}
declare interface Document {
// readonly scrollingElement: HTMLElement | null
elementFromPoint(x: number, y: number): HTMLElement | null
elementsFromPoint(x: number, y: number): HTMLElement[]
getElementsByClassName(classNames: string): HTMLCollectionOf<HTMLElement>
// keep these so we get advanced types when possible
querySelector<K extends keyof HTMLElementTagNameMap>(
selectors: K,
): HTMLElementTagNameMap[K] | null
querySelector<K extends keyof SVGElementTagNameMap>(
selectors: K,
): SVGElementTagNameMap[K] | null
querySelector(selectors: string): HTMLElement | null
// keep these so we get advanced types when possible
querySelectorAll<K extends keyof HTMLElementTagNameMap>(
selectors: K,
): NodeListOf<HTMLElementTagNameMap[K]>
querySelectorAll<K extends keyof SVGElementTagNameMap>(
selectors: K,
): NodeListOf<SVGElementTagNameMap[K]>
querySelectorAll(selectors: string): NodeListOf<HTMLElement>
}