ilib-localematcher 1.3.2 → 1.3.4
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 +1 -44
- package/lib/LocaleMatcher.js +1 -1
- package/lib/LocaleMatcher.js.map +1 -1
- package/package.json +110 -111
- package/src/LocaleMatcher.js +7 -7
- package/docs/LocaleMatcher.html +0 -1237
- package/docs/LocaleMatcher.js.html +0 -465
- 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 +0 -978
- 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 +0 -1049
- 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/ilibLocaleMatcher.md +0 -235
- package/docs/index.html +0 -84
- package/docs/scripts/collapse.js +0 -39
- package/docs/scripts/commonNav.js +0 -28
- package/docs/scripts/linenumber.js +0 -25
- package/docs/scripts/nav.js +0 -12
- package/docs/scripts/polyfill.js +0 -4
- package/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/docs/scripts/prettify/lang-css.js +0 -2
- package/docs/scripts/prettify/prettify.js +0 -28
- package/docs/scripts/search.js +0 -99
- package/docs/styles/jsdoc.css +0 -776
- package/docs/styles/prettify.css +0 -80
- package/lib/package.json +0 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
<a name="LocaleMatcher"></a>
|
|
2
|
-
|
|
3
|
-
## LocaleMatcher
|
|
4
|
-
Represent a locale matcher instance, which is used
|
|
5
|
-
to see which locales can be matched with each other in
|
|
6
|
-
various ways.
|
|
7
|
-
|
|
8
|
-
**Kind**: global class
|
|
9
|
-
|
|
10
|
-
* [LocaleMatcher](#LocaleMatcher)
|
|
11
|
-
* [new LocaleMatcher(options)](#new_LocaleMatcher_new)
|
|
12
|
-
* [.getLocale()](#LocaleMatcher+getLocale) ⇒ <code>Locale</code> \| <code>undefined</code>
|
|
13
|
-
* [.getLikelyLocale()](#LocaleMatcher+getLikelyLocale) ⇒ <code>Locale</code>
|
|
14
|
-
* [.getLikelyLocaleMinimal()](#LocaleMatcher+getLikelyLocaleMinimal) ⇒ <code>Locale</code>
|
|
15
|
-
* [.match(locale)](#LocaleMatcher+match) ⇒ <code>number</code>
|
|
16
|
-
* [.getMacroLanguage()](#LocaleMatcher+getMacroLanguage) ⇒ <code>string</code>
|
|
17
|
-
* [.getRegionContainment()](#LocaleMatcher+getRegionContainment) ⇒ <code>Array.<string></code>
|
|
18
|
-
* [.smallestCommonRegion(otherLocale)](#LocaleMatcher+smallestCommonRegion) ⇒ <code>string</code>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* * *
|
|
22
|
-
|
|
23
|
-
<a name="new_LocaleMatcher_new"></a>
|
|
24
|
-
|
|
25
|
-
### new LocaleMatcher(options)
|
|
26
|
-
Create a new locale matcher instance. This is used
|
|
27
|
-
to see which locales can be matched with each other in
|
|
28
|
-
various ways.<p>
|
|
29
|
-
|
|
30
|
-
The options object may contain any of the following properties:
|
|
31
|
-
|
|
32
|
-
<ul>
|
|
33
|
-
<li><i>locale</i> - the locale instance or locale spec to match
|
|
34
|
-
</ul>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
| Param | Type | Description |
|
|
38
|
-
| --- | --- | --- |
|
|
39
|
-
| options | <code>Object</code> | parameters to initialize this matcher |
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
* * *
|
|
43
|
-
|
|
44
|
-
<a name="LocaleMatcher+getLocale"></a>
|
|
45
|
-
|
|
46
|
-
### localeMatcher.getLocale() ⇒ <code>Locale</code> \| <code>undefined</code>
|
|
47
|
-
Return the locale used to construct this instance.
|
|
48
|
-
|
|
49
|
-
**Kind**: instance method of [<code>LocaleMatcher</code>](#LocaleMatcher)
|
|
50
|
-
**Returns**: <code>Locale</code> \| <code>undefined</code> - the locale for this matcher
|
|
51
|
-
|
|
52
|
-
* * *
|
|
53
|
-
|
|
54
|
-
<a name="LocaleMatcher+getLikelyLocale"></a>
|
|
55
|
-
|
|
56
|
-
### localeMatcher.getLikelyLocale() ⇒ <code>Locale</code>
|
|
57
|
-
Return an Locale instance that is fully specified based on partial information
|
|
58
|
-
given to the constructor of this locale matcher instance. For example, if the locale
|
|
59
|
-
spec given to this locale matcher instance is simply "ru" (for the Russian language),
|
|
60
|
-
then it will fill in the missing region and script tags and return a locale with
|
|
61
|
-
the specifier "ru-Cyrl-RU". (ie. Russian language, Cyrillic, Russian Federation).
|
|
62
|
-
Any one or two of the language, script, or region parts may be left unspecified,
|
|
63
|
-
and the other one or two parts will be filled in automatically. If this
|
|
64
|
-
class has no information about the given locale, then the locale of this
|
|
65
|
-
locale matcher instance is returned unchanged.
|
|
66
|
-
|
|
67
|
-
**Kind**: instance method of [<code>LocaleMatcher</code>](#LocaleMatcher)
|
|
68
|
-
**Returns**: <code>Locale</code> - the most likely completion of the partial locale given
|
|
69
|
-
to the constructor of this locale matcher instance
|
|
70
|
-
|
|
71
|
-
* * *
|
|
72
|
-
|
|
73
|
-
<a name="LocaleMatcher+getLikelyLocaleMinimal"></a>
|
|
74
|
-
|
|
75
|
-
### localeMatcher.getLikelyLocaleMinimal() ⇒ <code>Locale</code>
|
|
76
|
-
Return an Locale instance that is specified based on partial information
|
|
77
|
-
given to the constructor of this locale matcher instance but which leaves out any
|
|
78
|
-
part of the locale specifier that is so common that it is understood. For example,
|
|
79
|
-
if the locale
|
|
80
|
-
spec given to this locale matcher instance is simply "ru" (for the Russian language),
|
|
81
|
-
then it will fill in the missing region and/or script tags and return a locale with
|
|
82
|
-
the specifier "ru-RU". (ie. Russian language, Russian Federation). Note that the
|
|
83
|
-
default script "Cyrl" is left out because the vast majority of text written in
|
|
84
|
-
Russian is written with the Cyrllic script, so that part of the locale is understood
|
|
85
|
-
and is commonly left out.<p>
|
|
86
|
-
|
|
87
|
-
Any one or two of the language, script, or region parts may be left unspecified,
|
|
88
|
-
and the other one or two parts will be filled in automatically. If this
|
|
89
|
-
class has no information about the given locale, then the locale of this
|
|
90
|
-
locale matcher instance is returned unchanged.<p>
|
|
91
|
-
|
|
92
|
-
This method returns the same information as getLikelyLocale but with the very common
|
|
93
|
-
parts left out.
|
|
94
|
-
|
|
95
|
-
**Kind**: instance method of [<code>LocaleMatcher</code>](#LocaleMatcher)
|
|
96
|
-
**Returns**: <code>Locale</code> - the most likely "minimal" completion of the partial locale given
|
|
97
|
-
to the constructor of this locale matcher instance where the commonly understood
|
|
98
|
-
parts are left out.
|
|
99
|
-
|
|
100
|
-
* * *
|
|
101
|
-
|
|
102
|
-
<a name="LocaleMatcher+match"></a>
|
|
103
|
-
|
|
104
|
-
### localeMatcher.match(locale) ⇒ <code>number</code>
|
|
105
|
-
Return the degree that the given locale matches the current locale of this
|
|
106
|
-
matcher. This method returns an integer from 0 to 100. A value of 100 is
|
|
107
|
-
a 100% match, meaning that the two locales are exactly equivalent to each
|
|
108
|
-
other. (eg. "ja-JP" and "ja-JP") A value of 0 means that there 0% match or
|
|
109
|
-
that the two locales have nothing in common. (eg. "en-US" and "ja-JP") <p>
|
|
110
|
-
|
|
111
|
-
Locale matching is not the same as equivalence, as the degree of matching
|
|
112
|
-
is returned. (See Locale.equals for equivalence.)<p>
|
|
113
|
-
|
|
114
|
-
The match score is calculated based on matching the 4 locale components,
|
|
115
|
-
weighted by importance:
|
|
116
|
-
|
|
117
|
-
<ul>
|
|
118
|
-
<li> language - this accounts for 50% of the match score
|
|
119
|
-
<li> region - accounts for 25% of the match score
|
|
120
|
-
<li> script - accounts for 20% of the match score
|
|
121
|
-
<li> variant - accounts for 5% of the match score
|
|
122
|
-
</ul>
|
|
123
|
-
|
|
124
|
-
The score is affected by the following things:
|
|
125
|
-
|
|
126
|
-
<ul>
|
|
127
|
-
<li> A large language score is given when the language components of the locales
|
|
128
|
-
match exactly.
|
|
129
|
-
<li> Higher language scores are given when the languages are linguistically
|
|
130
|
-
close to each other, such as dialects.
|
|
131
|
-
<li> A small score is given when two languages are in the same
|
|
132
|
-
linguistic family, but one is not a dialect of the other, such as German
|
|
133
|
-
and Dutch.
|
|
134
|
-
<li> A large region score is given when two locales share the same region.
|
|
135
|
-
<li> A smaller region score is given when one region is contained within
|
|
136
|
-
another. For example, Hong Kong is part of China, so a moderate score is
|
|
137
|
-
given instead of a full score.
|
|
138
|
-
<li> A small score is given if two regions are geographically close to
|
|
139
|
-
each other or are tied by history. For example, Ireland and Great Britain
|
|
140
|
-
are both adjacent and tied by history, so they receive a moderate score.
|
|
141
|
-
<li> A high script score is given if the two locales share the same script.
|
|
142
|
-
The legibility of a common script means that there is some small kinship of the
|
|
143
|
-
different languages.
|
|
144
|
-
<li> A high variant score is given if the two locales share the same
|
|
145
|
-
variant. Full score is given when both locales have no variant at all.
|
|
146
|
-
<li> Locale components that are unspecified in both locales are given high
|
|
147
|
-
scores.
|
|
148
|
-
<li> Locales where a particular locale component is missing in only one
|
|
149
|
-
locale can still match when the default for that locale component matches
|
|
150
|
-
the component in the other locale. The
|
|
151
|
-
default value for the missing component is determined using the likely locales
|
|
152
|
-
data. (See getLikelyLocale()) For example, "en-US" and "en-Latn-US" receive
|
|
153
|
-
a high script score because the default script for "en" is "Latn".
|
|
154
|
-
</ul>
|
|
155
|
-
|
|
156
|
-
The intention of this method is that it can be used to determine
|
|
157
|
-
compatibility of locales. For example, when a user signs up for an
|
|
158
|
-
account on a web site, the locales that the web site supports and
|
|
159
|
-
the locale of the user's browser may differ, and the site needs to
|
|
160
|
-
pick the best locale to show the user. Let's say the
|
|
161
|
-
web site supports a selection of European languages such as "it-IT",
|
|
162
|
-
"fr-FR", "de-DE", and "en-GB". The user's
|
|
163
|
-
browser may be set to "it-CH". The web site code can then match "it-CH"
|
|
164
|
-
against each of the supported locales to find the one with the
|
|
165
|
-
highest score. In
|
|
166
|
-
this case, the best match would be "it-IT" because it shares a
|
|
167
|
-
language and script in common with "it-CH" and differs only in the region
|
|
168
|
-
component. It is not a 100% match, but it is pretty good. The web site
|
|
169
|
-
may decide if the match scores all fall
|
|
170
|
-
below a chosen threshold (perhaps 50%?), it should show the user the
|
|
171
|
-
default language "en-GB", because that is probably a better choice
|
|
172
|
-
than any other supported locale.<p>
|
|
173
|
-
|
|
174
|
-
**Kind**: instance method of [<code>LocaleMatcher</code>](#LocaleMatcher)
|
|
175
|
-
**Returns**: <code>number</code> - an integer from 0 to 100 that indicates the degree to
|
|
176
|
-
which these locales match each other
|
|
177
|
-
|
|
178
|
-
| Param | Type | Description |
|
|
179
|
-
| --- | --- | --- |
|
|
180
|
-
| locale | <code>Locale</code> | the other locale to match against the current one |
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
* * *
|
|
184
|
-
|
|
185
|
-
<a name="LocaleMatcher+getMacroLanguage"></a>
|
|
186
|
-
|
|
187
|
-
### localeMatcher.getMacroLanguage() ⇒ <code>string</code>
|
|
188
|
-
Return the macrolanguage associated with this locale. If the
|
|
189
|
-
locale's language is not part of a macro-language, then the
|
|
190
|
-
locale's language is returned as-is.
|
|
191
|
-
|
|
192
|
-
**Kind**: instance method of [<code>LocaleMatcher</code>](#LocaleMatcher)
|
|
193
|
-
**Returns**: <code>string</code> - the ISO code for the macrolanguage associated
|
|
194
|
-
with this locale, or language of the locale
|
|
195
|
-
|
|
196
|
-
* * *
|
|
197
|
-
|
|
198
|
-
<a name="LocaleMatcher+getRegionContainment"></a>
|
|
199
|
-
|
|
200
|
-
### localeMatcher.getRegionContainment() ⇒ <code>Array.<string></code>
|
|
201
|
-
Return the list of regions that this locale is contained within. Regions are
|
|
202
|
-
nested, so locales can be in multiple regions. (eg. US is in Northern North
|
|
203
|
-
America, North America, the Americas, the World.) Most regions are specified
|
|
204
|
-
using UN.49 region numbers, though some, like "EU", are letters. If the
|
|
205
|
-
locale is underspecified, this method will use the most likely locale method
|
|
206
|
-
to get the region first. For example, the locale "ja" (Japanese) is most
|
|
207
|
-
likely "ja-JP" (Japanese for Japan), and the region containment info for Japan
|
|
208
|
-
is returned.
|
|
209
|
-
|
|
210
|
-
**Kind**: instance method of [<code>LocaleMatcher</code>](#LocaleMatcher)
|
|
211
|
-
**Returns**: <code>Array.<string></code> - an array of region specifiers that this locale is within
|
|
212
|
-
|
|
213
|
-
* * *
|
|
214
|
-
|
|
215
|
-
<a name="LocaleMatcher+smallestCommonRegion"></a>
|
|
216
|
-
|
|
217
|
-
### localeMatcher.smallestCommonRegion(otherLocale) ⇒ <code>string</code>
|
|
218
|
-
Find the smallest region that contains both the current locale and the other locale.
|
|
219
|
-
If the current or other locales are underspecified, this method will use the most
|
|
220
|
-
likely locale method
|
|
221
|
-
to get their regions first. For example, the locale "ja" (Japanese) is most
|
|
222
|
-
likely "ja-JP" (Japanese for Japan), and the region containment info for Japan
|
|
223
|
-
is checked against the other locale's region containment info.
|
|
224
|
-
|
|
225
|
-
**Kind**: instance method of [<code>LocaleMatcher</code>](#LocaleMatcher)
|
|
226
|
-
**Returns**: <code>string</code> - the region specifier of the smallest region containing both the
|
|
227
|
-
current locale and other locale
|
|
228
|
-
|
|
229
|
-
| Param | Type | Description |
|
|
230
|
-
| --- | --- | --- |
|
|
231
|
-
| otherLocale | <code>string</code> \| <code>Locale</code> | a locale specifier or a Locale instance to compare against |
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
* * *
|
|
235
|
-
|
package/docs/index.html
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
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="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
|
-
|
|
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 Tue Mar 31 2026 18:15:44 GMT-0700 (Pacific Daylight Time) 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>
|
package/docs/scripts/collapse.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
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();
|
|
@@ -1,28 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
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
|
-
})();
|
package/docs/scripts/nav.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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();
|
package/docs/scripts/polyfill.js
DELETED
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
Apache License
|
|
3
|
-
Version 2.0, January 2004
|
|
4
|
-
http://www.apache.org/licenses/
|
|
5
|
-
|
|
6
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
-
|
|
8
|
-
1. Definitions.
|
|
9
|
-
|
|
10
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
-
|
|
13
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
-
the copyright owner that is granting the License.
|
|
15
|
-
|
|
16
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
-
other entities that control, are controlled by, or are under common
|
|
18
|
-
control with that entity. For the purposes of this definition,
|
|
19
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
-
direction or management of such entity, whether by contract or
|
|
21
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
-
|
|
24
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
-
exercising permissions granted by this License.
|
|
26
|
-
|
|
27
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
-
including but not limited to software source code, documentation
|
|
29
|
-
source, and configuration files.
|
|
30
|
-
|
|
31
|
-
"Object" form shall mean any form resulting from mechanical
|
|
32
|
-
transformation or translation of a Source form, including but
|
|
33
|
-
not limited to compiled object code, generated documentation,
|
|
34
|
-
and conversions to other media types.
|
|
35
|
-
|
|
36
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
-
Object form, made available under the License, as indicated by a
|
|
38
|
-
copyright notice that is included in or attached to the work
|
|
39
|
-
(an example is provided in the Appendix below).
|
|
40
|
-
|
|
41
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
-
form, that is based on (or derived from) the Work and for which the
|
|
43
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
-
of this License, Derivative Works shall not include works that remain
|
|
46
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
-
the Work and Derivative Works thereof.
|
|
48
|
-
|
|
49
|
-
"Contribution" shall mean any work of authorship, including
|
|
50
|
-
the original version of the Work and any modifications or additions
|
|
51
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
-
means any form of electronic, verbal, or written communication sent
|
|
56
|
-
to the Licensor or its representatives, including but not limited to
|
|
57
|
-
communication on electronic mailing lists, source code control systems,
|
|
58
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
-
excluding communication that is conspicuously marked or otherwise
|
|
61
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
-
|
|
63
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
-
subsequently incorporated within the Work.
|
|
66
|
-
|
|
67
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
-
Work and such Derivative Works in Source or Object form.
|
|
73
|
-
|
|
74
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
-
(except as stated in this section) patent license to make, have made,
|
|
78
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
-
where such license applies only to those patent claims licensable
|
|
80
|
-
by such Contributor that are necessarily infringed by their
|
|
81
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
-
institute patent litigation against any entity (including a
|
|
84
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
-
or contributory patent infringement, then any patent licenses
|
|
87
|
-
granted to You under this License for that Work shall terminate
|
|
88
|
-
as of the date such litigation is filed.
|
|
89
|
-
|
|
90
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
-
modifications, and in Source or Object form, provided that You
|
|
93
|
-
meet the following conditions:
|
|
94
|
-
|
|
95
|
-
(a) You must give any other recipients of the Work or
|
|
96
|
-
Derivative Works a copy of this License; and
|
|
97
|
-
|
|
98
|
-
(b) You must cause any modified files to carry prominent notices
|
|
99
|
-
stating that You changed the files; and
|
|
100
|
-
|
|
101
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
-
that You distribute, all copyright, patent, trademark, and
|
|
103
|
-
attribution notices from the Source form of the Work,
|
|
104
|
-
excluding those notices that do not pertain to any part of
|
|
105
|
-
the Derivative Works; and
|
|
106
|
-
|
|
107
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
-
distribution, then any Derivative Works that You distribute must
|
|
109
|
-
include a readable copy of the attribution notices contained
|
|
110
|
-
within such NOTICE file, excluding those notices that do not
|
|
111
|
-
pertain to any part of the Derivative Works, in at least one
|
|
112
|
-
of the following places: within a NOTICE text file distributed
|
|
113
|
-
as part of the Derivative Works; within the Source form or
|
|
114
|
-
documentation, if provided along with the Derivative Works; or,
|
|
115
|
-
within a display generated by the Derivative Works, if and
|
|
116
|
-
wherever such third-party notices normally appear. The contents
|
|
117
|
-
of the NOTICE file are for informational purposes only and
|
|
118
|
-
do not modify the License. You may add Your own attribution
|
|
119
|
-
notices within Derivative Works that You distribute, alongside
|
|
120
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
-
that such additional attribution notices cannot be construed
|
|
122
|
-
as modifying the License.
|
|
123
|
-
|
|
124
|
-
You may add Your own copyright statement to Your modifications and
|
|
125
|
-
may provide additional or different license terms and conditions
|
|
126
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
-
the conditions stated in this License.
|
|
130
|
-
|
|
131
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
-
this License, without any additional terms or conditions.
|
|
135
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
-
the terms of any separate license agreement you may have executed
|
|
137
|
-
with Licensor regarding such Contributions.
|
|
138
|
-
|
|
139
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
-
except as required for reasonable and customary use in describing the
|
|
142
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
-
|
|
144
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
-
implied, including, without limitation, any warranties or conditions
|
|
149
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
-
appropriateness of using or redistributing the Work and assume any
|
|
152
|
-
risks associated with Your exercise of permissions under this License.
|
|
153
|
-
|
|
154
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
-
unless required by applicable law (such as deliberate and grossly
|
|
157
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
-
liable to You for damages, including any direct, indirect, special,
|
|
159
|
-
incidental, or consequential damages of any character arising as a
|
|
160
|
-
result of this License or out of the use or inability to use the
|
|
161
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
-
other commercial damages or losses), even if such Contributor
|
|
164
|
-
has been advised of the possibility of such damages.
|
|
165
|
-
|
|
166
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
-
or other liability obligations and/or rights consistent with this
|
|
170
|
-
License. However, in accepting such obligations, You may act only
|
|
171
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
-
defend, and hold each Contributor harmless for any liability
|
|
174
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
-
of your accepting any such warranty or additional liability.
|
|
176
|
-
|
|
177
|
-
END OF TERMS AND CONDITIONS
|
|
178
|
-
|
|
179
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
-
|
|
181
|
-
To apply the Apache License to your work, attach the following
|
|
182
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
-
replaced with your own identifying information. (Don't include
|
|
184
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
-
comment syntax for the file format. We also recommend that a
|
|
186
|
-
file or class name and description of purpose be included on the
|
|
187
|
-
same "printed page" as the copyright notice for easier
|
|
188
|
-
identification within third-party archives.
|
|
189
|
-
|
|
190
|
-
Copyright [yyyy] [name of copyright owner]
|
|
191
|
-
|
|
192
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
-
you may not use this file except in compliance with the License.
|
|
194
|
-
You may obtain a copy of the License at
|
|
195
|
-
|
|
196
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
-
|
|
198
|
-
Unless required by applicable law or agreed to in writing, software
|
|
199
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
-
See the License for the specific language governing permissions and
|
|
202
|
-
limitations under the License.
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n"]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com",
|
|
2
|
-
/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]);
|