@xpadev-net/niconicomments 0.2.29 → 0.2.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +42 -42
- package/dist/bundle.d.ts +437 -429
- package/dist/bundle.js +2753 -2759
- package/package.json +61 -61
package/dist/bundle.d.ts
CHANGED
|
@@ -1,299 +1,281 @@
|
|
|
1
|
-
declare class FlashComment implements IComment {
|
|
2
|
-
private readonly context;
|
|
3
|
-
readonly comment: formattedCommentWithSize;
|
|
4
|
-
private readonly _globalScale;
|
|
5
|
-
private scale;
|
|
6
|
-
posY: number;
|
|
7
|
-
image?: HTMLCanvasElement | null;
|
|
8
|
-
constructor(comment: formattedComment, context: CanvasRenderingContext2D);
|
|
9
|
-
get invisible(): boolean;
|
|
10
|
-
get loc(): commentLoc;
|
|
11
|
-
get long(): number;
|
|
12
|
-
get vpos(): number;
|
|
13
|
-
get width(): number;
|
|
14
|
-
get height(): number;
|
|
15
|
-
get flash(): boolean;
|
|
16
|
-
get layer(): number;
|
|
17
|
-
get owner(): boolean;
|
|
18
|
-
get mail(): string[];
|
|
19
|
-
get lineCount(): number;
|
|
20
|
-
parseCommand(comment: formattedComment): parsedCommand;
|
|
21
|
-
parseCommandAndNicoscript(comment: formattedComment): formattedCommentWithFont;
|
|
22
|
-
measureText(comment: measureTextInput): measureTextResult;
|
|
23
|
-
getCommentSize(parsedData: formattedCommentWithFont): formattedCommentWithSize;
|
|
24
|
-
draw(vpos: number, showCollision: boolean, debug: boolean): void;
|
|
25
|
-
getTextImage(): HTMLCanvasElement | null;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
declare class HTML5Comment implements IComment {
|
|
30
|
-
private readonly context;
|
|
31
|
-
readonly comment: formattedCommentWithSize;
|
|
32
|
-
posY: number;
|
|
33
|
-
image?: HTMLCanvasElement | null;
|
|
34
|
-
constructor(comment: formattedComment, context: CanvasRenderingContext2D);
|
|
35
|
-
get invisible(): boolean;
|
|
36
|
-
get loc(): commentLoc;
|
|
37
|
-
get long(): number;
|
|
38
|
-
get vpos(): number;
|
|
39
|
-
get width(): number;
|
|
40
|
-
get height(): number;
|
|
41
|
-
get flash(): boolean;
|
|
42
|
-
get layer(): number;
|
|
43
|
-
get owner(): boolean;
|
|
44
|
-
get mail(): string[];
|
|
45
|
-
get lineCount(): number;
|
|
46
|
-
parseCommand(comment: formattedComment): parsedCommand;
|
|
47
|
-
parseCommandAndNicoscript(comment: formattedComment): formattedCommentWithFont;
|
|
48
|
-
measureText(comment: measureTextInput): measureTextResult;
|
|
49
|
-
getCommentSize(parsedData: formattedCommentWithFont): formattedCommentWithSize;
|
|
50
|
-
draw(vpos: number, showCollision: boolean, debug: boolean): void;
|
|
51
|
-
getTextImage(): HTMLCanvasElement | null;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
declare let imageCache: {
|
|
56
|
-
[key: string]: {
|
|
57
|
-
image: HTMLCanvasElement;
|
|
58
|
-
timeout: number;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
declare const resetImageCache: () => void;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
declare let canvas: HTMLCanvasElement;
|
|
65
|
-
declare let context: CanvasRenderingContext2D;
|
|
66
|
-
declare const initCanvas: () => void;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
declare let nicoScripts: nicoScript;
|
|
70
|
-
declare const resetNicoScripts: () => void;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
declare const colors: {
|
|
74
|
-
white: string;
|
|
75
|
-
red: string;
|
|
76
|
-
pink: string;
|
|
77
|
-
orange: string;
|
|
78
|
-
yellow: string;
|
|
79
|
-
green: string;
|
|
80
|
-
cyan: string;
|
|
81
|
-
blue: string;
|
|
82
|
-
purple: string;
|
|
83
|
-
black: string;
|
|
84
|
-
white2: string;
|
|
85
|
-
niconicowhite: string;
|
|
86
|
-
red2: string;
|
|
87
|
-
truered: string;
|
|
88
|
-
pink2: string;
|
|
89
|
-
orange2: string;
|
|
90
|
-
passionorange: string;
|
|
91
|
-
yellow2: string;
|
|
92
|
-
madyellow: string;
|
|
93
|
-
green2: string;
|
|
94
|
-
elementalgreen: string;
|
|
95
|
-
cyan2: string;
|
|
96
|
-
blue2: string;
|
|
97
|
-
marinblue: string;
|
|
98
|
-
purple2: string;
|
|
99
|
-
nobleviolet: string;
|
|
100
|
-
black2: string;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
declare let defaultConfig: Config;
|
|
105
|
-
declare const initConfig: () => void;
|
|
106
|
-
declare const defaultOptions: Options;
|
|
107
|
-
declare let config: Config;
|
|
108
|
-
declare let options: Options;
|
|
109
|
-
declare const setConfig: (value: Config) => Config;
|
|
110
|
-
declare const setOptions: (value: Options) => Options;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
declare const fontTemplates: {
|
|
114
|
-
arial: {
|
|
115
|
-
font: string;
|
|
116
|
-
offset: number;
|
|
117
|
-
weight: number;
|
|
118
|
-
};
|
|
119
|
-
gothic: {
|
|
120
|
-
font: string;
|
|
121
|
-
offset: number;
|
|
122
|
-
weight: number;
|
|
123
|
-
};
|
|
124
|
-
gulim: {
|
|
125
|
-
font: string;
|
|
126
|
-
offset: number;
|
|
127
|
-
weight: number;
|
|
128
|
-
};
|
|
129
|
-
mincho: {
|
|
130
|
-
font: string;
|
|
131
|
-
offset: number;
|
|
132
|
-
weight: number;
|
|
133
|
-
};
|
|
134
|
-
simsun: {
|
|
135
|
-
font: string;
|
|
136
|
-
offset: number;
|
|
137
|
-
weight: number;
|
|
138
|
-
};
|
|
139
|
-
macGothicPro6: {
|
|
140
|
-
font: string;
|
|
141
|
-
offset: number;
|
|
142
|
-
weight: number;
|
|
143
|
-
};
|
|
144
|
-
macGothicPro3: {
|
|
145
|
-
font: string;
|
|
146
|
-
offset: number;
|
|
147
|
-
weight: number;
|
|
148
|
-
};
|
|
149
|
-
macMincho: {
|
|
150
|
-
font: string;
|
|
151
|
-
offset: number;
|
|
152
|
-
weight: number;
|
|
153
|
-
};
|
|
154
|
-
macGothic1: {
|
|
155
|
-
font: string;
|
|
156
|
-
offset: number;
|
|
157
|
-
weight: number;
|
|
158
|
-
};
|
|
159
|
-
macGothic2: {
|
|
160
|
-
font: string;
|
|
161
|
-
offset: number;
|
|
162
|
-
weight: number;
|
|
163
|
-
};
|
|
164
|
-
sansSerif600: {
|
|
165
|
-
font: string;
|
|
166
|
-
offset: number;
|
|
167
|
-
weight: number;
|
|
168
|
-
};
|
|
169
|
-
sansSerif400: {
|
|
170
|
-
font: string;
|
|
171
|
-
offset: number;
|
|
172
|
-
weight: number;
|
|
173
|
-
};
|
|
174
|
-
serif: {
|
|
175
|
-
font: string;
|
|
176
|
-
offset: number;
|
|
177
|
-
weight: number;
|
|
178
|
-
};
|
|
179
|
-
};
|
|
180
|
-
declare const fonts: {
|
|
181
|
-
win7: {
|
|
182
|
-
defont: FontItem;
|
|
183
|
-
gothic: FontItem;
|
|
184
|
-
mincho: FontItem;
|
|
185
|
-
};
|
|
186
|
-
win8_1: {
|
|
187
|
-
defont: FontItem;
|
|
188
|
-
gothic: FontItem;
|
|
189
|
-
mincho: FontItem;
|
|
190
|
-
};
|
|
191
|
-
win: {
|
|
192
|
-
defont: FontItem;
|
|
193
|
-
gothic: FontItem;
|
|
194
|
-
mincho: FontItem;
|
|
195
|
-
};
|
|
196
|
-
mac10_9: {
|
|
197
|
-
defont: FontItem;
|
|
198
|
-
gothic: FontItem;
|
|
199
|
-
mincho: FontItem;
|
|
200
|
-
};
|
|
201
|
-
mac10_11: {
|
|
202
|
-
defont: FontItem;
|
|
203
|
-
gothic: FontItem;
|
|
204
|
-
mincho: FontItem;
|
|
205
|
-
};
|
|
206
|
-
mac: {
|
|
207
|
-
defont: FontItem;
|
|
208
|
-
gothic: FontItem;
|
|
209
|
-
mincho: FontItem;
|
|
210
|
-
};
|
|
211
|
-
other: {
|
|
212
|
-
defont: FontItem;
|
|
213
|
-
gothic: FontItem;
|
|
214
|
-
mincho: FontItem;
|
|
215
|
-
};
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
type
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
flashChar: flashCharList;
|
|
280
|
-
flashMode: flashMode;
|
|
281
|
-
flashScriptChar: flashScriptChar;
|
|
282
|
-
flashThreshold: number;
|
|
283
|
-
font: fontList;
|
|
284
|
-
fonts: platformFont;
|
|
285
|
-
fontSize: configItem<configSizeItem<configResizedItem<number>>>;
|
|
286
|
-
fpsInterval: number;
|
|
287
|
-
hiResCommentCorrection: number;
|
|
288
|
-
lineCounts: configItem<lineCounts>;
|
|
289
|
-
lineHeight: configItem<configSizeItem<configResizedItem<number>>>;
|
|
290
|
-
minFontSize: number;
|
|
291
|
-
sameCAGap: number;
|
|
292
|
-
sameCAMinScore: number;
|
|
293
|
-
sameCARange: number;
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
type ConfigNullable = Partial<Config>;
|
|
1
|
+
declare class FlashComment implements IComment {
|
|
2
|
+
private readonly context;
|
|
3
|
+
readonly comment: formattedCommentWithSize;
|
|
4
|
+
private readonly _globalScale;
|
|
5
|
+
private scale;
|
|
6
|
+
posY: number;
|
|
7
|
+
image?: HTMLCanvasElement | null;
|
|
8
|
+
constructor(comment: formattedComment, context: CanvasRenderingContext2D);
|
|
9
|
+
get invisible(): boolean;
|
|
10
|
+
get loc(): commentLoc;
|
|
11
|
+
get long(): number;
|
|
12
|
+
get vpos(): number;
|
|
13
|
+
get width(): number;
|
|
14
|
+
get height(): number;
|
|
15
|
+
get flash(): boolean;
|
|
16
|
+
get layer(): number;
|
|
17
|
+
get owner(): boolean;
|
|
18
|
+
get mail(): string[];
|
|
19
|
+
get lineCount(): number;
|
|
20
|
+
parseCommand(comment: formattedComment): parsedCommand;
|
|
21
|
+
parseCommandAndNicoscript(comment: formattedComment): formattedCommentWithFont;
|
|
22
|
+
measureText(comment: measureTextInput): measureTextResult;
|
|
23
|
+
getCommentSize(parsedData: formattedCommentWithFont): formattedCommentWithSize;
|
|
24
|
+
draw(vpos: number, showCollision: boolean, debug: boolean): void;
|
|
25
|
+
getTextImage(): HTMLCanvasElement | null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
declare class HTML5Comment implements IComment {
|
|
30
|
+
private readonly context;
|
|
31
|
+
readonly comment: formattedCommentWithSize;
|
|
32
|
+
posY: number;
|
|
33
|
+
image?: HTMLCanvasElement | null;
|
|
34
|
+
constructor(comment: formattedComment, context: CanvasRenderingContext2D);
|
|
35
|
+
get invisible(): boolean;
|
|
36
|
+
get loc(): commentLoc;
|
|
37
|
+
get long(): number;
|
|
38
|
+
get vpos(): number;
|
|
39
|
+
get width(): number;
|
|
40
|
+
get height(): number;
|
|
41
|
+
get flash(): boolean;
|
|
42
|
+
get layer(): number;
|
|
43
|
+
get owner(): boolean;
|
|
44
|
+
get mail(): string[];
|
|
45
|
+
get lineCount(): number;
|
|
46
|
+
parseCommand(comment: formattedComment): parsedCommand;
|
|
47
|
+
parseCommandAndNicoscript(comment: formattedComment): formattedCommentWithFont;
|
|
48
|
+
measureText(comment: measureTextInput): measureTextResult;
|
|
49
|
+
getCommentSize(parsedData: formattedCommentWithFont): formattedCommentWithSize;
|
|
50
|
+
draw(vpos: number, showCollision: boolean, debug: boolean): void;
|
|
51
|
+
getTextImage(): HTMLCanvasElement | null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
declare let imageCache: {
|
|
56
|
+
[key: string]: {
|
|
57
|
+
image: HTMLCanvasElement;
|
|
58
|
+
timeout: number;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
declare const resetImageCache: () => void;
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
declare let canvas: HTMLCanvasElement;
|
|
65
|
+
declare let context: CanvasRenderingContext2D;
|
|
66
|
+
declare const initCanvas: () => void;
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
declare let nicoScripts: nicoScript;
|
|
70
|
+
declare const resetNicoScripts: () => void;
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
declare const colors: {
|
|
74
|
+
white: string;
|
|
75
|
+
red: string;
|
|
76
|
+
pink: string;
|
|
77
|
+
orange: string;
|
|
78
|
+
yellow: string;
|
|
79
|
+
green: string;
|
|
80
|
+
cyan: string;
|
|
81
|
+
blue: string;
|
|
82
|
+
purple: string;
|
|
83
|
+
black: string;
|
|
84
|
+
white2: string;
|
|
85
|
+
niconicowhite: string;
|
|
86
|
+
red2: string;
|
|
87
|
+
truered: string;
|
|
88
|
+
pink2: string;
|
|
89
|
+
orange2: string;
|
|
90
|
+
passionorange: string;
|
|
91
|
+
yellow2: string;
|
|
92
|
+
madyellow: string;
|
|
93
|
+
green2: string;
|
|
94
|
+
elementalgreen: string;
|
|
95
|
+
cyan2: string;
|
|
96
|
+
blue2: string;
|
|
97
|
+
marinblue: string;
|
|
98
|
+
purple2: string;
|
|
99
|
+
nobleviolet: string;
|
|
100
|
+
black2: string;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
declare let defaultConfig: Config;
|
|
105
|
+
declare const initConfig: () => void;
|
|
106
|
+
declare const defaultOptions: Options;
|
|
107
|
+
declare let config: Config;
|
|
108
|
+
declare let options: Options;
|
|
109
|
+
declare const setConfig: (value: Config) => Config;
|
|
110
|
+
declare const setOptions: (value: Options) => Options;
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
declare const fontTemplates: {
|
|
114
|
+
arial: {
|
|
115
|
+
font: string;
|
|
116
|
+
offset: number;
|
|
117
|
+
weight: number;
|
|
118
|
+
};
|
|
119
|
+
gothic: {
|
|
120
|
+
font: string;
|
|
121
|
+
offset: number;
|
|
122
|
+
weight: number;
|
|
123
|
+
};
|
|
124
|
+
gulim: {
|
|
125
|
+
font: string;
|
|
126
|
+
offset: number;
|
|
127
|
+
weight: number;
|
|
128
|
+
};
|
|
129
|
+
mincho: {
|
|
130
|
+
font: string;
|
|
131
|
+
offset: number;
|
|
132
|
+
weight: number;
|
|
133
|
+
};
|
|
134
|
+
simsun: {
|
|
135
|
+
font: string;
|
|
136
|
+
offset: number;
|
|
137
|
+
weight: number;
|
|
138
|
+
};
|
|
139
|
+
macGothicPro6: {
|
|
140
|
+
font: string;
|
|
141
|
+
offset: number;
|
|
142
|
+
weight: number;
|
|
143
|
+
};
|
|
144
|
+
macGothicPro3: {
|
|
145
|
+
font: string;
|
|
146
|
+
offset: number;
|
|
147
|
+
weight: number;
|
|
148
|
+
};
|
|
149
|
+
macMincho: {
|
|
150
|
+
font: string;
|
|
151
|
+
offset: number;
|
|
152
|
+
weight: number;
|
|
153
|
+
};
|
|
154
|
+
macGothic1: {
|
|
155
|
+
font: string;
|
|
156
|
+
offset: number;
|
|
157
|
+
weight: number;
|
|
158
|
+
};
|
|
159
|
+
macGothic2: {
|
|
160
|
+
font: string;
|
|
161
|
+
offset: number;
|
|
162
|
+
weight: number;
|
|
163
|
+
};
|
|
164
|
+
sansSerif600: {
|
|
165
|
+
font: string;
|
|
166
|
+
offset: number;
|
|
167
|
+
weight: number;
|
|
168
|
+
};
|
|
169
|
+
sansSerif400: {
|
|
170
|
+
font: string;
|
|
171
|
+
offset: number;
|
|
172
|
+
weight: number;
|
|
173
|
+
};
|
|
174
|
+
serif: {
|
|
175
|
+
font: string;
|
|
176
|
+
offset: number;
|
|
177
|
+
weight: number;
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
declare const fonts: {
|
|
181
|
+
win7: {
|
|
182
|
+
defont: FontItem;
|
|
183
|
+
gothic: FontItem;
|
|
184
|
+
mincho: FontItem;
|
|
185
|
+
};
|
|
186
|
+
win8_1: {
|
|
187
|
+
defont: FontItem;
|
|
188
|
+
gothic: FontItem;
|
|
189
|
+
mincho: FontItem;
|
|
190
|
+
};
|
|
191
|
+
win: {
|
|
192
|
+
defont: FontItem;
|
|
193
|
+
gothic: FontItem;
|
|
194
|
+
mincho: FontItem;
|
|
195
|
+
};
|
|
196
|
+
mac10_9: {
|
|
197
|
+
defont: FontItem;
|
|
198
|
+
gothic: FontItem;
|
|
199
|
+
mincho: FontItem;
|
|
200
|
+
};
|
|
201
|
+
mac10_11: {
|
|
202
|
+
defont: FontItem;
|
|
203
|
+
gothic: FontItem;
|
|
204
|
+
mincho: FontItem;
|
|
205
|
+
};
|
|
206
|
+
mac: {
|
|
207
|
+
defont: FontItem;
|
|
208
|
+
gothic: FontItem;
|
|
209
|
+
mincho: FontItem;
|
|
210
|
+
};
|
|
211
|
+
other: {
|
|
212
|
+
defont: FontItem;
|
|
213
|
+
gothic: FontItem;
|
|
214
|
+
mincho: FontItem;
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
type configItem<T> = T | { html5: T; flash: T };
|
|
220
|
+
type configSizeItem<T> = { big: T; medium: T; small: T };
|
|
221
|
+
type configResizedItem<T> = { default: T; resized: T };
|
|
222
|
+
|
|
223
|
+
type commentStageSize = { width: number; fullWidth: number; height: number };
|
|
224
|
+
|
|
225
|
+
type flashCharList = {
|
|
226
|
+
[key in "simsunStrong" | "simsunWeak" | "gulim" | "gothic"]: string;
|
|
227
|
+
};
|
|
228
|
+
type flashMode = "xp" | "vista";
|
|
229
|
+
type flashScriptChar = {
|
|
230
|
+
[key in "super" | "sub"]: string;
|
|
231
|
+
};
|
|
232
|
+
type fontList = {
|
|
233
|
+
[key in "gulim" | "simsun"]: string;
|
|
234
|
+
};
|
|
235
|
+
type lineCounts = {
|
|
236
|
+
[key in "default" | "resized" | "doubleResized"]: configSizeItem<number>;
|
|
237
|
+
};
|
|
238
|
+
type typeDoubleResizeMaxWidth = {
|
|
239
|
+
[key in "full" | "normal"]: number;
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
type Config = {
|
|
243
|
+
cacheAge: number;
|
|
244
|
+
canvasHeight: number;
|
|
245
|
+
canvasWidth: number;
|
|
246
|
+
collisionRange: { [key in "left" | "right"]: number };
|
|
247
|
+
colors: { [key: string]: string };
|
|
248
|
+
commentDrawPadding: configItem<number>;
|
|
249
|
+
commentDrawRange: configItem<number>;
|
|
250
|
+
commentScale: configItem<number>;
|
|
251
|
+
commentStageSize: configItem<commentStageSize>;
|
|
252
|
+
commentYMarginBottom: configSizeItem<number>;
|
|
253
|
+
commentYOffset: configSizeItem<configResizedItem<number>>;
|
|
254
|
+
commentYPaddingTop: configResizedItem<number>;
|
|
255
|
+
contextFillLiveOpacity: number;
|
|
256
|
+
contextLineWidth: number;
|
|
257
|
+
contextStrokeColor: string;
|
|
258
|
+
contextStrokeInversionColor: string;
|
|
259
|
+
contextStrokeOpacity: number;
|
|
260
|
+
doubleResizeMaxWidth: configItem<typeDoubleResizeMaxWidth>;
|
|
261
|
+
flashChar: flashCharList;
|
|
262
|
+
flashMode: flashMode;
|
|
263
|
+
flashScriptChar: flashScriptChar;
|
|
264
|
+
flashThreshold: number;
|
|
265
|
+
font: fontList;
|
|
266
|
+
fonts: platformFont;
|
|
267
|
+
fontSize: configItem<configSizeItem<configResizedItem<number>>>;
|
|
268
|
+
fpsInterval: number;
|
|
269
|
+
hiResCommentCorrection: number;
|
|
270
|
+
lineCounts: configItem<lineCounts>;
|
|
271
|
+
lineHeight: configItem<configSizeItem<configResizedItem<number>>>;
|
|
272
|
+
minFontSize: number;
|
|
273
|
+
sameCAGap: number;
|
|
274
|
+
sameCAMinScore: number;
|
|
275
|
+
sameCARange: number;
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
type ConfigNullable = Partial<Config>;
|
|
297
279
|
|
|
298
280
|
type platform =
|
|
299
281
|
| "win7"
|
|
@@ -400,31 +382,57 @@ type v1Comment = {
|
|
|
400
382
|
isMyPost: boolean;
|
|
401
383
|
};
|
|
402
384
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
385
|
+
interface IComment {
|
|
386
|
+
comment: formattedCommentWithSize;
|
|
387
|
+
invisible: boolean;
|
|
388
|
+
loc: commentLoc;
|
|
389
|
+
width: number;
|
|
390
|
+
long: number;
|
|
391
|
+
height: number;
|
|
392
|
+
vpos: number;
|
|
393
|
+
flash: boolean;
|
|
394
|
+
posY: number;
|
|
395
|
+
owner: boolean;
|
|
396
|
+
layer: number;
|
|
397
|
+
mail: string[];
|
|
398
|
+
image?: HTMLCanvasElement | null;
|
|
399
|
+
getTextImage: (vpos: number) => void;
|
|
400
|
+
draw: (vpos: number, showCollision: boolean, isDebug: boolean) => void;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
type inputFormatType =
|
|
404
|
+
| "niconicome"
|
|
405
|
+
| "formatted"
|
|
406
|
+
| "legacy"
|
|
407
|
+
| "legacyOwner"
|
|
408
|
+
| "owner"
|
|
409
|
+
| "v1"
|
|
410
|
+
| "default";
|
|
411
|
+
type inputFormat =
|
|
412
|
+
| XMLDocument
|
|
413
|
+
| formattedComment[]
|
|
414
|
+
| formattedLegacyComment[]
|
|
415
|
+
| rawApiResponse[]
|
|
416
|
+
| ownerComment[]
|
|
417
|
+
| v1Thread[]
|
|
418
|
+
| string;
|
|
419
|
+
type modeType = "default" | "html5" | "flash";
|
|
420
|
+
type Options = {
|
|
421
|
+
config: ConfigNullable;
|
|
422
|
+
debug: boolean;
|
|
423
|
+
enableLegacyPiP: boolean;
|
|
424
|
+
format: inputFormatType;
|
|
425
|
+
formatted: boolean;
|
|
426
|
+
keepCA: boolean;
|
|
427
|
+
mode: modeType;
|
|
428
|
+
scale: number;
|
|
429
|
+
showCollision: boolean;
|
|
430
|
+
showCommentCount: boolean;
|
|
431
|
+
showFPS: boolean;
|
|
432
|
+
useLegacy: boolean;
|
|
433
|
+
video: HTMLVideoElement | undefined;
|
|
434
|
+
};
|
|
435
|
+
type InitOptions = Partial<Options>;
|
|
428
436
|
|
|
429
437
|
type formattedCommentWithFont = {
|
|
430
438
|
id: number;
|
|
@@ -574,113 +582,113 @@ type measureInput = {
|
|
|
574
582
|
lineCount: number;
|
|
575
583
|
};
|
|
576
584
|
|
|
577
|
-
declare const convert2formattedComment: (data: unknown, type: inputFormatType) => formattedComment[];
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
declare class NiconiComments {
|
|
581
|
-
enableLegacyPiP: boolean;
|
|
582
|
-
showCollision: boolean;
|
|
583
|
-
showFPS: boolean;
|
|
584
|
-
showCommentCount: boolean;
|
|
585
|
-
video: HTMLVideoElement | undefined;
|
|
586
|
-
private data;
|
|
587
|
-
private lastVpos;
|
|
588
|
-
private readonly canvas;
|
|
589
|
-
private readonly collision;
|
|
590
|
-
private readonly context;
|
|
591
|
-
private readonly timeline;
|
|
592
|
-
constructor(canvas: HTMLCanvasElement, data:
|
|
593
|
-
preRendering(rawData: formattedComment[]): void;
|
|
594
|
-
getCommentPos(data: IComment[]): IComment[];
|
|
595
|
-
sortComment(parsedData: IComment[]): IComment[];
|
|
596
|
-
drawCanvas(vpos: number, forceRendering?: boolean): void;
|
|
597
|
-
clear(): void;
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
declare const getLineHeight: (fontSize: commentSize, isFlash: boolean, resized?: boolean) => number;
|
|
602
|
-
declare const getCharSize: (fontSize: commentSize, isFlash: boolean) => number;
|
|
603
|
-
declare const measure: (comment: measureInput) => {
|
|
604
|
-
height: number;
|
|
605
|
-
width: number;
|
|
606
|
-
lineWidth: number[];
|
|
607
|
-
itemWidth: number[][];
|
|
608
|
-
};
|
|
609
|
-
declare const getFontSizeAndScale: (charSize: number) => {
|
|
610
|
-
scale: number;
|
|
611
|
-
fontSize: number;
|
|
612
|
-
};
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
declare const typeGuard: {
|
|
616
|
-
formatted: {
|
|
617
|
-
comment: (i: unknown) => i is formattedComment;
|
|
618
|
-
comments: (i: unknown) => i is formattedComment[];
|
|
619
|
-
legacyComment: (i: unknown) => i is formattedLegacyComment;
|
|
620
|
-
legacyComments: (i: unknown) => i is formattedLegacyComment[];
|
|
621
|
-
};
|
|
622
|
-
legacy: {
|
|
623
|
-
rawApiResponses: (i: unknown) => i is rawApiResponse[];
|
|
624
|
-
apiChat: (i: unknown) => i is apiChat;
|
|
625
|
-
apiGlobalNumRes: (i: unknown) => i is apiGlobalNumRes;
|
|
626
|
-
apiLeaf: (i: unknown) => i is apiLeaf;
|
|
627
|
-
apiPing: (i: unknown) => i is apiPing;
|
|
628
|
-
apiThread: (i: unknown) => i is apiThread;
|
|
629
|
-
};
|
|
630
|
-
niconicome: {
|
|
631
|
-
xmlDocument: (i: unknown) => i is XMLDocument;
|
|
632
|
-
};
|
|
633
|
-
legacyOwner: {
|
|
634
|
-
comments: (i: unknown) => i is string;
|
|
635
|
-
};
|
|
636
|
-
owner: {
|
|
637
|
-
comment: (i: unknown) => i is ownerComment;
|
|
638
|
-
comments: (i: unknown) => i is ownerComment[];
|
|
639
|
-
};
|
|
640
|
-
v1: {
|
|
641
|
-
comment: (i: unknown) => i is apiThread;
|
|
642
|
-
thread: (i: unknown) => i is v1Thread;
|
|
643
|
-
threads: (i: unknown) => i is v1Thread[];
|
|
644
|
-
};
|
|
645
|
-
nicoScript: {
|
|
646
|
-
range: {
|
|
647
|
-
target: (i: unknown) => i is nicoScriptReverseTarget;
|
|
648
|
-
};
|
|
649
|
-
replace: {
|
|
650
|
-
range: (i: unknown) => i is nicoScriptReplaceRange;
|
|
651
|
-
target: (i: unknown) => i is nicoScriptReplaceTarget;
|
|
652
|
-
condition: (i: unknown) => i is nicoScriptReplaceCondition;
|
|
653
|
-
};
|
|
654
|
-
};
|
|
655
|
-
comment: {
|
|
656
|
-
font: (i: unknown) => i is commentFont;
|
|
657
|
-
loc: (i: unknown) => i is commentLoc;
|
|
658
|
-
size: (i: unknown) => i is commentSize;
|
|
659
|
-
command: {
|
|
660
|
-
key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
|
|
661
|
-
};
|
|
662
|
-
};
|
|
663
|
-
config: {
|
|
664
|
-
initOptions: (item: unknown) => item is Partial<Options>;
|
|
665
|
-
};
|
|
666
|
-
};
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
declare const getPosY: (currentPos: number, targetComment: IComment, collision: number[] | undefined, data: IComment[]) => {
|
|
670
|
-
currentPos: number;
|
|
671
|
-
isChanged: boolean;
|
|
672
|
-
isBreak: boolean;
|
|
673
|
-
};
|
|
674
|
-
declare const getPosX: (width: number, vpos: number, long: number, isFlash: boolean) => number;
|
|
675
|
-
declare const parseFont: (font: commentFont, size: string | number) => string;
|
|
676
|
-
declare const arrayPush: (array: {
|
|
677
|
-
[key: number]: number[];
|
|
678
|
-
}, key: string | number, push: number) => void;
|
|
679
|
-
declare const hex2rgb: (hex: string) => number[];
|
|
680
|
-
declare const replaceAll: (string: string, target: string, replace: string) => string;
|
|
681
|
-
declare const changeCALayer: (rawData: formattedComment[]) => formattedComment[];
|
|
682
|
-
declare const getConfig: <T>(input: configItem<T>, isFlash?: boolean) => T;
|
|
683
|
-
declare const isFlashComment: (comment: formattedComment) => boolean;
|
|
684
|
-
|
|
585
|
+
declare const convert2formattedComment: (data: unknown, type: inputFormatType) => formattedComment[];
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
declare class NiconiComments {
|
|
589
|
+
enableLegacyPiP: boolean;
|
|
590
|
+
showCollision: boolean;
|
|
591
|
+
showFPS: boolean;
|
|
592
|
+
showCommentCount: boolean;
|
|
593
|
+
video: HTMLVideoElement | undefined;
|
|
594
|
+
private data;
|
|
595
|
+
private lastVpos;
|
|
596
|
+
private readonly canvas;
|
|
597
|
+
private readonly collision;
|
|
598
|
+
private readonly context;
|
|
599
|
+
private readonly timeline;
|
|
600
|
+
constructor(canvas: HTMLCanvasElement, data: inputFormat[], initOptions?: InitOptions);
|
|
601
|
+
preRendering(rawData: formattedComment[]): void;
|
|
602
|
+
getCommentPos(data: IComment[]): IComment[];
|
|
603
|
+
sortComment(parsedData: IComment[]): IComment[];
|
|
604
|
+
drawCanvas(vpos: number, forceRendering?: boolean): void;
|
|
605
|
+
clear(): void;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
declare const getLineHeight: (fontSize: commentSize, isFlash: boolean, resized?: boolean) => number;
|
|
610
|
+
declare const getCharSize: (fontSize: commentSize, isFlash: boolean) => number;
|
|
611
|
+
declare const measure: (comment: measureInput) => {
|
|
612
|
+
height: number;
|
|
613
|
+
width: number;
|
|
614
|
+
lineWidth: number[];
|
|
615
|
+
itemWidth: number[][];
|
|
616
|
+
};
|
|
617
|
+
declare const getFontSizeAndScale: (charSize: number) => {
|
|
618
|
+
scale: number;
|
|
619
|
+
fontSize: number;
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
declare const typeGuard: {
|
|
624
|
+
formatted: {
|
|
625
|
+
comment: (i: unknown) => i is formattedComment;
|
|
626
|
+
comments: (i: unknown) => i is formattedComment[];
|
|
627
|
+
legacyComment: (i: unknown) => i is formattedLegacyComment;
|
|
628
|
+
legacyComments: (i: unknown) => i is formattedLegacyComment[];
|
|
629
|
+
};
|
|
630
|
+
legacy: {
|
|
631
|
+
rawApiResponses: (i: unknown) => i is rawApiResponse[];
|
|
632
|
+
apiChat: (i: unknown) => i is apiChat;
|
|
633
|
+
apiGlobalNumRes: (i: unknown) => i is apiGlobalNumRes;
|
|
634
|
+
apiLeaf: (i: unknown) => i is apiLeaf;
|
|
635
|
+
apiPing: (i: unknown) => i is apiPing;
|
|
636
|
+
apiThread: (i: unknown) => i is apiThread;
|
|
637
|
+
};
|
|
638
|
+
niconicome: {
|
|
639
|
+
xmlDocument: (i: unknown) => i is XMLDocument;
|
|
640
|
+
};
|
|
641
|
+
legacyOwner: {
|
|
642
|
+
comments: (i: unknown) => i is string;
|
|
643
|
+
};
|
|
644
|
+
owner: {
|
|
645
|
+
comment: (i: unknown) => i is ownerComment;
|
|
646
|
+
comments: (i: unknown) => i is ownerComment[];
|
|
647
|
+
};
|
|
648
|
+
v1: {
|
|
649
|
+
comment: (i: unknown) => i is apiThread;
|
|
650
|
+
thread: (i: unknown) => i is v1Thread;
|
|
651
|
+
threads: (i: unknown) => i is v1Thread[];
|
|
652
|
+
};
|
|
653
|
+
nicoScript: {
|
|
654
|
+
range: {
|
|
655
|
+
target: (i: unknown) => i is nicoScriptReverseTarget;
|
|
656
|
+
};
|
|
657
|
+
replace: {
|
|
658
|
+
range: (i: unknown) => i is nicoScriptReplaceRange;
|
|
659
|
+
target: (i: unknown) => i is nicoScriptReplaceTarget;
|
|
660
|
+
condition: (i: unknown) => i is nicoScriptReplaceCondition;
|
|
661
|
+
};
|
|
662
|
+
};
|
|
663
|
+
comment: {
|
|
664
|
+
font: (i: unknown) => i is commentFont;
|
|
665
|
+
loc: (i: unknown) => i is commentLoc;
|
|
666
|
+
size: (i: unknown) => i is commentSize;
|
|
667
|
+
command: {
|
|
668
|
+
key: (i: unknown) => i is "full" | "ender" | "_live" | "invisible";
|
|
669
|
+
};
|
|
670
|
+
};
|
|
671
|
+
config: {
|
|
672
|
+
initOptions: (item: unknown) => item is Partial<Options>;
|
|
673
|
+
};
|
|
674
|
+
};
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
declare const getPosY: (currentPos: number, targetComment: IComment, collision: number[] | undefined, data: IComment[]) => {
|
|
678
|
+
currentPos: number;
|
|
679
|
+
isChanged: boolean;
|
|
680
|
+
isBreak: boolean;
|
|
681
|
+
};
|
|
682
|
+
declare const getPosX: (width: number, vpos: number, long: number, isFlash: boolean) => number;
|
|
683
|
+
declare const parseFont: (font: commentFont, size: string | number) => string;
|
|
684
|
+
declare const arrayPush: (array: {
|
|
685
|
+
[key: number]: number[];
|
|
686
|
+
}, key: string | number, push: number) => void;
|
|
687
|
+
declare const hex2rgb: (hex: string) => number[];
|
|
688
|
+
declare const replaceAll: (string: string, target: string, replace: string) => string;
|
|
689
|
+
declare const changeCALayer: (rawData: formattedComment[]) => formattedComment[];
|
|
690
|
+
declare const getConfig: <T>(input: configItem<T>, isFlash?: boolean) => T;
|
|
691
|
+
declare const isFlashComment: (comment: formattedComment) => boolean;
|
|
692
|
+
|
|
685
693
|
|
|
686
694
|
export default NiconiComments;
|