w-dwload-dlp 1.0.1
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/.editorconfig +9 -0
- package/.eslintignore +3 -0
- package/.eslintrc.js +55 -0
- package/.jsdoc +25 -0
- package/LICENSE +21 -0
- package/README.md +63 -0
- package/SECURITY.md +5 -0
- package/babel.config.js +15 -0
- package/dist/w-dwload-dlp.umd.js +7 -0
- package/dist/w-dwload-dlp.umd.js.map +1 -0
- package/docs/WDwloadDlp.mjs.html +417 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/docs/global.html +484 -0
- package/docs/index.html +84 -0
- package/docs/scripts/collapse.js +39 -0
- package/docs/scripts/commonNav.js +28 -0
- package/docs/scripts/linenumber.js +25 -0
- package/docs/scripts/nav.js +12 -0
- package/docs/scripts/polyfill.js +4 -0
- package/docs/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/docs/scripts/prettify/lang-css.js +2 -0
- package/docs/scripts/prettify/prettify.js +28 -0
- package/docs/scripts/search.js +99 -0
- package/docs/styles/jsdoc.css +776 -0
- package/docs/styles/prettify.css +80 -0
- package/g.mjs +38 -0
- package/package.json +32 -0
- package/script.txt +18 -0
- package/src/WDwloadDlp.mjs +345 -0
- package/test/all.test.mjs +16 -0
- package/toolg/addVersion.mjs +4 -0
- package/toolg/cleanFolder.mjs +4 -0
- package/toolg/gDistRollup.mjs +30 -0
- package/toolg/modifyReadme.mjs +4 -0
- package/yt-dlp-2024.04.09/ffmpeg.exe +0 -0
- package/yt-dlp-2024.04.09/yt-dlp.exe +0 -0
- package/yt-dlp.md +15 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/docs/global.html
ADDED
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<title>Global - 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>Global</h3><ul><li><a href="global.html#WDwloadDlp">WDwloadDlp</a></li></ul>
|
|
33
|
+
|
|
34
|
+
</nav>
|
|
35
|
+
|
|
36
|
+
<div id="main">
|
|
37
|
+
|
|
38
|
+
<h1 class="page-title">Global</h1>
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<section>
|
|
47
|
+
|
|
48
|
+
<header>
|
|
49
|
+
|
|
50
|
+
<h2>
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
</h2>
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
</header>
|
|
58
|
+
|
|
59
|
+
<article>
|
|
60
|
+
|
|
61
|
+
<div class="container-overview">
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
<dl class="details">
|
|
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
|
+
</dl>
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
<h3 class="subsection-title">Methods</h3>
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
<h4 class="name" id="WDwloadDlp"><span class="type-signature type-signature-async">(async) </span>WDwloadDlp<span class="signature">(url, fp, opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise}</span></h4>
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
<dl class="details">
|
|
141
|
+
|
|
142
|
+
<dt class="tag-description">Description:</dt>
|
|
143
|
+
<dd class="tag-description"><ul class="dummy"><li><p>下載video檔案,預設轉mp4,核心調用yt-dlp,只能用於Windows作業系統</p>
|
|
144
|
+
<p>yt-dlp: https://github.com/yt-dlp/yt-dlp</p></li></ul></dd>
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
<dt class="tag-source">Source:</dt>
|
|
149
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
150
|
+
<a href="WDwloadDlp.mjs.html">WDwloadDlp.mjs</a>, <a href="WDwloadDlp.mjs.html#line75">line 75</a>
|
|
151
|
+
</li></ul></dd>
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
</dl>
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
<h5 class="h5-examples">Example</h5>
|
|
196
|
+
|
|
197
|
+
<pre class="prettyprint"><code>// import WDwloadDlp from 'w-dwload-dlp'
|
|
198
|
//url
|
|
1
199
|
let url = `https://www.youtube.com/watch?v=uj8hjLyEBmU&ab_channel=%E7%A0%81%E5%86%9C%E9%AB%98%E5%A4%A9` //youtube
|
|
2
200
|
// let url = `https://www.bilibili.com/video/BV1JZ421x7q8/?spm_id_from=333.1073.channel.secondary_floor_video.click` //bilibili
|
|
3
201
|
//fp
|
|
4
202
|
let fp = './test.mp4'
|
|
5
203
|
//funProg
|
|
6
204
|
let funProg = (prog, nn, na) => {
|
|
7
205
|
console.log('prog', `${prog.toFixed(2)}%`, nn, na)
|
|
8
206
|
}
|
|
9
207
|
//WDwloadDlp
|
|
10
208
|
await WDwloadDlp(url, fp, {
|
|
11
209
|
clean: true, //單一程序執行時, 事先清除之前暫存檔, 減少浪費硬碟空間
|
|
12
210
|
funProg,
|
|
13
211
|
})
|
|
14
212
|
console.log('done:', fp)
|
|
15
213
|
.catch((err) => {
|
|
16
214
|
console.log('catch', err)
|
|
17
215
|
})
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
<h5 class="h5-parameters">Parameters:</h5>
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
<table class="params">
|
|
224
|
+
<thead>
|
|
225
|
+
<tr>
|
|
226
|
+
|
|
227
|
+
<th>Name</th>
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
<th>Type</th>
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
<th>Attributes</th>
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
<th>Default</th>
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
<th class="last">Description</th>
|
|
241
|
+
</tr>
|
|
242
|
+
</thead>
|
|
243
|
+
|
|
244
|
+
<tbody>
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
<tr>
|
|
248
|
+
|
|
249
|
+
<td class="name"><code>url</code></td>
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
<td class="type">
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
<span class="param-type">String</span>
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
</td>
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
<td class="attributes">
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
</td>
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
<td class="default">
|
|
274
|
+
|
|
275
|
+
</td>
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
<td class="description last"><p>輸入網址字串,支援網站種類詳見yt-dlp</p></td>
|
|
279
|
+
</tr>
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
<tr>
|
|
284
|
+
|
|
285
|
+
<td class="name"><code>fp</code></td>
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
<td class="type">
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
<span class="param-type">String</span>
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
</td>
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
<td class="attributes">
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
</td>
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
<td class="default">
|
|
310
|
+
|
|
311
|
+
</td>
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
<td class="description last"><p>輸入儲存video(*.mp4)檔案路徑字串</p></td>
|
|
315
|
+
</tr>
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
<tr>
|
|
320
|
+
|
|
321
|
+
<td class="name"><code>opt</code></td>
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
<td class="type">
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
<span class="param-type">Object</span>
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
</td>
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
<td class="attributes">
|
|
336
|
+
|
|
337
|
+
<optional><br>
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
</td>
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
<td class="default">
|
|
348
|
+
|
|
349
|
+
<code>{}</code>
|
|
350
|
+
|
|
351
|
+
</td>
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
<td class="description last"><p>輸入設定物件,預設{}</p>
|
|
355
|
+
<h6>Properties</h6>
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
<table class="params">
|
|
359
|
+
<thead>
|
|
360
|
+
<tr>
|
|
361
|
+
|
|
362
|
+
<th>Name</th>
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
<th>Type</th>
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
<th>Attributes</th>
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
<th>Default</th>
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
<th class="last">Description</th>
|
|
376
|
+
</tr>
|
|
377
|
+
</thead>
|
|
378
|
+
|
|
379
|
+
<tbody>
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
<tr>
|
|
383
|
+
|
|
384
|
+
<td class="name"><code>funProg</code></td>
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
<td class="type">
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
<span class="param-type">function</span>
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
</td>
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
<td class="attributes">
|
|
399
|
+
|
|
400
|
+
<optional><br>
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
</td>
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
<td class="default">
|
|
411
|
+
|
|
412
|
+
<code>null</code>
|
|
413
|
+
|
|
414
|
+
</td>
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
<td class="description last"><p>輸入回傳進度函數,傳入參數為prog代表進度百分比、nn代表當前已下載ts檔案數量、na代表全部須下載ts檔案數量,預設null</p></td>
|
|
418
|
+
</tr>
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
</tbody>
|
|
422
|
+
</table>
|
|
423
|
+
|
|
424
|
+
</td>
|
|
425
|
+
</tr>
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
</tbody>
|
|
429
|
+
</table>
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
<h5 class="h5-returns">Returns:</h5>
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
<div class="param-desc">
|
|
450
|
+
<p>回傳Promise,resolve回傳成功訊息,reject回傳錯誤訊息</p>
|
|
451
|
+
</div>
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
<dl class="param-type">
|
|
456
|
+
<dt>
|
|
457
|
+
Type
|
|
458
|
+
</dt>
|
|
459
|
+
<dd>
|
|
460
|
+
|
|
461
|
+
<span class="param-type">Promise</span>
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
</dd>
|
|
466
|
+
</dl>
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
</article>
|
|
479
|
+
|
|
480
|
+
</section>
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
</div>
|
|
488
|
+
|
|
489
|
+
<br class="clear">
|
|
490
|
+
|
|
491
|
+
<footer>
|
|
492
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue May 21 2024 21:53:47 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
493
|
+
</footer>
|
|
494
|
+
|
|
495
|
+
<script>prettyPrint();</script>
|
|
496
|
+
<script src="scripts/polyfill.js"></script>
|
|
497
|
+
<script src="scripts/linenumber.js"></script>
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
</body>
|
|
502
|
+
</html>
|
package/docs/index.html
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
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>Global</h3><ul><li><a href="global.html#WDwloadDlp">WDwloadDlp</a></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> </h3>
|
|
48
|
+
</section>
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<br class="clear">
|
|
72
|
+
|
|
73
|
+
<footer>
|
|
74
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue May 21 2024 21:53:47 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
75
|
+
</footer>
|
|
76
|
+
|
|
77
|
+
<script>prettyPrint();</script>
|
|
78
|
+
<script src="scripts/polyfill.js"></script>
|
|
79
|
+
<script src="scripts/linenumber.js"></script>
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
</body>
|
|
84
|
+
</html>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
function hideAllButCurrent(){
|
|
2
|
+
//by default all submenut items are hidden
|
|
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
|
+
});
|
|
9
|
+
document.querySelectorAll("nav > ul > li > ul li").forEach(function(parent) {
|
|
10
|
+
parent.style.display = "none";
|
|
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
|
+
});
|
|
23
|
+
|
|
24
|
+
//only current page (if it exists) should be opened
|
|
25
|
+
var file = window.location.pathname.split("/").pop().replace(/\.html/, '');
|
|
26
|
+
document.querySelectorAll("nav > ul > li > a").forEach(function(parent) {
|
|
27
|
+
var href = parent.attributes.href.value.replace(/\.html/, '');
|
|
28
|
+
if (file === href) {
|
|
29
|
+
if (parent.parentNode.parentNode.className.indexOf("collapse_top") !== -1) {
|
|
30
|
+
parent.parentNode.parentNode.style.display = "block";
|
|
31
|
+
}
|
|
32
|
+
parent.parentNode.querySelectorAll("ul li").forEach(function(elem) {
|
|
33
|
+
elem.style.display = "block";
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
hideAllButCurrent();
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*global document */
|
|
2
|
+
(function() {
|
|
3
|
+
var source = document.getElementsByClassName('prettyprint source linenums');
|
|
4
|
+
var i = 0;
|
|
5
|
+
var lineNumber = 0;
|
|
6
|
+
var lineId;
|
|
7
|
+
var lines;
|
|
8
|
+
var totalLines;
|
|
9
|
+
var anchorHash;
|
|
10
|
+
|
|
11
|
+
if (source && source[0]) {
|
|
12
|
+
anchorHash = document.location.hash.substring(1);
|
|
13
|
+
lines = source[0].getElementsByTagName('li');
|
|
14
|
+
totalLines = lines.length;
|
|
15
|
+
|
|
16
|
+
for (; i < totalLines; i++) {
|
|
17
|
+
lineNumber++;
|
|
18
|
+
lineId = 'line' + lineNumber;
|
|
19
|
+
lines[i].id = lineId;
|
|
20
|
+
if (lineId === anchorHash) {
|
|
21
|
+
lines[i].className += ' selected';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
})();
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function scrollToNavItem() {
|
|
2
|
+
var path = window.location.href.split('/').pop().replace(/\.html/, '');
|
|
3
|
+
document.querySelectorAll('nav a').forEach(function(link) {
|
|
4
|
+
var href = link.attributes.href.value.replace(/\.html/, '');
|
|
5
|
+
if (path === href) {
|
|
6
|
+
link.scrollIntoView({block: 'center'});
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
})
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
scrollToNavItem();
|