@xpadev-net/niconicomments 0.1.11 → 0.1.12
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 +7 -7
- package/README.md +24 -24
- package/dist/bundle.js +88 -84
- package/package.json +32 -31
package/LICENSE
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
Copyright (c) 2021 xpadev https://xpadev.net
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
-
|
|
5
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
-
|
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
Copyright (c) 2021 xpadev https://xpadev.net
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
# [niconicomments](https://xpadev.net/niconicomments/)
|
|
2
|
-
[](https://github.com/xpadev-net/niconicomments/blob/master/LICENSE)
|
|
3
|
-
ニコニコ動画の公式プレイヤーに多少の互換性を持つコメント描画ライブラリです
|
|
4
|
-
This is a comment drawing library that is somewhat compatible with the official Nico Nico Douga player.
|
|
5
|
-
Reference: https://xpadev.net/niconicomments/docs/
|
|
6
|
-
Github: https://github.com/xpadev-net/niconicomments
|
|
7
|
-
|
|
8
|
-
## Installation
|
|
9
|
-
```html
|
|
10
|
-
<script src="https://cdn.jsdelivr.net/npm/@xpadev-net/niconicomments@latest/dist/bundle.min.js"></script>
|
|
11
|
-
```
|
|
12
|
-
or
|
|
13
|
-
```
|
|
14
|
-
npm i @xpadev-net/niconicomments
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Examples
|
|
18
|
-
```javascript
|
|
19
|
-
const niconiComments = new NiconiComments(canvas, comments);
|
|
20
|
-
niconiComments.drawCanvas(vpos)
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Sample
|
|
24
|
-
https://xpadev.net/niconicomments/sample.html
|
|
1
|
+
# [niconicomments](https://xpadev.net/niconicomments/)
|
|
2
|
+
[](https://github.com/xpadev-net/niconicomments/blob/master/LICENSE)
|
|
3
|
+
ニコニコ動画の公式プレイヤーに多少の互換性を持つコメント描画ライブラリです
|
|
4
|
+
This is a comment drawing library that is somewhat compatible with the official Nico Nico Douga player.
|
|
5
|
+
Reference: https://xpadev.net/niconicomments/docs/
|
|
6
|
+
Github: https://github.com/xpadev-net/niconicomments
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
```html
|
|
10
|
+
<script src="https://cdn.jsdelivr.net/npm/@xpadev-net/niconicomments@latest/dist/bundle.min.js"></script>
|
|
11
|
+
```
|
|
12
|
+
or
|
|
13
|
+
```
|
|
14
|
+
npm i @xpadev-net/niconicomments
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
18
|
+
```javascript
|
|
19
|
+
const niconiComments = new NiconiComments(canvas, comments);
|
|
20
|
+
niconiComments.drawCanvas(vpos)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Sample
|
|
24
|
+
https://xpadev.net/niconicomments/sample.html
|
package/dist/bundle.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
niconicomments.js v0.1.
|
|
2
|
+
niconicomments.js v0.1.12
|
|
3
3
|
(c) 2021 xpadev-net https://xpadev.net
|
|
4
4
|
Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
})(this, (function () { 'use strict';
|
|
11
11
|
|
|
12
12
|
class NiconiComments {
|
|
13
|
-
/**
|
|
14
|
-
* NiconiComments Constructor
|
|
15
|
-
* @param {HTMLCanvasElement} canvas - 描画対象のキャンバス
|
|
16
|
-
* @param {[]} data - 描画用のコメント
|
|
17
|
-
* @param {{useLegacy: boolean, formatted: boolean, video: HTMLVideoElement|null}} options - 細かい設定類
|
|
13
|
+
/**
|
|
14
|
+
* NiconiComments Constructor
|
|
15
|
+
* @param {HTMLCanvasElement} canvas - 描画対象のキャンバス
|
|
16
|
+
* @param {[]} data - 描画用のコメント
|
|
17
|
+
* @param {{useLegacy: boolean, formatted: boolean, video: HTMLVideoElement|null}} options - 細かい設定類
|
|
18
18
|
*/
|
|
19
19
|
constructor(canvas, data, options = {
|
|
20
20
|
useLegacy: false,
|
|
@@ -24,29 +24,30 @@
|
|
|
24
24
|
this.canvas = canvas;
|
|
25
25
|
this.context = canvas.getContext("2d");
|
|
26
26
|
this.context.strokeStyle = "rgba(0,0,0,0.7)";
|
|
27
|
-
this.context.textAlign = "
|
|
28
|
-
this.context.textBaseline = "
|
|
27
|
+
this.context.textAlign = "start";
|
|
28
|
+
this.context.textBaseline = "alphabetic";
|
|
29
29
|
this.context.lineWidth = 4;
|
|
30
30
|
|
|
31
31
|
if (options.useLegacy) {
|
|
32
|
-
this.commentYOffset = 0.
|
|
32
|
+
this.commentYOffset = 0.0;
|
|
33
33
|
} else {
|
|
34
|
-
this.commentYOffset = 0.
|
|
34
|
+
this.commentYOffset = 0.0;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
this.
|
|
37
|
+
this.commentYPaddingTop = 0.08;
|
|
38
|
+
this.commentYMarginBottom = 0.24;
|
|
38
39
|
this.fontSize = {
|
|
39
40
|
"small": {
|
|
40
41
|
"default": 47,
|
|
41
|
-
"resized":
|
|
42
|
+
"resized": 26.1
|
|
42
43
|
},
|
|
43
44
|
"medium": {
|
|
44
|
-
"default":
|
|
45
|
-
"resized":
|
|
45
|
+
"default": 74,
|
|
46
|
+
"resized": 38.7
|
|
46
47
|
},
|
|
47
48
|
"big": {
|
|
48
|
-
"default":
|
|
49
|
-
"resized":
|
|
49
|
+
"default": 111,
|
|
50
|
+
"resized": 61
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
53
|
this.defaultCommandValue = {
|
|
@@ -77,7 +78,7 @@
|
|
|
77
78
|
this.data = this.parseData(data);
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
this.video = options.video
|
|
81
|
+
this.video = options.video ? options.video : null;
|
|
81
82
|
this.showCollision = false;
|
|
82
83
|
this.showFPS = false;
|
|
83
84
|
this.showCommentCount = false;
|
|
@@ -90,6 +91,7 @@
|
|
|
90
91
|
this.collision_left = {};
|
|
91
92
|
this.collision_ue = {};
|
|
92
93
|
this.collision_shita = {};
|
|
94
|
+
this.lastVpos = null;
|
|
93
95
|
this.useLegacy = options.useLegacy;
|
|
94
96
|
this.preRendering();
|
|
95
97
|
this.fpsCount = 0;
|
|
@@ -99,10 +101,10 @@
|
|
|
99
101
|
this.fpsCount = 0;
|
|
100
102
|
}, 500);
|
|
101
103
|
}
|
|
102
|
-
/**
|
|
103
|
-
* ニコニコが吐き出したデータを処理しやすいように変換する
|
|
104
|
-
* @param {[]} data - ニコニコが吐き出したコメントデータ
|
|
105
|
-
* @returns {*[]} - 独自フォーマットのコメントデータ
|
|
104
|
+
/**
|
|
105
|
+
* ニコニコが吐き出したデータを処理しやすいように変換する
|
|
106
|
+
* @param {[]} data - ニコニコが吐き出したコメントデータ
|
|
107
|
+
* @returns {*[]} - 独自フォーマットのコメントデータ
|
|
106
108
|
*/
|
|
107
109
|
|
|
108
110
|
|
|
@@ -146,8 +148,8 @@
|
|
|
146
148
|
});
|
|
147
149
|
return data_;
|
|
148
150
|
}
|
|
149
|
-
/**
|
|
150
|
-
* 事前に当たり判定を考慮してコメントの描画場所を決定する
|
|
151
|
+
/**
|
|
152
|
+
* 事前に当たり判定を考慮してコメントの描画場所を決定する
|
|
151
153
|
*/
|
|
152
154
|
|
|
153
155
|
|
|
@@ -157,8 +159,8 @@
|
|
|
157
159
|
this.getCommentPos();
|
|
158
160
|
this.sortComment();
|
|
159
161
|
}
|
|
160
|
-
/**
|
|
161
|
-
* コマンドをもとに各コメントに適用するフォントを決定する
|
|
162
|
+
/**
|
|
163
|
+
* コマンドをもとに各コメントに適用するフォントを決定する
|
|
162
164
|
*/
|
|
163
165
|
|
|
164
166
|
|
|
@@ -176,11 +178,11 @@
|
|
|
176
178
|
this.data[i]._live = command._live;
|
|
177
179
|
this.data[i].long = command.long;
|
|
178
180
|
this.data[i].invisible = command.invisible;
|
|
179
|
-
this.data[i].content = this.data[i].content.replaceAll("\t", "
|
|
181
|
+
this.data[i].content = this.data[i].content.replaceAll("\t", " ");
|
|
180
182
|
}
|
|
181
183
|
}
|
|
182
|
-
/**
|
|
183
|
-
* コメントの描画サイズを計算する
|
|
184
|
+
/**
|
|
185
|
+
* コメントの描画サイズを計算する
|
|
184
186
|
*/
|
|
185
187
|
|
|
186
188
|
|
|
@@ -189,7 +191,7 @@
|
|
|
189
191
|
|
|
190
192
|
for (let i in tmpData) {
|
|
191
193
|
for (let j in tmpData[i]) {
|
|
192
|
-
this.context.font = parseFont(
|
|
194
|
+
this.context.font = parseFont(i, j, this.useLegacy);
|
|
193
195
|
|
|
194
196
|
for (let k in tmpData[i][j]) {
|
|
195
197
|
let comment = tmpData[i][j][k];
|
|
@@ -206,14 +208,14 @@
|
|
|
206
208
|
|
|
207
209
|
if (measure.resized) {
|
|
208
210
|
this.data[comment.index].fontSize = measure.fontSize;
|
|
209
|
-
this.context.font = parseFont(
|
|
211
|
+
this.context.font = parseFont(i, j, this.useLegacy);
|
|
210
212
|
}
|
|
211
213
|
}
|
|
212
214
|
}
|
|
213
215
|
}
|
|
214
216
|
}
|
|
215
|
-
/**
|
|
216
|
-
* 計算された描画サイズをもとに各コメントの配置位置を決定する
|
|
217
|
+
/**
|
|
218
|
+
* 計算された描画サイズをもとに各コメントの配置位置を決定する
|
|
217
219
|
*/
|
|
218
220
|
|
|
219
221
|
|
|
@@ -426,11 +428,11 @@
|
|
|
426
428
|
});
|
|
427
429
|
}
|
|
428
430
|
}
|
|
429
|
-
/**
|
|
430
|
-
* context.measureTextの複数行対応版
|
|
431
|
-
* 画面外にはみ出すコメントの縮小も行う
|
|
432
|
-
* @param comment - 独自フォーマットのコメントデータ
|
|
433
|
-
* @returns {{resized: boolean, width: number, width_max: number, fontSize: number, width_min: number, height: number}} - 描画サイズとリサイズの情報
|
|
431
|
+
/**
|
|
432
|
+
* context.measureTextの複数行対応版
|
|
433
|
+
* 画面外にはみ出すコメントの縮小も行う
|
|
434
|
+
* @param comment - 独自フォーマットのコメントデータ
|
|
435
|
+
* @returns {{resized: boolean, width: number, width_max: number, fontSize: number, width_min: number, height: number}} - 描画サイズとリサイズの情報
|
|
434
436
|
*/
|
|
435
437
|
|
|
436
438
|
|
|
@@ -447,17 +449,17 @@
|
|
|
447
449
|
comment.fontSize = this.fontSize.big.resized;
|
|
448
450
|
comment.resized = true;
|
|
449
451
|
comment.tateRisized = true;
|
|
450
|
-
this.context.font = parseFont(
|
|
452
|
+
this.context.font = parseFont(comment.font, comment.fontSize, this.useLegacy);
|
|
451
453
|
} else if (comment.size === "medium" && lines.length > 4) {
|
|
452
454
|
comment.fontSize = this.fontSize.medium.resized;
|
|
453
455
|
comment.resized = true;
|
|
454
456
|
comment.tateRisized = true;
|
|
455
|
-
this.context.font = parseFont(
|
|
457
|
+
this.context.font = parseFont(comment.font, comment.fontSize, this.useLegacy);
|
|
456
458
|
} else if (comment.size === "small" && lines.length > 6) {
|
|
457
459
|
comment.fontSize = this.fontSize.small.resized;
|
|
458
460
|
comment.resized = true;
|
|
459
461
|
comment.tateRisized = true;
|
|
460
|
-
this.context.font = parseFont(
|
|
462
|
+
this.context.font = parseFont(comment.font, comment.fontSize, this.useLegacy);
|
|
461
463
|
}
|
|
462
464
|
}
|
|
463
465
|
|
|
@@ -469,36 +471,36 @@
|
|
|
469
471
|
width = width_arr.reduce((p, c) => p + c, 0) / width_arr.length;
|
|
470
472
|
width_max = Math.max(...width_arr);
|
|
471
473
|
width_min = Math.min(...width_arr);
|
|
472
|
-
height =
|
|
474
|
+
height = comment.fontSize * (1 + this.commentYPaddingTop) * lines.length + this.commentYMarginBottom * comment.fontSize;
|
|
473
475
|
|
|
474
476
|
if (comment.loc !== "naka" && !comment.tateRisized) {
|
|
475
|
-
if (comment.full && width_max >
|
|
477
|
+
if (comment.full && width_max > 1840) {
|
|
476
478
|
comment.fontSize -= 1;
|
|
477
479
|
comment.resized = true;
|
|
478
480
|
comment.yokoResized = true;
|
|
479
|
-
this.context.font = parseFont(
|
|
481
|
+
this.context.font = parseFont(comment.font, comment.fontSize, this.useLegacy);
|
|
480
482
|
return this.measureText(comment);
|
|
481
483
|
} else if (!comment.full && width_max > 1440) {
|
|
482
484
|
comment.fontSize -= 1;
|
|
483
485
|
comment.resized = true;
|
|
484
486
|
comment.yokoResized = true;
|
|
485
|
-
this.context.font = parseFont(
|
|
487
|
+
this.context.font = parseFont(comment.font, comment.fontSize, this.useLegacy);
|
|
486
488
|
return this.measureText(comment);
|
|
487
489
|
}
|
|
488
490
|
} else if (comment.loc !== "naka" && comment.tateRisized && (comment.full && width_max > 1920 || !comment.full && width_max > 1440) && !comment.yokoResized) {
|
|
489
491
|
comment.fontSize = this.fontSize[comment.size].default;
|
|
490
492
|
comment.resized = true;
|
|
491
493
|
comment.yokoResized = true;
|
|
492
|
-
this.context.font = parseFont(
|
|
494
|
+
this.context.font = parseFont(comment.font, comment.fontSize, this.useLegacy);
|
|
493
495
|
return this.measureText(comment);
|
|
494
496
|
} else if (comment.loc !== "naka" && comment.tateRisized && comment.yokoResized) {
|
|
495
497
|
if (comment.full && width_max > this.doubleResizeMaxWidth.full[this.useLegacy ? "legacy" : "default"]) {
|
|
496
498
|
comment.fontSize -= 1;
|
|
497
|
-
this.context.font = parseFont(
|
|
499
|
+
this.context.font = parseFont(comment.font, comment.fontSize, this.useLegacy);
|
|
498
500
|
return this.measureText(comment);
|
|
499
501
|
} else if (!comment.full && width_max > this.doubleResizeMaxWidth.normal[this.useLegacy ? "legacy" : "default"]) {
|
|
500
502
|
comment.fontSize -= 1.;
|
|
501
|
-
this.context.font = parseFont(
|
|
503
|
+
this.context.font = parseFont(comment.font, comment.fontSize, this.useLegacy);
|
|
502
504
|
return this.measureText(comment);
|
|
503
505
|
}
|
|
504
506
|
}
|
|
@@ -512,10 +514,10 @@
|
|
|
512
514
|
"fontSize": comment.fontSize
|
|
513
515
|
};
|
|
514
516
|
}
|
|
515
|
-
/**
|
|
516
|
-
* コマンドをもとに所定の位置にコメントを表示する
|
|
517
|
-
* @param comment - 独自フォーマットのコメントデータ
|
|
518
|
-
* @param {number} vpos - 動画の現在位置の100倍 ニコニコから吐き出されるコメントの位置情報は主にこれ
|
|
517
|
+
/**
|
|
518
|
+
* コマンドをもとに所定の位置にコメントを表示する
|
|
519
|
+
* @param comment - 独自フォーマットのコメントデータ
|
|
520
|
+
* @param {number} vpos - 動画の現在位置の100倍 ニコニコから吐き出されるコメントの位置情報は主にこれ
|
|
519
521
|
*/
|
|
520
522
|
|
|
521
523
|
|
|
@@ -566,9 +568,9 @@
|
|
|
566
568
|
posY;
|
|
567
569
|
|
|
568
570
|
if (comment.loc === "shita") {
|
|
569
|
-
posY = 1080 - comment.posY
|
|
571
|
+
posY = 1080 - comment.posY - comment.height + (Number(i) + 1) * comment.fontSize * (1 + this.commentYPaddingTop);
|
|
570
572
|
} else {
|
|
571
|
-
posY = comment.posY + i
|
|
573
|
+
posY = comment.posY + (Number(i) + 1) * comment.fontSize * (1 + this.commentYPaddingTop);
|
|
572
574
|
}
|
|
573
575
|
|
|
574
576
|
this.context.strokeText(line, posX, posY);
|
|
@@ -576,7 +578,7 @@
|
|
|
576
578
|
|
|
577
579
|
if (this.showCollision) {
|
|
578
580
|
this.context.strokeStyle = "rgba(255,255,0,0.5)";
|
|
579
|
-
this.context.strokeRect(posX, posY, comment.width_max, comment.fontSize);
|
|
581
|
+
this.context.strokeRect(posX, posY, comment.width_max, comment.fontSize * -1);
|
|
580
582
|
|
|
581
583
|
if (comment.color === "#000000") {
|
|
582
584
|
this.context.strokeStyle = "rgba(255,255,255,0.7)";
|
|
@@ -586,10 +588,10 @@
|
|
|
586
588
|
}
|
|
587
589
|
}
|
|
588
590
|
}
|
|
589
|
-
/**
|
|
590
|
-
* コメントに含まれるコマンドを解釈する
|
|
591
|
-
* @param comment- 独自フォーマットのコメントデータ
|
|
592
|
-
* @returns {{loc: string|null, size: string|null, color: string|null, fontSize: number|null, ender: boolean, font: string|null, full: boolean, _live: boolean, invisible: boolean, long:number|null}}
|
|
591
|
+
/**
|
|
592
|
+
* コメントに含まれるコマンドを解釈する
|
|
593
|
+
* @param comment- 独自フォーマットのコメントデータ
|
|
594
|
+
* @returns {{loc: string|null, size: string|null, color: string|null, fontSize: number|null, ender: boolean, font: string|null, full: boolean, _live: boolean, invisible: boolean, long:number|null}}
|
|
593
595
|
*/
|
|
594
596
|
|
|
595
597
|
|
|
@@ -879,13 +881,15 @@
|
|
|
879
881
|
|
|
880
882
|
return data;
|
|
881
883
|
}
|
|
882
|
-
/**
|
|
883
|
-
* キャンバスを描画する
|
|
884
|
-
* @param vpos - 動画の現在位置の100倍 ニコニコから吐き出されるコメントの位置情報は主にこれ
|
|
884
|
+
/**
|
|
885
|
+
* キャンバスを描画する
|
|
886
|
+
* @param vpos - 動画の現在位置の100倍 ニコニコから吐き出されるコメントの位置情報は主にこれ
|
|
885
887
|
*/
|
|
886
888
|
|
|
887
889
|
|
|
888
890
|
drawCanvas(vpos) {
|
|
891
|
+
if (this.lastVpos === vpos) return;
|
|
892
|
+
this.lastVpos = vpos;
|
|
889
893
|
this.fpsCount++;
|
|
890
894
|
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
891
895
|
|
|
@@ -956,8 +960,8 @@
|
|
|
956
960
|
}
|
|
957
961
|
}
|
|
958
962
|
}
|
|
959
|
-
/**
|
|
960
|
-
* キャンバスを消去する
|
|
963
|
+
/**
|
|
964
|
+
* キャンバスを消去する
|
|
961
965
|
*/
|
|
962
966
|
|
|
963
967
|
|
|
@@ -966,12 +970,12 @@
|
|
|
966
970
|
}
|
|
967
971
|
|
|
968
972
|
}
|
|
969
|
-
/**
|
|
970
|
-
* 配列を複数のキーでグループ化する
|
|
971
|
-
* @param {{}} array
|
|
972
|
-
* @param {string} key
|
|
973
|
-
* @param {string} key2
|
|
974
|
-
* @returns {{}}
|
|
973
|
+
/**
|
|
974
|
+
* 配列を複数のキーでグループ化する
|
|
975
|
+
* @param {{}} array
|
|
976
|
+
* @param {string} key
|
|
977
|
+
* @param {string} key2
|
|
978
|
+
* @returns {{}}
|
|
975
979
|
*/
|
|
976
980
|
|
|
977
981
|
|
|
@@ -993,12 +997,12 @@
|
|
|
993
997
|
|
|
994
998
|
return data;
|
|
995
999
|
};
|
|
996
|
-
/**
|
|
997
|
-
* フォント名とサイズをもとにcontextで使えるフォントを生成する
|
|
998
|
-
* @param {string} font
|
|
999
|
-
* @param {number} size
|
|
1000
|
-
* @param {boolean} useLegacy
|
|
1001
|
-
* @returns {string}
|
|
1000
|
+
/**
|
|
1001
|
+
* フォント名とサイズをもとにcontextで使えるフォントを生成する
|
|
1002
|
+
* @param {string} font
|
|
1003
|
+
* @param {number} size
|
|
1004
|
+
* @param {boolean} useLegacy
|
|
1005
|
+
* @returns {string}
|
|
1002
1006
|
*/
|
|
1003
1007
|
|
|
1004
1008
|
|
|
@@ -1019,11 +1023,11 @@
|
|
|
1019
1023
|
|
|
1020
1024
|
}
|
|
1021
1025
|
};
|
|
1022
|
-
/**
|
|
1023
|
-
* phpのarray_push的なあれ
|
|
1024
|
-
* @param array
|
|
1025
|
-
* @param {string} key
|
|
1026
|
-
* @param push
|
|
1026
|
+
/**
|
|
1027
|
+
* phpのarray_push的なあれ
|
|
1028
|
+
* @param array
|
|
1029
|
+
* @param {string} key
|
|
1030
|
+
* @param push
|
|
1027
1031
|
*/
|
|
1028
1032
|
|
|
1029
1033
|
|
|
@@ -1038,10 +1042,10 @@
|
|
|
1038
1042
|
|
|
1039
1043
|
array[key].push(push);
|
|
1040
1044
|
};
|
|
1041
|
-
/**
|
|
1042
|
-
* Hexからrgbに変換する(_live用)
|
|
1043
|
-
* @param {string} hex
|
|
1044
|
-
* @return {array} RGB
|
|
1045
|
+
/**
|
|
1046
|
+
* Hexからrgbに変換する(_live用)
|
|
1047
|
+
* @param {string} hex
|
|
1048
|
+
* @return {array} RGB
|
|
1045
1049
|
*/
|
|
1046
1050
|
|
|
1047
1051
|
|
package/package.json
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@xpadev-net/niconicomments",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "NiconiComments is a comment drawing library that is somewhat compatible with the official Nico Nico Douga player.",
|
|
5
|
-
"main": "dist/bundle.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
-
"build": "rollup -c rollup.config.js",
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@xpadev-net/niconicomments",
|
|
3
|
+
"version": "0.1.12",
|
|
4
|
+
"description": "NiconiComments is a comment drawing library that is somewhat compatible with the official Nico Nico Douga player.",
|
|
5
|
+
"main": "dist/bundle.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
+
"build": "rollup -c rollup.config.js",
|
|
9
|
+
"watch": "rollup -c rollup.config.js -w",
|
|
10
|
+
"prepublishOnly": "rollup -c rollup.config.js"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/xpadev-net/niconicomments.git"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"niconico"
|
|
18
|
+
],
|
|
19
|
+
"author": "xpadev(xpadev.net)",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/xpadev-net/niconicomments/issues"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist/bundle.js"
|
|
25
|
+
],
|
|
26
|
+
"homepage": "https://xpadev.net/niconicomments/docs/",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"rollup": "^2.61.1",
|
|
30
|
+
"@rollup/plugin-babel": "^5.3.0"
|
|
31
|
+
}
|
|
32
|
+
}
|