ilib-localematcher 1.2.2 → 1.3.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/README.md CHANGED
@@ -65,6 +65,10 @@ limitations under the License.
65
65
 
66
66
  ## Release Notes
67
67
 
68
+ ### v1.3.0
69
+
70
+ * Update to CLDR v44.0.0
71
+
68
72
  ### v1.2.2
69
73
 
70
74
  * This module is now a hybrid ESM/CommonJS package that works under node
@@ -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
 
31
+
30
32
  <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="LocaleMatcher.html">LocaleMatcher</a><ul class='methods'><li data-type='method'><a href="LocaleMatcher.html#getLikelyLocale">getLikelyLocale</a></li><li data-type='method'><a href="LocaleMatcher.html#getLikelyLocaleMinimal">getLikelyLocaleMinimal</a></li><li data-type='method'><a href="LocaleMatcher.html#getLocale">getLocale</a></li><li data-type='method'><a href="LocaleMatcher.html#getMacroLanguage">getMacroLanguage</a></li><li data-type='method'><a href="LocaleMatcher.html#getRegionContainment">getRegionContainment</a></li><li data-type='method'><a href="LocaleMatcher.html#match">match</a></li><li data-type='method'><a href="LocaleMatcher.html#smallestCommonRegion">smallestCommonRegion</a></li></ul></li></ul>
33
+
31
34
  </nav>
32
35
 
33
36
  <div id="main">
@@ -45,7 +48,9 @@
45
48
  <header>
46
49
 
47
50
  <h2>
48
- LocaleMatcher
51
+
52
+ LocaleMatcher
53
+
49
54
  </h2>
50
55
 
51
56
  <div class="class-description usertext">Represent a locale matcher instance, which is used
@@ -73,6 +78,18 @@ various ways.</div>
73
78
 
74
79
 
75
80
  <dl class="details">
81
+
82
+ <dt class="tag-description">Description:</dt>
83
+ <dd class="tag-description"><ul class="dummy"><li>Create a new locale matcher instance. This is used
84
+ to see which locales can be matched with each other in
85
+ various ways.<p>
86
+
87
+ The options object may contain any of the following properties:
88
+
89
+ <ul>
90
+ <li><i>locale</i> - the locale instance or locale spec to match
91
+ </ul></li></ul></dd>
92
+
76
93
 
77
94
 
78
95
  <dt class="tag-source">Source:</dt>
@@ -116,19 +133,6 @@ various ways.</div>
116
133
 
117
134
 
118
135
 
119
- <div class="description usertext">
120
- Create a new locale matcher instance. This is used
121
- to see which locales can be matched with each other in
122
- various ways.<p>
123
-
124
- The options object may contain any of the following properties:
125
-
126
- <ul>
127
- <li><i>locale</i> - the locale instance or locale spec to match
128
- </ul>
129
- </div>
130
-
131
-
132
136
 
133
137
 
134
138
 
@@ -137,8 +141,7 @@ The options object may contain any of the following properties:
137
141
 
138
142
 
139
143
 
140
-
141
- <h5>Parameters:</h5>
144
+ <h5 class="h5-parameters">Parameters:</h5>
142
145
 
143
146
 
144
147
  <table class="params">
@@ -172,6 +175,7 @@ The options object may contain any of the following properties:
172
175
  <span class="param-type">Object</span>
173
176
 
174
177
 
178
+
175
179
 
176
180
  </td>
177
181
 
@@ -238,6 +242,18 @@ The options object may contain any of the following properties:
238
242
 
239
243
 
240
244
  <dl class="details">
245
+
246
+ <dt class="tag-description">Description:</dt>
247
+ <dd class="tag-description"><ul class="dummy"><li>Return an Locale instance that is fully specified based on partial information
248
+ given to the constructor of this locale matcher instance. For example, if the locale
249
+ spec given to this locale matcher instance is simply "ru" (for the Russian language),
250
+ then it will fill in the missing region and script tags and return a locale with
251
+ the specifier "ru-Cyrl-RU". (ie. Russian language, Cyrillic, Russian Federation).
252
+ Any one or two of the language, script, or region parts may be left unspecified,
253
+ and the other one or two parts will be filled in automatically. If this
254
+ class has no information about the given locale, then the locale of this
255
+ locale matcher instance is returned unchanged.</li></ul></dd>
256
+
241
257
 
242
258
 
243
259
  <dt class="tag-source">Source:</dt>
@@ -281,20 +297,6 @@ The options object may contain any of the following properties:
281
297
 
282
298
 
283
299
 
284
- <div class="description usertext">
285
- Return an Locale instance that is fully specified based on partial information
286
- given to the constructor of this locale matcher instance. For example, if the locale
287
- spec given to this locale matcher instance is simply "ru" (for the Russian language),
288
- then it will fill in the missing region and script tags and return a locale with
289
- the specifier "ru-Cyrl-RU". (ie. Russian language, Cyrillic, Russian Federation).
290
- Any one or two of the language, script, or region parts may be left unspecified,
291
- and the other one or two parts will be filled in automatically. If this
292
- class has no information about the given locale, then the locale of this
293
- locale matcher instance is returned unchanged.
294
- </div>
295
-
296
-
297
-
298
300
 
299
301
 
300
302
 
@@ -317,7 +319,7 @@ locale matcher instance is returned unchanged.
317
319
 
318
320
 
319
321
 
320
- <h5>Returns:</h5>
322
+ <h5 class="h5-returns">Returns:</h5>
321
323
 
322
324
 
323
325
  <div class="param-desc">
@@ -336,6 +338,7 @@ to the constructor of this locale matcher instance
336
338
  <span class="param-type">Locale</span>
337
339
 
338
340
 
341
+
339
342
  </dd>
340
343
  </dl>
341
344
 
@@ -356,6 +359,27 @@ to the constructor of this locale matcher instance
356
359
 
357
360
 
358
361
  <dl class="details">
362
+
363
+ <dt class="tag-description">Description:</dt>
364
+ <dd class="tag-description"><ul class="dummy"><li>Return an Locale instance that is specified based on partial information
365
+ given to the constructor of this locale matcher instance but which leaves out any
366
+ part of the locale specifier that is so common that it is understood. For example,
367
+ if the locale
368
+ spec given to this locale matcher instance is simply "ru" (for the Russian language),
369
+ then it will fill in the missing region and/or script tags and return a locale with
370
+ the specifier "ru-RU". (ie. Russian language, Russian Federation). Note that the
371
+ default script "Cyrl" is left out because the vast majority of text written in
372
+ Russian is written with the Cyrllic script, so that part of the locale is understood
373
+ and is commonly left out.<p>
374
+
375
+ Any one or two of the language, script, or region parts may be left unspecified,
376
+ and the other one or two parts will be filled in automatically. If this
377
+ class has no information about the given locale, then the locale of this
378
+ locale matcher instance is returned unchanged.<p>
379
+
380
+ This method returns the same information as getLikelyLocale but with the very common
381
+ parts left out.</li></ul></dd>
382
+
359
383
 
360
384
 
361
385
  <dt class="tag-source">Source:</dt>
@@ -399,29 +423,6 @@ to the constructor of this locale matcher instance
399
423
 
400
424
 
401
425
 
402
- <div class="description usertext">
403
- Return an Locale instance that is specified based on partial information
404
- given to the constructor of this locale matcher instance but which leaves out any
405
- part of the locale specifier that is so common that it is understood. For example,
406
- if the locale
407
- spec given to this locale matcher instance is simply "ru" (for the Russian language),
408
- then it will fill in the missing region and/or script tags and return a locale with
409
- the specifier "ru-RU". (ie. Russian language, Russian Federation). Note that the
410
- default script "Cyrl" is left out because the vast majority of text written in
411
- Russian is written with the Cyrllic script, so that part of the locale is understood
412
- and is commonly left out.<p>
413
-
414
- Any one or two of the language, script, or region parts may be left unspecified,
415
- and the other one or two parts will be filled in automatically. If this
416
- class has no information about the given locale, then the locale of this
417
- locale matcher instance is returned unchanged.<p>
418
-
419
- This method returns the same information as getLikelyLocale but with the very common
420
- parts left out.
421
- </div>
422
-
423
-
424
-
425
426
 
426
427
 
427
428
 
@@ -444,7 +445,7 @@ parts left out.
444
445
 
445
446
 
446
447
 
447
- <h5>Returns:</h5>
448
+ <h5 class="h5-returns">Returns:</h5>
448
449
 
449
450
 
450
451
  <div class="param-desc">
@@ -464,6 +465,7 @@ parts are left out.
464
465
  <span class="param-type">Locale</span>
465
466
 
466
467
 
468
+
467
469
  </dd>
468
470
  </dl>
469
471
 
@@ -484,6 +486,10 @@ parts are left out.
484
486
 
485
487
 
486
488
  <dl class="details">
489
+
490
+ <dt class="tag-description">Description:</dt>
491
+ <dd class="tag-description"><ul class="dummy"><li>Return the locale used to construct this instance.</li></ul></dd>
492
+
487
493
 
488
494
 
489
495
  <dt class="tag-source">Source:</dt>
@@ -527,12 +533,6 @@ parts are left out.
527
533
 
528
534
 
529
535
 
530
- <div class="description usertext">
531
- Return the locale used to construct this instance.
532
- </div>
533
-
534
-
535
-
536
536
 
537
537
 
538
538
 
@@ -555,7 +555,7 @@ parts are left out.
555
555
 
556
556
 
557
557
 
558
- <h5>Returns:</h5>
558
+ <h5 class="h5-returns">Returns:</h5>
559
559
 
560
560
 
561
561
  <div class="param-desc">
@@ -576,6 +576,7 @@ parts are left out.
576
576
  <span class="param-type">undefined</span>
577
577
 
578
578
 
579
+
579
580
  </dd>
580
581
  </dl>
581
582
 
@@ -596,6 +597,12 @@ parts are left out.
596
597
 
597
598
 
598
599
  <dl class="details">
600
+
601
+ <dt class="tag-description">Description:</dt>
602
+ <dd class="tag-description"><ul class="dummy"><li>Return the macrolanguage associated with this locale. If the
603
+ locale's language is not part of a macro-language, then the
604
+ locale's language is returned as-is.</li></ul></dd>
605
+
599
606
 
600
607
 
601
608
  <dt class="tag-source">Source:</dt>
@@ -639,14 +646,6 @@ parts are left out.
639
646
 
640
647
 
641
648
 
642
- <div class="description usertext">
643
- Return the macrolanguage associated with this locale. If the
644
- locale's language is not part of a macro-language, then the
645
- locale's language is returned as-is.
646
- </div>
647
-
648
-
649
-
650
649
 
651
650
 
652
651
 
@@ -669,7 +668,7 @@ locale's language is returned as-is.
669
668
 
670
669
 
671
670
 
672
- <h5>Returns:</h5>
671
+ <h5 class="h5-returns">Returns:</h5>
673
672
 
674
673
 
675
674
  <div class="param-desc">
@@ -688,6 +687,7 @@ with this locale, or language of the locale
688
687
  <span class="param-type">string</span>
689
688
 
690
689
 
690
+
691
691
  </dd>
692
692
  </dl>
693
693
 
@@ -708,6 +708,17 @@ with this locale, or language of the locale
708
708
 
709
709
 
710
710
  <dl class="details">
711
+
712
+ <dt class="tag-description">Description:</dt>
713
+ <dd class="tag-description"><ul class="dummy"><li>Return the list of regions that this locale is contained within. Regions are
714
+ nested, so locales can be in multiple regions. (eg. US is in Northern North
715
+ America, North America, the Americas, the World.) Most regions are specified
716
+ using UN.49 region numbers, though some, like "EU", are letters. If the
717
+ locale is underspecified, this method will use the most likely locale method
718
+ to get the region first. For example, the locale "ja" (Japanese) is most
719
+ likely "ja-JP" (Japanese for Japan), and the region containment info for Japan
720
+ is returned.</li></ul></dd>
721
+
711
722
 
712
723
 
713
724
  <dt class="tag-source">Source:</dt>
@@ -751,17 +762,6 @@ with this locale, or language of the locale
751
762
 
752
763
 
753
764
 
754
- <div class="description usertext">
755
- Return the list of regions that this locale is contained within. Regions are
756
- nested, so locales can be in multiple regions. (eg. US is in Northern North
757
- America, North America, the Americas, the World.) Most regions are specified
758
- using UN.49 region numbers, though some, like "EU", are letters. If the
759
- locale is underspecified, this method will use the most likely locale method
760
- to get the region first. For example, the locale "ja" (Japanese) is most
761
- likely "ja-JP" (Japanese for Japan), and the region containment info for Japan
762
- is returned.
763
- </div>
764
-
765
765
 
766
766
 
767
767
 
@@ -784,9 +784,7 @@ is returned.
784
784
 
785
785
 
786
786
 
787
-
788
-
789
- <h5>Returns:</h5>
787
+ <h5 class="h5-returns">Returns:</h5>
790
788
 
791
789
 
792
790
  <div class="param-desc">
@@ -804,6 +802,7 @@ is returned.
804
802
  <span class="param-type">Array.&lt;string></span>
805
803
 
806
804
 
805
+
807
806
  </dd>
808
807
  </dl>
809
808
 
@@ -824,51 +823,9 @@ is returned.
824
823
 
825
824
 
826
825
  <dl class="details">
827
-
828
-
829
- <dt class="tag-source">Source:</dt>
830
- <dd class="tag-source"><ul class="dummy"><li>
831
- <a href="LocaleMatcher.js.html">LocaleMatcher.js</a>, <a href="LocaleMatcher.js.html#line242">line 242</a>
832
- </li></ul></dd>
833
-
834
-
835
-
836
-
837
-
838
-
839
-
840
-
841
-
842
-
843
-
844
-
845
826
 
846
-
847
-
848
-
849
-
850
-
851
-
852
-
853
-
854
-
855
-
856
-
857
-
858
-
859
-
860
-
861
-
862
-
863
-
864
- </dl>
865
-
866
-
867
-
868
-
869
-
870
- <div class="description usertext">
871
- Return the degree that the given locale matches the current locale of this
827
+ <dt class="tag-description">Description:</dt>
828
+ <dd class="tag-description"><ul class="dummy"><li>Return the degree that the given locale matches the current locale of this
872
829
  matcher. This method returns an integer from 0 to 100. A value of 100 is
873
830
  a 100% match, meaning that the two locales are exactly equivalent to each
874
831
  other. (eg. "ja-JP" and "ja-JP") A value of 0 means that there 0% match or
@@ -935,8 +892,47 @@ component. It is not a 100% match, but it is pretty good. The web site
935
892
  may decide if the match scores all fall
936
893
  below a chosen threshold (perhaps 50%?), it should show the user the
937
894
  default language "en-GB", because that is probably a better choice
938
- than any other supported locale.<p>
939
- </div>
895
+ than any other supported locale.<p></li></ul></dd>
896
+
897
+
898
+
899
+ <dt class="tag-source">Source:</dt>
900
+ <dd class="tag-source"><ul class="dummy"><li>
901
+ <a href="LocaleMatcher.js.html">LocaleMatcher.js</a>, <a href="LocaleMatcher.js.html#line242">line 242</a>
902
+ </li></ul></dd>
903
+
904
+
905
+
906
+
907
+
908
+
909
+
910
+
911
+
912
+
913
+
914
+
915
+
916
+
917
+
918
+
919
+
920
+
921
+
922
+
923
+
924
+
925
+
926
+
927
+
928
+
929
+
930
+
931
+
932
+
933
+
934
+ </dl>
935
+
940
936
 
941
937
 
942
938
 
@@ -948,7 +944,8 @@ than any other supported locale.<p>
948
944
 
949
945
 
950
946
 
951
- <h5>Parameters:</h5>
947
+
948
+ <h5 class="h5-parameters">Parameters:</h5>
952
949
 
953
950
 
954
951
  <table class="params">
@@ -982,6 +979,7 @@ than any other supported locale.<p>
982
979
  <span class="param-type">Locale</span>
983
980
 
984
981
 
982
+
985
983
 
986
984
  </td>
987
985
 
@@ -1011,7 +1009,7 @@ than any other supported locale.<p>
1011
1009
 
1012
1010
 
1013
1011
 
1014
- <h5>Returns:</h5>
1012
+ <h5 class="h5-returns">Returns:</h5>
1015
1013
 
1016
1014
 
1017
1015
  <div class="param-desc">
@@ -1030,6 +1028,7 @@ which these locales match each other
1030
1028
  <span class="param-type">number</span>
1031
1029
 
1032
1030
 
1031
+
1033
1032
  </dd>
1034
1033
  </dl>
1035
1034
 
@@ -1050,6 +1049,15 @@ which these locales match each other
1050
1049
 
1051
1050
 
1052
1051
  <dl class="details">
1052
+
1053
+ <dt class="tag-description">Description:</dt>
1054
+ <dd class="tag-description"><ul class="dummy"><li>Find the smallest region that contains both the current locale and the other locale.
1055
+ If the current or other locales are underspecified, this method will use the most
1056
+ likely locale method
1057
+ to get their regions first. For example, the locale "ja" (Japanese) is most
1058
+ likely "ja-JP" (Japanese for Japan), and the region containment info for Japan
1059
+ is checked against the other locale's region containment info.</li></ul></dd>
1060
+
1053
1061
 
1054
1062
 
1055
1063
  <dt class="tag-source">Source:</dt>
@@ -1093,17 +1101,6 @@ which these locales match each other
1093
1101
 
1094
1102
 
1095
1103
 
1096
- <div class="description usertext">
1097
- Find the smallest region that contains both the current locale and the other locale.
1098
- If the current or other locales are underspecified, this method will use the most
1099
- likely locale method
1100
- to get their regions first. For example, the locale "ja" (Japanese) is most
1101
- likely "ja-JP" (Japanese for Japan), and the region containment info for Japan
1102
- is checked against the other locale's region containment info.
1103
- </div>
1104
-
1105
-
1106
-
1107
1104
 
1108
1105
 
1109
1106
 
@@ -1112,7 +1109,7 @@ is checked against the other locale's region containment info.
1112
1109
 
1113
1110
 
1114
1111
 
1115
- <h5>Parameters:</h5>
1112
+ <h5 class="h5-parameters">Parameters:</h5>
1116
1113
 
1117
1114
 
1118
1115
  <table class="params">
@@ -1149,6 +1146,7 @@ is checked against the other locale's region containment info.
1149
1146
  <span class="param-type">Locale</span>
1150
1147
 
1151
1148
 
1149
+
1152
1150
 
1153
1151
  </td>
1154
1152
 
@@ -1179,7 +1177,7 @@ compare against</td>
1179
1177
 
1180
1178
 
1181
1179
 
1182
- <h5>Returns:</h5>
1180
+ <h5 class="h5-returns">Returns:</h5>
1183
1181
 
1184
1182
 
1185
1183
  <div class="param-desc">
@@ -1198,6 +1196,7 @@ current locale and other locale
1198
1196
  <span class="param-type">string</span>
1199
1197
 
1200
1198
 
1199
+
1201
1200
  </dd>
1202
1201
  </dl>
1203
1202
 
@@ -1225,7 +1224,7 @@ current locale and other locale
1225
1224
  <br class="clear">
1226
1225
 
1227
1226
  <footer>
1228
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> on Tue Aug 30 2022 08:15:14 GMT-0700 (Pacific Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1227
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Tue Nov 21 2023 19:43:43 GMT-0800 (Pacific Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1229
1228
  </footer>
1230
1229
 
1231
1230
  <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
 
31
+
30
32
  <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="LocaleMatcher.html">LocaleMatcher</a><ul class='methods'><li data-type='method'><a href="LocaleMatcher.html#getLikelyLocale">getLikelyLocale</a></li><li data-type='method'><a href="LocaleMatcher.html#getLikelyLocaleMinimal">getLikelyLocaleMinimal</a></li><li data-type='method'><a href="LocaleMatcher.html#getLocale">getLocale</a></li><li data-type='method'><a href="LocaleMatcher.html#getMacroLanguage">getMacroLanguage</a></li><li data-type='method'><a href="LocaleMatcher.html#getRegionContainment">getRegionContainment</a></li><li data-type='method'><a href="LocaleMatcher.html#match">match</a></li><li data-type='method'><a href="LocaleMatcher.html#smallestCommonRegion">smallestCommonRegion</a></li></ul></li></ul>
33
+
31
34
  </nav>
32
35
 
33
36
  <div id="main">
@@ -451,7 +454,7 @@ export default LocaleMatcher;
451
454
  <br class="clear">
452
455
 
453
456
  <footer>
454
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> on Tue Aug 30 2022 08:15:13 GMT-0700 (Pacific Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
457
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Tue Nov 21 2023 19:43:43 GMT-0800 (Pacific Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
455
458
  </footer>
456
459
 
457
460
  <script>prettyPrint();</script>
package/docs/index.html CHANGED
@@ -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
 
31
+
30
32
  <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="LocaleMatcher.html">LocaleMatcher</a><ul class='methods'><li data-type='method'><a href="LocaleMatcher.html#getLikelyLocale">getLikelyLocale</a></li><li data-type='method'><a href="LocaleMatcher.html#getLikelyLocaleMinimal">getLikelyLocaleMinimal</a></li><li data-type='method'><a href="LocaleMatcher.html#getLocale">getLocale</a></li><li data-type='method'><a href="LocaleMatcher.html#getMacroLanguage">getMacroLanguage</a></li><li data-type='method'><a href="LocaleMatcher.html#getRegionContainment">getRegionContainment</a></li><li data-type='method'><a href="LocaleMatcher.html#match">match</a></li><li data-type='method'><a href="LocaleMatcher.html#smallestCommonRegion">smallestCommonRegion</a></li></ul></li></ul>
33
+
31
34
  </nav>
32
35
 
33
36
  <div id="main">
@@ -68,7 +71,7 @@
68
71
  <br class="clear">
69
72
 
70
73
  <footer>
71
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> on Tue Aug 30 2022 08:15:14 GMT-0700 (Pacific Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
74
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Tue Nov 21 2023 19:43:43 GMT-0800 (Pacific Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
72
75
  </footer>
73
76
 
74
77
  <script>prettyPrint();</script>
@@ -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
+ }