@mkody/twitch-emoticons 2.5.0 → 2.6.0
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/.jsdoc.json +5 -0
- package/LICENSE +1 -0
- package/README.md +85 -13
- package/docs/BTTVEmote.html +87 -37
- package/docs/Channel.html +165 -42
- package/docs/Collection.html +42 -36
- package/docs/Emote.html +58 -25
- package/docs/EmoteFetcher.html +2694 -2075
- package/docs/EmoteParser.html +39 -20
- package/docs/FFZEmote.html +91 -37
- package/docs/SevenTV.html +1191 -0
- package/docs/SevenTVEmote.html +1318 -0
- package/docs/TwitchEmote.html +85 -37
- package/docs/index.html +201 -132
- package/docs/scripts/collapse.js +19 -0
- package/docs/scripts/commonNav.js +28 -0
- package/docs/scripts/search.js +16 -0
- package/docs/struct_BTTVEmote.js.html +5 -2
- package/docs/struct_Channel.js.html +21 -10
- package/docs/struct_Emote.js.html +6 -3
- package/docs/struct_EmoteFetcher.js.html +168 -109
- package/docs/struct_EmoteParser.js.html +5 -2
- package/docs/struct_FFZEmote.js.html +5 -2
- package/docs/struct_SevenTVEmote.js.html +135 -0
- package/docs/struct_TwitchEmote.js.html +5 -2
- package/docs/styles/jsdoc.css +13 -2
- package/docs/styles/prettify.css +1 -0
- package/docs/util_Collection.js.html +5 -2
- package/package.json +15 -13
- package/src/index.js +4 -3
- package/src/struct/Channel.js +16 -8
- package/src/struct/Emote.js +1 -1
- package/src/struct/EmoteFetcher.js +96 -40
- package/src/struct/SevenTVEmote.js +63 -0
- package/src/util/Constants.js +5 -1
- package/test/index.js +39 -3
- package/typings/index.d.ts +35 -18
- package/typings/test.ts +0 -24
package/docs/index.html
CHANGED
|
@@ -1,133 +1,202 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
|
|
5
|
-
<meta charset="utf-8">
|
|
6
|
-
<title>Home - Documentation</title>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<script src="scripts/prettify/prettify.js"></script>
|
|
10
|
-
<script src="scripts/prettify/lang-css.js"></script>
|
|
11
|
-
<!--[if lt IE 9]>
|
|
12
|
-
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
13
|
-
<![endif]-->
|
|
14
|
-
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
|
|
15
|
-
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
|
|
16
|
-
<script src="scripts/nav.js" defer></script>
|
|
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
|
-
To get a client and secret
|
|
69
|
-
|
|
70
|
-
<h3>Install</h3>
|
|
71
|
-
<pre class="prettyprint source lang-sh"><code>npm install @mkody/twitch-emoticons
|
|
72
|
-
# or
|
|
73
|
-
yarn add @mkody/twitch-emoticons
|
|
74
|
-
</code></pre>
|
|
75
|
-
<h3>
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
fetcher
|
|
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
|
-
|
|
132
|
-
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<title>Home - Documentation</title>
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
<script src="scripts/prettify/prettify.js"></script>
|
|
10
|
+
<script src="scripts/prettify/lang-css.js"></script>
|
|
11
|
+
<!--[if lt IE 9]>
|
|
12
|
+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
13
|
+
<![endif]-->
|
|
14
|
+
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
|
|
15
|
+
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
|
|
16
|
+
<script src="scripts/nav.js" defer></script>
|
|
17
|
+
|
|
18
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
19
|
+
</head>
|
|
20
|
+
<body>
|
|
21
|
+
|
|
22
|
+
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
|
23
|
+
<label for="nav-trigger" class="navicon-button x">
|
|
24
|
+
<div class="navicon"></div>
|
|
25
|
+
</label>
|
|
26
|
+
|
|
27
|
+
<label for="nav-trigger" class="overlay"></label>
|
|
28
|
+
|
|
29
|
+
<nav >
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#.toLink#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#.toString#toString">toString</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#.fetchBTTVEmotes#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#.fetchFFZEmotes#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#.fetchSevenTVEmotes#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="Collection.html">Collection</a><ul class='methods'><li data-type='method'><a href="Collection.html#.filter#filter">filter</a></li><li data-type='method'><a href="Collection.html#.find#find">find</a></li><li data-type='method'><a href="Collection.html#.map#map">map</a></li></ul></li><li><a href="Emote.html">Emote</a><ul class='methods'><li data-type='method'><a href="Emote.html#.toString#toString">toString</a></li></ul></li><li><a href="EmoteFetcher.html">EmoteFetcher</a><ul class='methods'><li data-type='method'><a href="EmoteFetcher.html#._cacheBTTVEmote#_cacheBTTVEmote">_cacheBTTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#._cacheFFZEmote#_cacheFFZEmote">_cacheFFZEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#._cacheSevenTVEmote#_cacheSevenTVEmote">_cacheSevenTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#._cacheTwitchEmote#_cacheTwitchEmote">_cacheTwitchEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#._getRawBTTVEmotes#_getRawBTTVEmotes">_getRawBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#._getRawFFZEmotes#_getRawFFZEmotes">_getRawFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#._getRawSevenTVEmotes#_getRawSevenTVEmotes">_getRawSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#._getRawTwitchEmotes#_getRawTwitchEmotes">_getRawTwitchEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#.fetchBTTVEmotes#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#.fetchFFZEmotes#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#.fetchSevenTVEmotes#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#.fetchTwitchEmotes#fetchTwitchEmotes">fetchTwitchEmotes</a></li></ul></li><li><a href="EmoteParser.html">EmoteParser</a><ul class='methods'><li data-type='method'><a href="EmoteParser.html#.parse#parse">parse</a></li></ul></li><li><a href="FFZEmote.html">FFZEmote</a><ul class='methods'><li data-type='method'><a href="FFZEmote.html#.toLink#toLink">toLink</a></li><li data-type='method'><a href="FFZEmote.html#.toString#toString">toString</a></li></ul></li><li><a href="SevenTVEmote.html">SevenTVEmote</a><ul class='methods'><li data-type='method'><a href="SevenTVEmote.html#.toLink#toLink">toLink</a></li><li data-type='method'><a href="SevenTVEmote.html#.toString#toString">toString</a></li></ul></li><li><a href="TwitchEmote.html">TwitchEmote</a><ul class='methods'><li data-type='method'><a href="TwitchEmote.html#.toLink#toLink">toLink</a></li><li data-type='method'><a href="TwitchEmote.html#.toString#toString">toString</a></li></ul></li></ul>
|
|
33
|
+
|
|
34
|
+
</nav>
|
|
35
|
+
|
|
36
|
+
<div id="main">
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<section class="package">
|
|
47
|
+
<h3>@mkody/twitch-emoticons 2.5.0</h3>
|
|
48
|
+
</section>
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
<section class="readme usertext">
|
|
63
|
+
<article><h1>twitch-emoticons</h1>
|
|
64
|
+
<p>Gets Twitch, BTTV, FFZ and 7TV emotes as well as parsing text to emotes!</p>
|
|
65
|
+
<h3>Migrating from upstream</h3>
|
|
66
|
+
<p>You must now use a Twitch user ID instead of the username to fetch user's emotes.<br>
|
|
67
|
+
You can use <a href="https://s.kdy.ch/twitchid/">this page to quickly grab it</a>.</p>
|
|
68
|
+
<p>To fetch Twitch emotes you need to get a client and secret from Twitch <a href="https://dev.twitch.tv/console/apps/create">here</a>, it's free.<br>
|
|
69
|
+
If you are only using BetterTTV, FrankerFaceZ and 7TV you don't need to provide Twitch app keys as they are independent from the Twitch API.</p>
|
|
70
|
+
<h3>Install</h3>
|
|
71
|
+
<pre class="prettyprint source lang-sh"><code>npm install @mkody/twitch-emoticons
|
|
72
|
+
# or
|
|
73
|
+
yarn add @mkody/twitch-emoticons
|
|
74
|
+
</code></pre>
|
|
75
|
+
<h3>Examples</h3>
|
|
76
|
+
<h4>Basic Twitch emote parsing</h4>
|
|
77
|
+
<pre class="prettyprint source lang-js"><code>// With ESM import
|
|
78
|
+
import TwitchEmoticons from '@mkody/twitch-emoticons';
|
|
79
|
+
const { EmoteFetcher, EmoteParser } = TwitchEmoticons;
|
|
80
|
+
// ... or require()
|
|
81
|
+
const { EmoteFetcher, EmoteParser } = require('@mkody/twitch-emoticons');
|
|
82
|
+
|
|
83
|
+
// Your Twitch app keys
|
|
84
|
+
const clientId = '<your client id>';
|
|
85
|
+
const clientSecret = '<your client secret>';
|
|
86
|
+
|
|
87
|
+
const fetcher = new EmoteFetcher(clientId, clientSecret);
|
|
88
|
+
const parser = new EmoteParser(fetcher, {
|
|
89
|
+
type: 'markdown',
|
|
90
|
+
match: /:(.+?):/g
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
fetcher.fetchTwitchEmotes(null).then(() => {
|
|
94
|
+
const kappa = fetcher.emotes.get('Kappa').toLink();
|
|
95
|
+
console.log(kappa);
|
|
96
|
+
// https://static-cdn.jtvnw.net/emoticons/v2/25/default/dark/1.0
|
|
97
|
+
|
|
98
|
+
const text = 'Hello :CoolCat:!';
|
|
99
|
+
const parsed = parser.parse(text);
|
|
100
|
+
console.log(parsed);
|
|
101
|
+
// Hello !
|
|
102
|
+
});
|
|
103
|
+
</code></pre>
|
|
104
|
+
<h4>All providers, global + channel, custom template and match pattern</h4>
|
|
105
|
+
<pre class="prettyprint source lang-js"><code>const { EmoteFetcher, EmoteParser } = require('@mkody/twitch-emoticons');
|
|
106
|
+
|
|
107
|
+
// Your channel ID
|
|
108
|
+
const channelId = 44317909;
|
|
109
|
+
|
|
110
|
+
// Your Twitch app keys
|
|
111
|
+
const clientId = '<your client id>';
|
|
112
|
+
const clientSecret = '<your client secret>';
|
|
113
|
+
|
|
114
|
+
const fetcher = new EmoteFetcher(clientId, clientSecret);
|
|
115
|
+
const parser = new EmoteParser(fetcher, {
|
|
116
|
+
template: '<img class="emote" alt="{name}" src="{link}">', // Custom HTML format
|
|
117
|
+
match: /(\w+)+?/g // Match without :colons:
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
Promise.all([
|
|
121
|
+
// Twitch global
|
|
122
|
+
fetcher.fetchTwitchEmotes(),
|
|
123
|
+
// Twitch channel
|
|
124
|
+
fetcher.fetchTwitchEmotes(channelId),
|
|
125
|
+
// BTTV global
|
|
126
|
+
fetcher.fetchBTTVEmotes(),
|
|
127
|
+
// BTTV channel
|
|
128
|
+
fetcher.fetchBTTVEmotes(channelId),
|
|
129
|
+
// 7TV global
|
|
130
|
+
fetcher.fetchSevenTVEmotes(),
|
|
131
|
+
// 7TV channel
|
|
132
|
+
fetcher.fetchSevenTVEmotes(channelId),
|
|
133
|
+
// FFZ channel
|
|
134
|
+
fetcher.fetchFFZEmotes(channelId)
|
|
135
|
+
]).then(() => {
|
|
136
|
+
const globalEmotes = parser.parse('EZ Clap way too easy LUL now for the last bost monkaS');
|
|
137
|
+
console.log(globalEmotes);
|
|
138
|
+
// <img class="emote" alt="EZ" src="https://cdn.7tv.app/emote/6320bf2ad461b9ebf9413812/1x.webp"> <img class="emote" alt="Clap" src="https://cdn.7tv.app/emote/636b877aada75990352334c7/1x.webp"> way too easy <img class="emote" alt="LUL" src="https://static-cdn.jtvnw.net/emoticons/v2/425618/default/dark/1.0"> now for the last bost <img class="emote" alt="monkaS" src="https://cdn.betterttv.net/emote/56e9f494fff3cc5c35e5287e/1x">
|
|
139
|
+
|
|
140
|
+
const channelEmotes = parser.parse('KEKW that was 3Head TeriPoint');
|
|
141
|
+
console.log(channelEmotes);
|
|
142
|
+
// <img class="emote" alt="KEKW" src="https://cdn.betterttv.net/emote/5e9c6c187e090362f8b0b9e8/1x"> that was <img class="emote" alt="3Head" src="https://cdn.frankerfacez.com/emote/274406/1"> <img class="emote" alt="TeriPoint" src="https://cdn.7tv.app/emote/61dc299b600369a98b38ebef/1x.webp">
|
|
143
|
+
}).catch(err => {
|
|
144
|
+
console.error('Error loading emotes...');
|
|
145
|
+
console.error(err);
|
|
146
|
+
});
|
|
147
|
+
</code></pre>
|
|
148
|
+
<h4>7TV formats</h4>
|
|
149
|
+
<p>7TV v3 delivers emotes in either WEBP or AVIF.<br>
|
|
150
|
+
By default we'll return WEBP emotes but you can override this.</p>
|
|
151
|
+
<pre class="prettyprint source lang-js"><code>const { EmoteFetcher } = require('@mkody/twitch-emoticons');
|
|
152
|
+
const fetcher = new EmoteFetcher();
|
|
153
|
+
|
|
154
|
+
// Fetch global emotes in AVIF (channel id has to be `null` for global)
|
|
155
|
+
fetcher.fetchSevenTVEmotes(null, 'avif');
|
|
156
|
+
|
|
157
|
+
// Fetch 0kody's emotes with the package's default format (WEBP)
|
|
158
|
+
fetcher.fetchSevenTVEmotes(44317909);
|
|
159
|
+
|
|
160
|
+
// ... which is currently the same as
|
|
161
|
+
fetcher.fetchSevenTVEmotes(44317909, 'webp');
|
|
162
|
+
|
|
163
|
+
// Fetch Anatole's emotes in AVIF
|
|
164
|
+
fetcher.fetchSevenTVEmotes(24377667, 'avif');
|
|
165
|
+
</code></pre>
|
|
166
|
+
<h3>Links</h3>
|
|
167
|
+
<ul>
|
|
168
|
+
<li><a href="https://github.com/mkody/twitch-emoticons">Github</a></li>
|
|
169
|
+
<li><a href="https://mkody.github.io/twitch-emoticons/">Documentation</a></li>
|
|
170
|
+
<li><a href="https://github.com/mkody/twitch-emoticons/releases">Changelog</a></li>
|
|
171
|
+
</ul>
|
|
172
|
+
<p>This library uses the following:</p>
|
|
173
|
+
<ul>
|
|
174
|
+
<li><a href="https://betterttv.com/">BetterTTV API</a></li>
|
|
175
|
+
<li><a href="https://www.frankerfacez.com/developers">FrankerFaceZ API</a></li>
|
|
176
|
+
<li><a href="https://7tv.app/">7TV API</a></li>
|
|
177
|
+
</ul></article>
|
|
178
|
+
</section>
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
</div>
|
|
188
|
+
|
|
189
|
+
<br class="clear">
|
|
190
|
+
|
|
191
|
+
<footer>
|
|
192
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.0</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
193
|
+
</footer>
|
|
194
|
+
|
|
195
|
+
<script>prettyPrint();</script>
|
|
196
|
+
<script src="scripts/polyfill.js"></script>
|
|
197
|
+
<script src="scripts/linenumber.js"></script>
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
</body>
|
|
133
202
|
</html>
|
package/docs/scripts/collapse.js
CHANGED
|
@@ -1,15 +1,34 @@
|
|
|
1
1
|
function hideAllButCurrent(){
|
|
2
2
|
//by default all submenut items are hidden
|
|
3
3
|
//but we need to rehide them for search
|
|
4
|
+
document.querySelectorAll("nav > ul").forEach(function(parent) {
|
|
5
|
+
if (parent.className.indexOf("collapse_top") !== -1) {
|
|
6
|
+
parent.style.display = "none";
|
|
7
|
+
}
|
|
8
|
+
});
|
|
4
9
|
document.querySelectorAll("nav > ul > li > ul li").forEach(function(parent) {
|
|
5
10
|
parent.style.display = "none";
|
|
6
11
|
});
|
|
12
|
+
document.querySelectorAll("nav > h3").forEach(function(section) {
|
|
13
|
+
if (section.className.indexOf("collapsed_header") !== -1) {
|
|
14
|
+
section.addEventListener("click", function(){
|
|
15
|
+
if (section.nextSibling.style.display === "none") {
|
|
16
|
+
section.nextSibling.style.display = "block";
|
|
17
|
+
} else {
|
|
18
|
+
section.nextSibling.style.display = "none";
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
7
23
|
|
|
8
24
|
//only current page (if it exists) should be opened
|
|
9
25
|
var file = window.location.pathname.split("/").pop().replace(/\.html/, '');
|
|
10
26
|
document.querySelectorAll("nav > ul > li > a").forEach(function(parent) {
|
|
11
27
|
var href = parent.attributes.href.value.replace(/\.html/, '');
|
|
12
28
|
if (file === href) {
|
|
29
|
+
if (parent.parentNode.parentNode.className.indexOf("collapse_top") !== -1) {
|
|
30
|
+
parent.parentNode.parentNode.style.display = "block";
|
|
31
|
+
}
|
|
13
32
|
parent.parentNode.querySelectorAll("ul li").forEach(function(elem) {
|
|
14
33
|
elem.style.display = "block";
|
|
15
34
|
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
if (typeof fetch === 'function') {
|
|
2
|
+
const init = () => {
|
|
3
|
+
if (typeof scrollToNavItem !== 'function') return false
|
|
4
|
+
scrollToNavItem()
|
|
5
|
+
// hideAllButCurrent not always loaded
|
|
6
|
+
if (typeof hideAllButCurrent === 'function') hideAllButCurrent()
|
|
7
|
+
return true
|
|
8
|
+
}
|
|
9
|
+
fetch('./nav.inc.html')
|
|
10
|
+
.then(response => response.ok ? response.text() : `${response.url} => ${response.status} ${response.statusText}`)
|
|
11
|
+
.then(body => {
|
|
12
|
+
document.querySelector('nav').innerHTML += body
|
|
13
|
+
// nav.js should be quicker to load than nav.inc.html, a fallback just in case
|
|
14
|
+
return init()
|
|
15
|
+
})
|
|
16
|
+
.then(done => {
|
|
17
|
+
if (done) return
|
|
18
|
+
let i = 0
|
|
19
|
+
;(function waitUntilNavJs () {
|
|
20
|
+
if (init()) return
|
|
21
|
+
if (i++ < 100) return setTimeout(waitUntilNavJs, 300)
|
|
22
|
+
console.error(Error('nav.js not loaded after 30s waiting for it'))
|
|
23
|
+
})()
|
|
24
|
+
})
|
|
25
|
+
.catch(error => console.error(error))
|
|
26
|
+
} else {
|
|
27
|
+
console.error(Error('Browser too old to display commonNav (remove commonNav docdash option)'))
|
|
28
|
+
}
|
package/docs/scripts/search.js
CHANGED
|
@@ -33,6 +33,9 @@ document.getElementById("nav-search").addEventListener("keyup", function(event)
|
|
|
33
33
|
document.querySelectorAll("nav > ul > li").forEach(function(elem) {
|
|
34
34
|
elem.style.display = "block";
|
|
35
35
|
});
|
|
36
|
+
document.querySelectorAll("nav > ul").forEach(function(elem) {
|
|
37
|
+
elem.style.display = "block";
|
|
38
|
+
});
|
|
36
39
|
//hide all results
|
|
37
40
|
document.querySelectorAll("nav > ul > li > ul li").forEach(function(elem) {
|
|
38
41
|
elem.style.display = "none";
|
|
@@ -79,5 +82,18 @@ document.getElementById("nav-search").addEventListener("keyup", function(event)
|
|
|
79
82
|
parent.style.display = "none";
|
|
80
83
|
}
|
|
81
84
|
});
|
|
85
|
+
document.querySelectorAll("nav > ul.collapse_top").forEach(function(parent) {
|
|
86
|
+
var countVisible = 0;
|
|
87
|
+
parent.querySelectorAll("li").forEach(function(elem) {
|
|
88
|
+
if (elem.style.display !== "none") {
|
|
89
|
+
countVisible++;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
if (countVisible == 0) {
|
|
94
|
+
//has no child at all and does not contain text
|
|
95
|
+
parent.style.display = "none";
|
|
96
|
+
}
|
|
97
|
+
});
|
|
82
98
|
}
|
|
83
99
|
});
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
|
|
15
15
|
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
|
|
16
16
|
<script src="scripts/nav.js" defer></script>
|
|
17
|
+
|
|
17
18
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
18
19
|
</head>
|
|
19
20
|
<body>
|
|
@@ -27,7 +28,9 @@
|
|
|
27
28
|
|
|
28
29
|
<nav >
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#.toLink#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#.toString#toString">toString</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#.fetchBTTVEmotes#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#.fetchFFZEmotes#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#.fetchSevenTVEmotes#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="Collection.html">Collection</a><ul class='methods'><li data-type='method'><a href="Collection.html#.filter#filter">filter</a></li><li data-type='method'><a href="Collection.html#.find#find">find</a></li><li data-type='method'><a href="Collection.html#.map#map">map</a></li></ul></li><li><a href="Emote.html">Emote</a><ul class='methods'><li data-type='method'><a href="Emote.html#.toString#toString">toString</a></li></ul></li><li><a href="EmoteFetcher.html">EmoteFetcher</a><ul class='methods'><li data-type='method'><a href="EmoteFetcher.html#._cacheBTTVEmote#_cacheBTTVEmote">_cacheBTTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#._cacheFFZEmote#_cacheFFZEmote">_cacheFFZEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#._cacheSevenTVEmote#_cacheSevenTVEmote">_cacheSevenTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#._cacheTwitchEmote#_cacheTwitchEmote">_cacheTwitchEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#._getRawBTTVEmotes#_getRawBTTVEmotes">_getRawBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#._getRawFFZEmotes#_getRawFFZEmotes">_getRawFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#._getRawSevenTVEmotes#_getRawSevenTVEmotes">_getRawSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#._getRawTwitchEmotes#_getRawTwitchEmotes">_getRawTwitchEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#.fetchBTTVEmotes#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#.fetchFFZEmotes#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#.fetchSevenTVEmotes#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#.fetchTwitchEmotes#fetchTwitchEmotes">fetchTwitchEmotes</a></li></ul></li><li><a href="EmoteParser.html">EmoteParser</a><ul class='methods'><li data-type='method'><a href="EmoteParser.html#.parse#parse">parse</a></li></ul></li><li><a href="FFZEmote.html">FFZEmote</a><ul class='methods'><li data-type='method'><a href="FFZEmote.html#.toLink#toLink">toLink</a></li><li data-type='method'><a href="FFZEmote.html#.toString#toString">toString</a></li></ul></li><li><a href="SevenTVEmote.html">SevenTVEmote</a><ul class='methods'><li data-type='method'><a href="SevenTVEmote.html#.toLink#toLink">toLink</a></li><li data-type='method'><a href="SevenTVEmote.html#.toString#toString">toString</a></li></ul></li><li><a href="TwitchEmote.html">TwitchEmote</a><ul class='methods'><li data-type='method'><a href="TwitchEmote.html#.toLink#toLink">toLink</a></li><li data-type='method'><a href="TwitchEmote.html#.toString#toString">toString</a></li></ul></li></ul>
|
|
33
|
+
|
|
31
34
|
</nav>
|
|
32
35
|
|
|
33
36
|
<div id="main">
|
|
@@ -110,7 +113,7 @@ module.exports = BTTVEmote;
|
|
|
110
113
|
<br class="clear">
|
|
111
114
|
|
|
112
115
|
<footer>
|
|
113
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc
|
|
116
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.0</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
114
117
|
</footer>
|
|
115
118
|
|
|
116
119
|
<script>prettyPrint();</script>
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
|
|
15
15
|
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
|
|
16
16
|
<script src="scripts/nav.js" defer></script>
|
|
17
|
+
|
|
17
18
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
18
19
|
</head>
|
|
19
20
|
<body>
|
|
@@ -27,7 +28,9 @@
|
|
|
27
28
|
|
|
28
29
|
<nav >
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#.toLink#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#.toString#toString">toString</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#.fetchBTTVEmotes#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#.fetchFFZEmotes#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#.fetchSevenTVEmotes#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="Collection.html">Collection</a><ul class='methods'><li data-type='method'><a href="Collection.html#.filter#filter">filter</a></li><li data-type='method'><a href="Collection.html#.find#find">find</a></li><li data-type='method'><a href="Collection.html#.map#map">map</a></li></ul></li><li><a href="Emote.html">Emote</a><ul class='methods'><li data-type='method'><a href="Emote.html#.toString#toString">toString</a></li></ul></li><li><a href="EmoteFetcher.html">EmoteFetcher</a><ul class='methods'><li data-type='method'><a href="EmoteFetcher.html#._cacheBTTVEmote#_cacheBTTVEmote">_cacheBTTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#._cacheFFZEmote#_cacheFFZEmote">_cacheFFZEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#._cacheSevenTVEmote#_cacheSevenTVEmote">_cacheSevenTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#._cacheTwitchEmote#_cacheTwitchEmote">_cacheTwitchEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#._getRawBTTVEmotes#_getRawBTTVEmotes">_getRawBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#._getRawFFZEmotes#_getRawFFZEmotes">_getRawFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#._getRawSevenTVEmotes#_getRawSevenTVEmotes">_getRawSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#._getRawTwitchEmotes#_getRawTwitchEmotes">_getRawTwitchEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#.fetchBTTVEmotes#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#.fetchFFZEmotes#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#.fetchSevenTVEmotes#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#.fetchTwitchEmotes#fetchTwitchEmotes">fetchTwitchEmotes</a></li></ul></li><li><a href="EmoteParser.html">EmoteParser</a><ul class='methods'><li data-type='method'><a href="EmoteParser.html#.parse#parse">parse</a></li></ul></li><li><a href="FFZEmote.html">FFZEmote</a><ul class='methods'><li data-type='method'><a href="FFZEmote.html#.toLink#toLink">toLink</a></li><li data-type='method'><a href="FFZEmote.html#.toString#toString">toString</a></li></ul></li><li><a href="SevenTVEmote.html">SevenTVEmote</a><ul class='methods'><li data-type='method'><a href="SevenTVEmote.html#.toLink#toLink">toLink</a></li><li data-type='method'><a href="SevenTVEmote.html#.toString#toString">toString</a></li></ul></li><li><a href="TwitchEmote.html">TwitchEmote</a><ul class='methods'><li data-type='method'><a href="TwitchEmote.html#.toLink#toLink">toLink</a></li><li data-type='method'><a href="TwitchEmote.html#.toString#toString">toString</a></li></ul></li></ul>
|
|
33
|
+
|
|
31
34
|
</nav>
|
|
32
35
|
|
|
33
36
|
<div id="main">
|
|
@@ -48,9 +51,9 @@ class Channel {
|
|
|
48
51
|
/**
|
|
49
52
|
* A Twitch channel.
|
|
50
53
|
* @param {EmoteFetcher} fetcher - The emote fetcher.
|
|
51
|
-
* @param {
|
|
54
|
+
* @param {int} id - ID of the channel.
|
|
52
55
|
*/
|
|
53
|
-
constructor(fetcher,
|
|
56
|
+
constructor(fetcher, id) {
|
|
54
57
|
/**
|
|
55
58
|
* The emote fetcher.
|
|
56
59
|
* @type {EmoteFetcher}
|
|
@@ -58,11 +61,11 @@ class Channel {
|
|
|
58
61
|
this.fetcher = fetcher;
|
|
59
62
|
|
|
60
63
|
/**
|
|
61
|
-
* The
|
|
62
|
-
* For the global channel, the
|
|
63
|
-
* @type {?
|
|
64
|
+
* The ID of this channel.
|
|
65
|
+
* For the global channel, the ID will be null.
|
|
66
|
+
* @type {?int}
|
|
64
67
|
*/
|
|
65
|
-
this.
|
|
68
|
+
this.channel_id = id;
|
|
66
69
|
|
|
67
70
|
/**
|
|
68
71
|
* Cached emotes belonging to this channel.
|
|
@@ -76,7 +79,7 @@ class Channel {
|
|
|
76
79
|
* @returns {Promise<Collection<string, BTTVEmote>>}
|
|
77
80
|
*/
|
|
78
81
|
fetchBTTVEmotes() {
|
|
79
|
-
return this.fetcher.fetchBTTVEmotes(this.
|
|
82
|
+
return this.fetcher.fetchBTTVEmotes(this.id);
|
|
80
83
|
}
|
|
81
84
|
|
|
82
85
|
/**
|
|
@@ -84,7 +87,15 @@ class Channel {
|
|
|
84
87
|
* @returns {Promise<Collection<string, FFZEmote>>}
|
|
85
88
|
*/
|
|
86
89
|
fetchFFZEmotes() {
|
|
87
|
-
return this.fetcher.fetchFFZEmotes(this.
|
|
90
|
+
return this.fetcher.fetchFFZEmotes(this.id);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Fetches the 7TV emotes for this channel.
|
|
95
|
+
* @returns {Promise<Collection<string, SevenTVEmote>>}
|
|
96
|
+
*/
|
|
97
|
+
fetchSevenTVEmotes() {
|
|
98
|
+
return this.fetcher.fetchSevenTVEmotes(this.id);
|
|
88
99
|
}
|
|
89
100
|
}
|
|
90
101
|
|
|
@@ -103,7 +114,7 @@ module.exports = Channel;
|
|
|
103
114
|
<br class="clear">
|
|
104
115
|
|
|
105
116
|
<footer>
|
|
106
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc
|
|
117
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.0</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
107
118
|
</footer>
|
|
108
119
|
|
|
109
120
|
<script>prettyPrint();</script>
|