w-html2docx 1.0.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/.editorconfig +9 -0
- package/.eslintignore +3 -0
- package/.eslintrc.js +55 -0
- package/.jsdoc +25 -0
- package/LICENSE +21 -0
- package/README.md +52 -0
- package/SECURITY.md +5 -0
- package/babel.config.js +16 -0
- package/dist/w-html2docx.umd.js +7 -0
- package/dist/w-html2docx.umd.js.map +1 -0
- package/docs/WHtml2docx.mjs.html +234 -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 +486 -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 +26 -0
- package/package.json +32 -0
- package/script.txt +17 -0
- package/scripts/install.mjs +30 -0
- package/src/WHtml2docx.mjs +162 -0
- package/src/downloadFiles.mjs +23 -0
- package/src/tmp.docx +0 -0
- package/srcPython/build.bat +9 -0
- package/srcPython/htmlToDocx.py +239 -0
- package/srcPython/htmlToDocx.spec +37 -0
- package/srcPython/run.bat +4 -0
- package/srcPython//350/252/252/346/230/216.txt +24 -0
- package/test/WHtml2docx.test.mjs +35 -0
- package/test/ztmp.html +319 -0
- package/test/ztmpTrue.docx +0 -0
- package/toolg/addVersion.mjs +4 -0
- package/toolg/cleanFolder.mjs +4 -0
- package/toolg/gDistRollup.mjs +28 -0
- package/toolg/modifyReadme.mjs +4 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/docs/global.html
ADDED
|
@@ -0,0 +1,486 @@
|
|
|
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#WHtml2docx">WHtml2docx</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="WHtml2docx"><span class="type-signature type-signature-async">(async) </span>WHtml2docx<span class="signature">(fpInHtml, fpOutDocx, 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>Html檔轉Docx檔</p></li></ul></dd>
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
<dt class="tag-source">Source:</dt>
|
|
148
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
149
|
+
<a href="WHtml2docx.mjs.html">WHtml2docx.mjs</a>, <a href="WHtml2docx.mjs.html#line54">line 54</a>
|
|
150
|
+
</li></ul></dd>
|
|
151
|
+
|
|
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
|
+
</dl>
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
<h5 class="h5-examples">Example</h5>
|
|
195
|
+
|
|
196
|
+
<pre class="prettyprint"><code>import w from 'wsemi'
|
|
197
|
let fpIn = `./test/ztmp.html`
|
|
1
198
|
let fpOut = `./test/ztmp.docx`
|
|
2
199
|
let opt = {}
|
|
3
200
|
let r = await WHtml2docx(fpIn, fpOut, opt)
|
|
4
201
|
console.log(r)
|
|
5
202
|
// => ok
|
|
6
203
|
w.fsDeleteFile(fpOut)
|
|
7
204
|
.catch((err) => {
|
|
8
205
|
console.log('catch', err)
|
|
9
206
|
})</code></pre>
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
<h5 class="h5-parameters">Parameters:</h5>
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
<table class="params">
|
|
215
|
+
<thead>
|
|
216
|
+
<tr>
|
|
217
|
+
|
|
218
|
+
<th>Name</th>
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
<th>Type</th>
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
<th>Attributes</th>
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
<th>Default</th>
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
<th class="last">Description</th>
|
|
232
|
+
</tr>
|
|
233
|
+
</thead>
|
|
234
|
+
|
|
235
|
+
<tbody>
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
<tr>
|
|
239
|
+
|
|
240
|
+
<td class="name"><code>fpInHtml</code></td>
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
<td class="type">
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
<span class="param-type">String</span>
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
</td>
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
<td class="attributes">
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
</td>
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
<td class="default">
|
|
265
|
+
|
|
266
|
+
</td>
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
<td class="description last"><p>輸入來源Html檔位置字串</p></td>
|
|
270
|
+
</tr>
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
<tr>
|
|
275
|
+
|
|
276
|
+
<td class="name"><code>fpOutDocx</code></td>
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
<td class="type">
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
<span class="param-type">String</span>
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
</td>
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
<td class="attributes">
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
</td>
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
<td class="default">
|
|
301
|
+
|
|
302
|
+
</td>
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
<td class="description last"><p>輸入轉出Docx檔位置字串</p></td>
|
|
306
|
+
</tr>
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
<tr>
|
|
311
|
+
|
|
312
|
+
<td class="name"><code>opt</code></td>
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
<td class="type">
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
<span class="param-type">Object</span>
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
</td>
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
<td class="attributes">
|
|
327
|
+
|
|
328
|
+
<optional><br>
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
</td>
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
<td class="default">
|
|
339
|
+
|
|
340
|
+
<code>{}</code>
|
|
341
|
+
|
|
342
|
+
</td>
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
<td class="description last"><p>輸入設定物件,預設{}</p>
|
|
346
|
+
<h6>Properties</h6>
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
<table class="params">
|
|
350
|
+
<thead>
|
|
351
|
+
<tr>
|
|
352
|
+
|
|
353
|
+
<th>Name</th>
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
<th>Type</th>
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
<th>Attributes</th>
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
<th>Default</th>
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
<th class="last">Description</th>
|
|
367
|
+
</tr>
|
|
368
|
+
</thead>
|
|
369
|
+
|
|
370
|
+
<tbody>
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
<tr>
|
|
374
|
+
|
|
375
|
+
<td class="name"><code>fontFamilies</code></td>
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
<td class="type">
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
<span class="param-type">Array</span>
|
|
382
|
+
|
|
|
383
|
+
|
|
384
|
+
<span class="param-type">String</span>
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
</td>
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
<td class="attributes">
|
|
393
|
+
|
|
394
|
+
<optional><br>
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
</td>
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
<td class="default">
|
|
405
|
+
|
|
406
|
+
<code>['標楷體', 'Times New Roman']</code>
|
|
407
|
+
|
|
408
|
+
</td>
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
<td class="description last"><p>輸入Docx更改字型陣列或字串,預設['標楷體', 'Times New Roman']</p></td>
|
|
412
|
+
</tr>
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
</tbody>
|
|
416
|
+
</table>
|
|
417
|
+
|
|
418
|
+
</td>
|
|
419
|
+
</tr>
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
</tbody>
|
|
423
|
+
</table>
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
<h5 class="h5-returns">Returns:</h5>
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
<div class="param-desc">
|
|
444
|
+
<p>回傳Promise,resolve回傳成功訊息,reject回傳錯誤訊息</p>
|
|
445
|
+
</div>
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
<dl class="param-type">
|
|
450
|
+
<dt>
|
|
451
|
+
Type
|
|
452
|
+
</dt>
|
|
453
|
+
<dd>
|
|
454
|
+
|
|
455
|
+
<span class="param-type">Promise</span>
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
</dd>
|
|
460
|
+
</dl>
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
</article>
|
|
473
|
+
|
|
474
|
+
</section>
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
</div>
|
|
482
|
+
|
|
483
|
+
<br class="clear">
|
|
484
|
+
|
|
485
|
+
<footer>
|
|
486
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Nov 16 2025 18:28:18 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
487
|
+
</footer>
|
|
488
|
+
|
|
489
|
+
<script>prettyPrint();</script>
|
|
490
|
+
<script src="scripts/polyfill.js"></script>
|
|
491
|
+
<script src="scripts/linenumber.js"></script>
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
</body>
|
|
496
|
+
</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#WHtml2docx">WHtml2docx</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.5</a> on Sun Nov 16 2025 18:28:18 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();
|