jekyll_pages_api_search 0.4.5 → 0.5.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.
- checksums.yaml +5 -5
- data/LICENSE.md +13 -31
- data/README.md +21 -66
- data/assets/js/merge-options.js +22 -0
- data/assets/js/search-bundle.js +23 -16
- data/assets/js/search-bundle.js.gz +0 -0
- data/assets/js/search-engine.js +11 -11
- data/assets/js/search-ui.js +41 -34
- data/assets/js/search.js +3 -4
- data/bin/jekyll_pages_api_search +1 -3
- data/lib/jekyll_pages_api_search.rb +0 -2
- data/lib/jekyll_pages_api_search/assets.rb +0 -2
- data/lib/jekyll_pages_api_search/browserify.js +10 -2
- data/lib/jekyll_pages_api_search/bundler.rb +77 -0
- data/lib/jekyll_pages_api_search/generator.rb +0 -1
- data/lib/jekyll_pages_api_search/lunr.min.js +1 -7
- data/lib/jekyll_pages_api_search/sass.rb +0 -2
- data/lib/jekyll_pages_api_search/search.js +6 -7
- data/lib/jekyll_pages_api_search/search.rb +0 -2
- data/lib/jekyll_pages_api_search/search_hook.rb +6 -4
- data/lib/jekyll_pages_api_search/search_page_layouts.rb +1 -0
- data/lib/jekyll_pages_api_search/site.rb +18 -5
- data/lib/jekyll_pages_api_search/standalone.rb +19 -2
- data/lib/jekyll_pages_api_search/tags.rb +1 -3
- data/lib/jekyll_pages_api_search/version.rb +1 -3
- metadata +8 -8
- data/CONTRIBUTING.md +0 -88
- data/lib/jekyll_pages_api_search/browserify.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7de05459a2a807ae078606ef326c6a47ecff53c3
|
4
|
+
data.tar.gz: df58eebc25205bae12adbc9ab2927baa98ae9d87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45bcf6865092854c6bedea6a05c96e40848b9aede360dfa066f743dcc7b0ad8a14a40b5410f9926d5a5a36b76208fc7a023335053b80154883f1af71bcd9cf31
|
7
|
+
data.tar.gz: c79a22be2ab70d865bc2f46605ef37bd78dd0bb168a5fc3890ffe8f48863a1b45a972dfe1527615b856098c0da8ffc62f8681971e24ff47f041d8183db2538bc
|
data/LICENSE.md
CHANGED
@@ -1,31 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
the public domain by waiving all of his or her rights to the work worldwide
|
15
|
-
under copyright law, including all related and neighboring rights, to the
|
16
|
-
extent allowed by law.
|
17
|
-
|
18
|
-
You can copy, modify, distribute and perform the work, even for commercial
|
19
|
-
purposes, all without asking permission.
|
20
|
-
|
21
|
-
### Other Information
|
22
|
-
|
23
|
-
In no way are the patent or trademark rights of any person affected by CC0,
|
24
|
-
nor are the rights that other persons may have in the work or in how the
|
25
|
-
work is used, such as publicity or privacy rights.
|
26
|
-
|
27
|
-
Unless expressly stated otherwise, the person who associated a work with
|
28
|
-
this deed makes no warranties about the work, and disclaims liability for
|
29
|
-
all uses of the work, to the fullest extent permitted by applicable law.
|
30
|
-
When using or citing the work, you should not imply endorsement by the
|
31
|
-
author or the affirmer.
|
1
|
+
Copyright (c) 2017-2018, Mike Bland <mbland@acm.org>
|
2
|
+
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
4
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
5
|
+
and this permission notice appear in all copies.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
9
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
11
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
12
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
13
|
+
THIS SOFTWARE.
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
## jekyll_pages_api_search Plugin
|
2
2
|
|
3
|
-
[](https://travis-ci.org/mbland/jekyll_pages_api_search)
|
4
4
|
|
5
5
|
The [`jekyll_pages_api_search` Ruby
|
6
6
|
gem](https://rubygems.org/gems/jekyll_pages_api_search) adds a
|
@@ -20,7 +20,7 @@ result receives the tab index, making mouse-based navigation unnecessary.
|
|
20
20
|
</figcaption>
|
21
21
|
</figure>
|
22
22
|
|
23
|
-
|
23
|
+
### How it works
|
24
24
|
|
25
25
|
On the server building the site, the plugin takes the corpus produced by the
|
26
26
|
[`jekyll_pages_api` gem](https://github.com/18F/jekyll_pages_api/) and feeds
|
@@ -43,7 +43,7 @@ All of the client-side components are bundled together with
|
|
43
43
|
`assets/js/search.js` into `assets/js/search-bundle.js` using
|
44
44
|
[Browserify](http://browserify.org/).
|
45
45
|
|
46
|
-
|
46
|
+
### Installation
|
47
47
|
|
48
48
|
1. Install [Node.js](https://nodejs.org/) on your system. This plugin requires
|
49
49
|
version 4.2 or greater or version 5 or greater. You may wish to first install a
|
@@ -99,7 +99,7 @@ All of the client-side components are bundled together with
|
|
99
99
|
to take advantage of the gzipped versions of the search index and supporting
|
100
100
|
JavaScript.
|
101
101
|
|
102
|
-
|
102
|
+
### Usage
|
103
103
|
|
104
104
|
To add the index to your pages, insert the following tags in your `_layouts`
|
105
105
|
and `_includes` files as you see fit:
|
@@ -116,7 +116,7 @@ assets](http://jekyllrb.com/docs/assets/) to use the default interface style.
|
|
116
116
|
Add `skip_index: true` to the front matter of any documents you would like to
|
117
117
|
exclude from the index (e.g. indexes that contain summaries of other documents).
|
118
118
|
|
119
|
-
|
119
|
+
### Configuration
|
120
120
|
|
121
121
|
In addition to the fields listed above in the [installation
|
122
122
|
instructions](#installation), the following properties of the
|
@@ -130,7 +130,7 @@ instructions](#installation), the following properties of the
|
|
130
130
|
- **endpoint**: The name of the endpoint generated for the search results
|
131
131
|
page. Defaults to `search`.
|
132
132
|
|
133
|
-
|
133
|
+
### Results UI and search engine options
|
134
134
|
|
135
135
|
To customize elements of the search user interface and search engine, add the
|
136
136
|
following objects to your search result page's layout _before_ the
|
@@ -161,11 +161,6 @@ var JEKYLL_PAGES_API_SEARCH_UI_OPTIONS = {
|
|
161
161
|
};
|
162
162
|
|
163
163
|
var JEKYLL_PAGES_API_SEARCH_ENGINE_OPTIONS = {
|
164
|
-
// Path to the generated Lunr.js search index relative to site.baseurl;
|
165
|
-
// should match what is generated by the Ruby class
|
166
|
-
// JekyllPagesApiSearch::SearchIndexBuilder.
|
167
|
-
indexPath: '/search-index.json',
|
168
|
-
|
169
164
|
// URL query string parameter containing the search query string
|
170
165
|
queryParam: 'q'
|
171
166
|
};
|
@@ -228,44 +223,7 @@ instructions](#installation) above, replacing `js/my-search.js` with the path
|
|
228
223
|
to your `renderJekyllPagesApiSearchResults` implementation script and
|
229
224
|
`js/my-search-bundle.js` with the path to your generated bundle.
|
230
225
|
|
231
|
-
###
|
232
|
-
|
233
|
-
[apps.gov's default
|
234
|
-
layout](https://github.com/presidential-innovation-fellows/apps-gov/blob/master/_layouts/default.html)
|
235
|
-
contains an example of setting the user interface options in concert with a [custom
|
236
|
-
search results rendering
|
237
|
-
script](https://github.com/presidential-innovation-fellows/apps-gov/blob/master/assets/js/products.js):
|
238
|
-
|
239
|
-
```html
|
240
|
-
</body>
|
241
|
-
<script>
|
242
|
-
var JEKYLL_PAGES_API_SEARCH_UI_OPTIONS = {
|
243
|
-
inputElementId: 'search-field',
|
244
|
-
searchResultsId: 'product-list',
|
245
|
-
emptyResultsMessagePrefix: 'No products found matching'
|
246
|
-
};
|
247
|
-
</script>
|
248
|
-
{% jekyll_pages_api_search_load %}
|
249
|
-
</html>
|
250
|
-
```
|
251
|
-
|
252
|
-
Note that if you have a _different_ input element on different pages, you can
|
253
|
-
add something similar to the following to each corresponding layout (taken
|
254
|
-
from [apps.gov's homepage
|
255
|
-
layout](https://github.com/presidential-innovation-fellows/apps-gov/blob/master/_layouts/home.html)):
|
256
|
-
|
257
|
-
```html
|
258
|
-
</body>
|
259
|
-
<script>
|
260
|
-
var JEKYLL_PAGES_API_SEARCH_UI_OPTIONS = {
|
261
|
-
inputElementId: 'search-field-big'
|
262
|
-
};
|
263
|
-
</script>
|
264
|
-
{% jekyll_pages_api_search_load %}
|
265
|
-
</html>
|
266
|
-
```
|
267
|
-
|
268
|
-
## Customizing tags and script loading
|
226
|
+
### Customizing tags and script loading
|
269
227
|
|
270
228
|
If you prefer to craft your own versions of these tags and styles, you can
|
271
229
|
capture the output of these tags and the Sass `@import` statement, then create
|
@@ -283,14 +241,14 @@ Alternately, you can inspect the code of this gem (all paths relative to
|
|
283
241
|
- `@import "jekyll_pages_api_search";`: includes
|
284
242
|
`sass/jekyll_pages_api_search.scss`
|
285
243
|
|
286
|
-
|
244
|
+
### Running standalone
|
287
245
|
|
288
246
|
If you wish to generate a `search-index.json` file (and optionaly a
|
289
247
|
`pages.json` file) when using a site generation tool other than Jekyll, you
|
290
248
|
can run the `jekyll_pages_api_search` executable as a post-generation step.
|
291
249
|
Run `jekyll_pages_api -h` for instructions.
|
292
250
|
|
293
|
-
|
251
|
+
### Developing
|
294
252
|
|
295
253
|
Install Node.js per the [installation instructions (step #1)](#installation).
|
296
254
|
The `Rakefile` will prompt you to install Node.js and any packages
|
@@ -322,14 +280,14 @@ group :jekyll_plugins do
|
|
322
280
|
end
|
323
281
|
```
|
324
282
|
|
325
|
-
|
283
|
+
### Releasing
|
326
284
|
|
327
285
|
After following the steps from the [Developing section](#developing) to build
|
328
286
|
and test the gem:
|
329
287
|
|
330
288
|
1. Ensure all changes for the release have already been merged all into the
|
331
289
|
`master` branch.
|
332
|
-
|
290
|
+
|
333
291
|
1. Bump the version number by editing
|
334
292
|
[`lib/jekyll_pages_api_search/version.rb`](lib/jekyll_pages_api_search/version.rb).
|
335
293
|
|
@@ -346,20 +304,17 @@ and test the gem:
|
|
346
304
|
$ bundle exec rake release
|
347
305
|
```
|
348
306
|
|
349
|
-
|
307
|
+
### Open Source License
|
308
|
+
|
309
|
+
This software is made available as [Open Source software][oss-def] under the
|
310
|
+
[ISC License][]. For the text of the license, see the [LICENSE](LICENSE.md)
|
311
|
+
file.
|
350
312
|
|
351
|
-
|
352
|
-
[
|
313
|
+
[oss-def]: https://opensource.org/osd-annotated
|
314
|
+
[isc license]: https://www.isc.org/downloads/software-support-policy/isc-license/
|
353
315
|
|
354
|
-
|
316
|
+
### Prior work
|
355
317
|
|
356
|
-
This
|
357
|
-
[CONTRIBUTING](CONTRIBUTING.md):
|
318
|
+
This is derived from the original [18F/jekyll_pages_api_search][old].
|
358
319
|
|
359
|
-
|
360
|
-
> and related rights in the work worldwide are waived through the
|
361
|
-
> [CC0 1.0 Universal public domain dedication](https://creativecommons.org/publicdomain/zero/1.0/).
|
362
|
-
>
|
363
|
-
> All contributions to this project will be released under the CC0 dedication.
|
364
|
-
> By submitting a pull request, you are agreeing to comply with this waiver of
|
365
|
-
> copyright interest.
|
320
|
+
[old]: https://github.com/18F/jekyll_pages_api_search
|
@@ -0,0 +1,22 @@
|
|
1
|
+
/* eslint-env node */
|
2
|
+
|
3
|
+
'use strict';
|
4
|
+
|
5
|
+
module.exports = function(defaults, options, result) {
|
6
|
+
var unknownNames;
|
7
|
+
|
8
|
+
unknownNames = Object.keys(options).filter(function(propertyName) {
|
9
|
+
return !defaults.hasOwnProperty(propertyName);
|
10
|
+
});
|
11
|
+
|
12
|
+
if (unknownNames.length !== 0) {
|
13
|
+
throw new Error('options object contains unknown properties:\n ' +
|
14
|
+
unknownNames.join('\n '));
|
15
|
+
}
|
16
|
+
|
17
|
+
Object.keys(defaults).forEach(function(propertyName) {
|
18
|
+
var opt = options[propertyName];
|
19
|
+
result[propertyName] = opt !== undefined ? opt : defaults[propertyName];
|
20
|
+
});
|
21
|
+
return result;
|
22
|
+
};
|
data/assets/js/search-bundle.js
CHANGED
@@ -1,29 +1,36 @@
|
|
1
1
|
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
2
|
-
"use strict";
|
2
|
+
"use strict";module.exports=function(n,r,t){var o;if(0!==(o=Object.keys(r).filter(function(r){return!n.hasOwnProperty(r)})).length)throw new Error("options object contains unknown properties:\n "+o.join("\n "));return Object.keys(n).forEach(function(o){var e=r[o];t[o]=void 0!==e?e:n[o]}),t};
|
3
3
|
|
4
|
-
},{
|
5
|
-
"use strict";
|
4
|
+
},{}],2:[function(require,module,exports){
|
5
|
+
"use strict";var mergeOptions=require("./merge-options"),lunr=require("lunr"),querystring=require("querystring"),url=require("url");module.exports=SearchEngine;function SearchEngine(e){mergeOptions(SearchEngine.DEFAULTS,e||{},this)}SearchEngine.DEFAULTS={queryParam:"q"},SearchEngine.prototype.fetchIndex=function(e){return new Promise(function(r,n){var t=new XMLHttpRequest;t.addEventListener("load",function(){var t;try{t=JSON.parse(this.responseText),r({urlToDoc:t.urlToDoc,index:lunr.Index.load(t.index)})}catch(r){n(new Error("failed to parse "+e))}}),t.addEventListener("error",function(){n(new Error("failed to make XMLHttpRequest; see console for details"))}),t.open("GET",e),t.send()})},SearchEngine.prototype.parseSearchQuery=function(e){return querystring.parse(url.parse(e).query)[this.queryParam]},SearchEngine.prototype.getResults=function(e,r){var n=r.index.search(e);return n.forEach(function(e){var n=r.urlToDoc[e.ref];Object.keys(n).forEach(function(r){e[r]=n[r]})}),n},SearchEngine.prototype.executeSearch=function(e,r){var n=this;return n.fetchIndex(e).then(function(e){var t=n.parseSearchQuery(r),o=n.getResults(t,e);return Promise.resolve({query:t,results:o})})};
|
6
6
|
|
7
|
-
},{}],3:[function(require,module,exports){
|
8
|
-
"use strict";function
|
9
|
-
},{"./search-engine":1,"./search-ui":2}],4:[function(require,module,exports){
|
10
|
-
!function(){var t=function(e){var n=new t.Index;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0.6.0",t.utils={},t.utils.warn=function(t){return function(e){t.console&&console.warn&&console.warn(e)}}(this),t.utils.asString=function(t){return void 0===t||null===t?"":t.toString()},t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){var t=Array.prototype.slice.call(arguments),e=t.pop(),n=t;if("function"!=typeof e)throw new TypeError("last argument must be a function");n.forEach(function(t){this.hasHandler(t)||(this.events[t]=[]),this.events[t].push(e)},this)},t.EventEmitter.prototype.removeListener=function(t,e){if(this.hasHandler(t)){var n=this.events[t].indexOf(e);this.events[t].splice(n,1),this.events[t].length||delete this.events[t]}},t.EventEmitter.prototype.emit=function(t){if(this.hasHandler(t)){var e=Array.prototype.slice.call(arguments,1);this.events[t].forEach(function(t){t.apply(void 0,e)})}},t.EventEmitter.prototype.hasHandler=function(t){return t in this.events},t.tokenizer=function(e){return arguments.length&&null!=e&&void 0!=e?Array.isArray(e)?e.map(function(e){return t.utils.asString(e).toLowerCase()}):e.toString().trim().toLowerCase().split(t.tokenizer.seperator):[]},t.tokenizer.seperator=/[\s\-]+/,t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(e){var i=t.Pipeline.registeredFunctions[e];if(!i)throw new Error("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(i==-1)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(i==-1)throw new Error("Cannot find existingFn");this._stack.splice(i,0,n)},t.Pipeline.prototype.remove=function(t){var e=this._stack.indexOf(t);e!=-1&&this._stack.splice(e,1)},t.Pipeline.prototype.run=function(t){for(var e=[],n=t.length,i=this._stack.length,r=0;r<n;r++){for(var o=t[r],s=0;s<i&&(o=this._stack[s](o,r,t),void 0!==o&&""!==o);s++);void 0!==o&&""!==o&&e.push(o)}return e},t.Pipeline.prototype.reset=function(){this._stack=[]},t.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Vector=function(){this._magnitude=null,this.list=void 0,this.length=0},t.Vector.Node=function(t,e,n){this.idx=t,this.val=e,this.next=n},t.Vector.prototype.insert=function(e,n){this._magnitude=void 0;var i=this.list;if(!i)return this.list=new t.Vector.Node(e,n,i),this.length++;if(e<i.idx)return this.list=new t.Vector.Node(e,n,i),this.length++;for(var r=i,o=i.next;void 0!=o;){if(e<o.idx)return r.next=new t.Vector.Node(e,n,o),this.length++;r=o,o=o.next}return r.next=new t.Vector.Node(e,n,o),this.length++},t.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var t,e=this.list,n=0;e;)t=e.val,n+=t*t,e=e.next;return this._magnitude=Math.sqrt(n)},t.Vector.prototype.dot=function(t){for(var e=this.list,n=t.list,i=0;e&&n;)e.idx<n.idx?e=e.next:e.idx>n.idx?n=n.next:(i+=e.val*n.val,e=e.next,n=n.next);return i},t.Vector.prototype.similarity=function(t){return this.dot(t)/(this.magnitude()*t.magnitude())},t.SortedSet=function(){this.length=0,this.elements=[]},t.SortedSet.load=function(t){var e=new this;return e.elements=t,e.length=t.length,e},t.SortedSet.prototype.add=function(){var t,e;for(t=0;t<arguments.length;t++)e=arguments[t],~this.indexOf(e)||this.elements.splice(this.locationFor(e),0,e);this.length=this.elements.length},t.SortedSet.prototype.toArray=function(){return this.elements.slice()},t.SortedSet.prototype.map=function(t,e){return this.elements.map(t,e)},t.SortedSet.prototype.forEach=function(t,e){return this.elements.forEach(t,e)},t.SortedSet.prototype.indexOf=function(t){for(var e=0,n=this.elements.length,i=n-e,r=e+Math.floor(i/2),o=this.elements[r];i>1;){if(o===t)return r;o<t&&(e=r),o>t&&(n=r),i=n-e,r=e+Math.floor(i/2),o=this.elements[r]}return o===t?r:-1},t.SortedSet.prototype.locationFor=function(t){for(var e=0,n=this.elements.length,i=n-e,r=e+Math.floor(i/2),o=this.elements[r];i>1;)o<t&&(e=r),o>t&&(n=r),i=n-e,r=e+Math.floor(i/2),o=this.elements[r];return o>t?r:o<t?r+1:void 0},t.SortedSet.prototype.intersect=function(e){for(var n=new t.SortedSet,i=0,r=0,o=this.length,s=e.length,a=this.elements,h=e.elements;;){if(i>o-1||r>s-1)break;a[i]!==h[r]?a[i]<h[r]?i++:a[i]>h[r]&&r++:(n.add(a[i]),i++,r++)}return n},t.SortedSet.prototype.clone=function(){var e=new t.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},t.SortedSet.prototype.union=function(t){var e,n,i;return this.length>=t.length?(e=this,n=t):(e=t,n=this),i=e.clone(),i.add.apply(i,n.toArray()),i},t.SortedSet.prototype.toJSON=function(){return this.toArray()},t.Index=function(){this._fields=[],this._ref="id",this.pipeline=new t.Pipeline,this.documentStore=new t.Store,this.tokenStore=new t.TokenStore,this.corpusTokens=new t.SortedSet,this.eventEmitter=new t.EventEmitter,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},t.Index.prototype.on=function(){var t=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,t)},t.Index.prototype.off=function(t,e){return this.eventEmitter.removeListener(t,e)},t.Index.load=function(e){e.version!==t.version&&t.utils.warn("version mismatch: current "+t.version+" importing "+e.version);var n=new this;return n._fields=e.fields,n._ref=e.ref,n.documentStore=t.Store.load(e.documentStore),n.tokenStore=t.TokenStore.load(e.tokenStore),n.corpusTokens=t.SortedSet.load(e.corpusTokens),n.pipeline=t.Pipeline.load(e.pipeline),n},t.Index.prototype.field=function(t,e){var e=e||{},n={name:t,boost:e.boost||1};return this._fields.push(n),this},t.Index.prototype.ref=function(t){return this._ref=t,this},t.Index.prototype.add=function(e,n){var i={},r=new t.SortedSet,o=e[this._ref],n=void 0===n||n;this._fields.forEach(function(n){var o=this.pipeline.run(t.tokenizer(e[n.name]));i[n.name]=o,t.SortedSet.prototype.add.apply(r,o)},this),this.documentStore.set(o,r),t.SortedSet.prototype.add.apply(this.corpusTokens,r.toArray());for(var s=0;s<r.length;s++){var a=r.elements[s],h=this._fields.reduce(function(t,e){var n=i[e.name].length;if(!n)return t;var r=i[e.name].filter(function(t){return t===a}).length;return t+r/n*e.boost},0);this.tokenStore.add(a,{ref:o,tf:h})}n&&this.eventEmitter.emit("add",e,this)},t.Index.prototype.remove=function(t,e){var n=t[this._ref],e=void 0===e||e;if(this.documentStore.has(n)){var i=this.documentStore.get(n);this.documentStore.remove(n),i.forEach(function(t){this.tokenStore.remove(t,n)},this),e&&this.eventEmitter.emit("remove",t,this)}},t.Index.prototype.update=function(t,e){var e=void 0===e||e;this.remove(t,!1),this.add(t,!1),e&&this.eventEmitter.emit("update",t,this)},t.Index.prototype.idf=function(t){var e="@"+t;if(Object.prototype.hasOwnProperty.call(this._idfCache,e))return this._idfCache[e];var n=this.tokenStore.count(t),i=1;return n>0&&(i=1+Math.log(this.documentStore.length/n)),this._idfCache[e]=i},t.Index.prototype.search=function(e){var n=this.pipeline.run(t.tokenizer(e)),i=new t.Vector,r=[],o=this._fields.reduce(function(t,e){return t+e.boost},0),s=n.some(function(t){return this.tokenStore.has(t)},this);if(!s)return[];n.forEach(function(e,n,s){var a=1/s.length*this._fields.length*o,h=this,l=this.tokenStore.expand(e).reduce(function(n,r){var o=h.corpusTokens.indexOf(r),s=h.idf(r),l=1,u=new t.SortedSet;if(r!==e){var c=Math.max(3,r.length-e.length);l=1/Math.log(c)}o>-1&&i.insert(o,a*s*l);for(var f=h.tokenStore.get(r),p=Object.keys(f),d=p.length,v=0;v<d;v++)u.add(f[p[v]].ref);return n.union(u)},new t.SortedSet);r.push(l)},this);var a=r.reduce(function(t,e){return t.intersect(e)});return a.map(function(t){return{ref:t,score:i.similarity(this.documentVector(t))}},this).sort(function(t,e){return e.score-t.score})},t.Index.prototype.documentVector=function(e){for(var n=this.documentStore.get(e),i=n.length,r=new t.Vector,o=0;o<i;o++){var s=n.elements[o],a=this.tokenStore.get(s)[e].tf,h=this.idf(s);r.insert(this.corpusTokens.indexOf(s),a*h)}return r},t.Index.prototype.toJSON=function(){return{version:t.version,fields:this._fields,ref:this._ref,documentStore:this.documentStore.toJSON(),tokenStore:this.tokenStore.toJSON(),corpusTokens:this.corpusTokens.toJSON(),pipeline:this.pipeline.toJSON()}},t.Index.prototype.use=function(t){var e=Array.prototype.slice.call(arguments,1);e.unshift(this),t.apply(this,e)},t.Store=function(){this.store={},this.length=0},t.Store.load=function(e){var n=new this;return n.length=e.length,n.store=Object.keys(e.store).reduce(function(n,i){return n[i]=t.SortedSet.load(e.store[i]),n},{}),n},t.Store.prototype.set=function(t,e){this.has(t)||this.length++,this.store[t]=e},t.Store.prototype.get=function(t){return this.store[t]},t.Store.prototype.has=function(t){return t in this.store},t.Store.prototype.remove=function(t){this.has(t)&&(delete this.store[t],this.length--)},t.Store.prototype.toJSON=function(){return{store:this.store,length:this.length}},t.stemmer=function(){var t={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},e={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},n="[^aeiou]",i="[aeiouy]",r=n+"[^aeiouy]*",o=i+"[aeiou]*",s="^("+r+")?"+o+r,a="^("+r+")?"+o+r+"("+o+")?$",h="^("+r+")?"+o+r+o+r,l="^("+r+")?"+i,u=new RegExp(s),c=new RegExp(h),f=new RegExp(a),p=new RegExp(l),d=/^(.+?)(ss|i)es$/,v=/^(.+?)([^s])s$/,m=/^(.+?)eed$/,g=/^(.+?)(ed|ing)$/,y=/.$/,S=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\1$"),x=new RegExp("^"+r+i+"[^aeiouwxy]$"),k=/^(.+?[^aeiou])y$/,b=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,E=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,_=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,F=/^(.+?)(s|t)(ion)$/,O=/^(.+?)e$/,P=/ll$/,N=new RegExp("^"+r+i+"[^aeiouwxy]$"),T=function(n){var i,r,o,s,a,h,l;if(n.length<3)return n;if(o=n.substr(0,1),"y"==o&&(n=o.toUpperCase()+n.substr(1)),s=d,a=v,s.test(n)?n=n.replace(s,"$1$2"):a.test(n)&&(n=n.replace(a,"$1$2")),s=m,a=g,s.test(n)){var T=s.exec(n);s=u,s.test(T[1])&&(s=y,n=n.replace(s,""))}else if(a.test(n)){var T=a.exec(n);i=T[1],a=p,a.test(i)&&(n=i,a=S,h=w,l=x,a.test(n)?n+="e":h.test(n)?(s=y,n=n.replace(s,"")):l.test(n)&&(n+="e"))}if(s=k,s.test(n)){var T=s.exec(n);i=T[1],n=i+"i"}if(s=b,s.test(n)){var T=s.exec(n);i=T[1],r=T[2],s=u,s.test(i)&&(n=i+t[r])}if(s=E,s.test(n)){var T=s.exec(n);i=T[1],r=T[2],s=u,s.test(i)&&(n=i+e[r])}if(s=_,a=F,s.test(n)){var T=s.exec(n);i=T[1],s=c,s.test(i)&&(n=i)}else if(a.test(n)){var T=a.exec(n);i=T[1]+T[2],a=c,a.test(i)&&(n=i)}if(s=O,s.test(n)){var T=s.exec(n);i=T[1],s=c,a=f,h=N,(s.test(i)||a.test(i)&&!h.test(i))&&(n=i)}return s=P,a=c,s.test(n)&&a.test(n)&&(s=y,n=n.replace(s,"")),"y"==o&&(n=o.toLowerCase()+n.substr(1)),n};return T}(),t.Pipeline.registerFunction(t.stemmer,"stemmer"),t.generateStopWordFilter=function(t){var e=t.reduce(function(t,e){return t[e]=e,t},{});return function(t){if(t&&e[t]!==t)return t}},t.stopWordFilter=t.generateStopWordFilter(["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]),t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter"),t.trimmer=function(t){return t.replace(/^\W+/,"").replace(/\W+$/,"")},t.Pipeline.registerFunction(t.trimmer,"trimmer"),t.TokenStore=function(){this.root={docs:{}},this.length=0},t.TokenStore.load=function(t){var e=new this;return e.root=t.root,e.length=t.length,e},t.TokenStore.prototype.add=function(t,e,n){var n=n||this.root,i=t.charAt(0),r=t.slice(1);return i in n||(n[i]={docs:{}}),0===r.length?(n[i].docs[e.ref]=e,void(this.length+=1)):this.add(r,e,n[i])},t.TokenStore.prototype.has=function(t){if(!t)return!1;for(var e=this.root,n=0;n<t.length;n++){if(!e[t.charAt(n)])return!1;e=e[t.charAt(n)]}return!0},t.TokenStore.prototype.getNode=function(t){if(!t)return{};for(var e=this.root,n=0;n<t.length;n++){if(!e[t.charAt(n)])return{};e=e[t.charAt(n)]}return e},t.TokenStore.prototype.get=function(t,e){return this.getNode(t,e).docs||{}},t.TokenStore.prototype.count=function(t,e){return Object.keys(this.get(t,e)).length},t.TokenStore.prototype.remove=function(t,e){if(t){for(var n=this.root,i=0;i<t.length;i++){if(!(t.charAt(i)in n))return;n=n[t.charAt(i)]}delete n.docs[e]}},t.TokenStore.prototype.expand=function(t,e){var n=this.getNode(t),i=n.docs||{},e=e||[];return Object.keys(i).length&&e.push(t),Object.keys(n).forEach(function(n){"docs"!==n&&e.concat(this.expand(t+n,e))},this),e},t.TokenStore.prototype.toJSON=function(){return{root:this.root,length:this.length}},function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():t.lunr=e()}(this,function(){return t})}();
|
7
|
+
},{"./merge-options":1,"lunr":5,"querystring":9,"url":10}],3:[function(require,module,exports){
|
8
|
+
"use strict";var mergeOptions=require("./merge-options");module.exports=SearchUi;function SearchUi(e,t){mergeOptions(SearchUi.DEFAULTS,t||{},this),this.doc=e,this.inputElement=e.getElementById(this.inputElementId),this.resultsElement=e.getElementById(this.searchResultsId)}SearchUi.DEFAULTS={inputElementId:"search-input",searchResultsId:"search-results",emptyResultsMessagePrefix:"No results found for",emptyResultsElementType:"p",emptyResultsElementClass:"search-empty",globalShortcutKey:"/",globalShortcutKeyCode:"Slash",globalShortcutKeyNumericCode:191};function isForwardSlash(e,t){return t.code===e.globalShortcutKeyCode||t.keyCode===e.globalShortcutKeyNumericCode}function isInput(e){return"input"===e.tagName.toLowerCase()}SearchUi.prototype.enableGlobalShortcut=function(){var e=this,t=this.doc,s=this.inputElement;t.body.addEventListener("keydown",function(l){isForwardSlash(e,l)&&!isInput(t.activeElement)&&(l.stopPropagation(),l.preventDefault(),s.focus(),s.select())},!1)},SearchUi.prototype.renderResults=function(e,t,s){if(e){if(this.inputElement.value=e,0===t.length)return createEmptyResultsMessage(this,e),this.inputElement.focus(),void this.inputElement.select();s(e,t,this.doc,this.resultsElement)}};function createEmptyResultsMessage(e,t){var s=e.doc.createElement(e.emptyResultsElementType),l=e.doc.createTextNode(e.emptyResultsMessagePrefix+' "'+t+'".'),n=e.resultsElement.parentElement;s.className=e.emptyResultsElementClass,s.appendChild(l),n.insertBefore(s,e.resultsElement)}
|
11
9
|
|
12
|
-
},{}],
|
13
|
-
(function (
|
14
|
-
|
10
|
+
},{"./merge-options":1}],4:[function(require,module,exports){
|
11
|
+
"use strict";var SearchEngine=require("./search-engine"),SearchUi=require("./search-ui");function writeResultsToList(e,t,n,r){t.forEach(function(e,t){var i=n.createElement("li"),c=n.createElement("a"),o=n.createTextNode(e.title);c.appendChild(o),c.title=e.title,c.href=e.url,i.appendChild(c),r.appendChild(i),c.tabindex=t,0===t&&c.focus()})}module.exports=function(){var e=new SearchUi(window.document,window.JEKYLL_PAGES_API_SEARCH_UI_OPTIONS),t=new SearchEngine(window.JEKYLL_PAGES_API_SEARCH_ENGINE_OPTIONS);if(e.enableGlobalShortcut(),e.resultsElement)return t.executeSearch(window.JEKYLL_PAGES_API_SEARCH_INDEX_URL,window.location.href).then(function(t){e.renderResults(t.query,t.results,window.renderJekyllPagesApiSearchResults||writeResultsToList)}).catch(function(e){console.error(e)})}();
|
12
|
+
|
13
|
+
},{"./search-engine":2,"./search-ui":3}],5:[function(require,module,exports){
|
14
|
+
!function(){var e=function(t){var r=new e.Builder;return r.pipeline.add(e.trimmer,e.stopWordFilter,e.stemmer),r.searchPipeline.add(e.stemmer),t.call(r,r),r.build()};e.version="2.1.5",e.utils={},e.utils.warn=(t=this,function(e){t.console&&console.warn&&console.warn(e)});var t;e.utils.asString=function(e){return void 0===e||null===e?"":e.toString()},e.FieldRef=function(e,t,r){this.docRef=e,this.fieldName=t,this._stringValue=r},e.FieldRef.joiner="/",e.FieldRef.fromString=function(t){var r=t.indexOf(e.FieldRef.joiner);if(-1===r)throw"malformed field ref string";var i=t.slice(0,r),n=t.slice(r+1);return new e.FieldRef(n,i,t)},e.FieldRef.prototype.toString=function(){return void 0==this._stringValue&&(this._stringValue=this.fieldName+e.FieldRef.joiner+this.docRef),this._stringValue},e.idf=function(e,t){var r=0;for(var i in e)"_index"!=i&&(r+=Object.keys(e[i]).length);var n=(t-r+.5)/(r+.5);return Math.log(1+Math.abs(n))},e.Token=function(e,t){this.str=e||"",this.metadata=t||{}},e.Token.prototype.toString=function(){return this.str},e.Token.prototype.update=function(e){return this.str=e(this.str,this.metadata),this},e.Token.prototype.clone=function(t){return t=t||function(e){return e},new e.Token(t(this.str,this.metadata),this.metadata)},e.tokenizer=function(t){if(null==t||void 0==t)return[];if(Array.isArray(t))return t.map(function(t){return new e.Token(e.utils.asString(t).toLowerCase())});for(var r=t.toString().trim().toLowerCase(),i=r.length,n=[],s=0,o=0;s<=i;s++){var a=s-o;(r.charAt(s).match(e.tokenizer.separator)||s==i)&&(a>0&&n.push(new e.Token(r.slice(o,s),{position:[o,a],index:n.length})),o=s+1)}return n},e.tokenizer.separator=/[\s\-]+/,e.Pipeline=function(){this._stack=[]},e.Pipeline.registeredFunctions=Object.create(null),e.Pipeline.registerFunction=function(t,r){r in this.registeredFunctions&&e.utils.warn("Overwriting existing registered function: "+r),t.label=r,e.Pipeline.registeredFunctions[t.label]=t},e.Pipeline.warnIfFunctionNotRegistered=function(t){t.label&&t.label in this.registeredFunctions||e.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",t)},e.Pipeline.load=function(t){var r=new e.Pipeline;return t.forEach(function(t){var i=e.Pipeline.registeredFunctions[t];if(!i)throw new Error("Cannot load unregistered function: "+t);r.add(i)}),r},e.Pipeline.prototype.add=function(){Array.prototype.slice.call(arguments).forEach(function(t){e.Pipeline.warnIfFunctionNotRegistered(t),this._stack.push(t)},this)},e.Pipeline.prototype.after=function(t,r){e.Pipeline.warnIfFunctionNotRegistered(r);var i=this._stack.indexOf(t);if(-1==i)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,r)},e.Pipeline.prototype.before=function(t,r){e.Pipeline.warnIfFunctionNotRegistered(r);var i=this._stack.indexOf(t);if(-1==i)throw new Error("Cannot find existingFn");this._stack.splice(i,0,r)},e.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);-1!=t&&this._stack.splice(t,1)},e.Pipeline.prototype.run=function(e){for(var t=this._stack.length,r=0;r<t;r++){var i=this._stack[r];e=e.reduce(function(t,r,n){var s=i(r,n,e);return void 0===s||""===s?t:t.concat(s)},[])}return e},e.Pipeline.prototype.runString=function(t){var r=new e.Token(t);return this.run([r]).map(function(e){return e.toString()})},e.Pipeline.prototype.reset=function(){this._stack=[]},e.Pipeline.prototype.toJSON=function(){return this._stack.map(function(t){return e.Pipeline.warnIfFunctionNotRegistered(t),t.label})},e.Vector=function(e){this._magnitude=0,this.elements=e||[]},e.Vector.prototype.positionForIndex=function(e){if(0==this.elements.length)return 0;for(var t=0,r=this.elements.length/2,i=r-t,n=Math.floor(i/2),s=this.elements[2*n];i>1&&(s<e&&(t=n),s>e&&(r=n),s!=e);)i=r-t,n=t+Math.floor(i/2),s=this.elements[2*n];return s==e?2*n:s>e?2*n:s<e?2*(n+1):void 0},e.Vector.prototype.insert=function(e,t){this.upsert(e,t,function(){throw"duplicate index"})},e.Vector.prototype.upsert=function(e,t,r){this._magnitude=0;var i=this.positionForIndex(e);this.elements[i]==e?this.elements[i+1]=r(this.elements[i+1],t):this.elements.splice(i,0,e,t)},e.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var e=0,t=this.elements.length,r=1;r<t;r+=2){var i=this.elements[r];e+=i*i}return this._magnitude=Math.sqrt(e)},e.Vector.prototype.dot=function(e){for(var t=0,r=this.elements,i=e.elements,n=r.length,s=i.length,o=0,a=0,u=0,l=0;u<n&&l<s;)(o=r[u])<(a=i[l])?u+=2:o>a?l+=2:o==a&&(t+=r[u+1]*i[l+1],u+=2,l+=2);return t},e.Vector.prototype.similarity=function(e){return this.dot(e)/(this.magnitude()*e.magnitude())},e.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),t=1,r=0;t<this.elements.length;t+=2,r++)e[r]=this.elements[t];return e},e.Vector.prototype.toJSON=function(){return this.elements},e.stemmer=function(){var e={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},t={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},r="[aeiouy]",i="[^aeiou][^aeiouy]*",n=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),s=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),o=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$"),a=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy]"),u=/^(.+?)(ss|i)es$/,l=/^(.+?)([^s])s$/,d=/^(.+?)eed$/,h=/^(.+?)(ed|ing)$/,c=/.$/,f=/(at|bl|iz)$/,p=new RegExp("([^aeiouylsz])\\1$"),y=new RegExp("^"+i+r+"[^aeiouwxy]$"),m=/^(.+?[^aeiou])y$/,g=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,v=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,x=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,w=/^(.+?)(s|t)(ion)$/,k=/^(.+?)e$/,Q=/ll$/,L=new RegExp("^"+i+r+"[^aeiouwxy]$"),T=function(r){var i,T,S,b,P,E,I;if(r.length<3)return r;if("y"==(S=r.substr(0,1))&&(r=S.toUpperCase()+r.substr(1)),P=l,(b=u).test(r)?r=r.replace(b,"$1$2"):P.test(r)&&(r=r.replace(P,"$1$2")),P=h,(b=d).test(r)){var O=b.exec(r);(b=n).test(O[1])&&(b=c,r=r.replace(b,""))}else if(P.test(r)){i=(O=P.exec(r))[1],(P=a).test(i)&&(E=p,I=y,(P=f).test(r=i)?r+="e":E.test(r)?(b=c,r=r.replace(b,"")):I.test(r)&&(r+="e"))}if((b=m).test(r)){r=(i=(O=b.exec(r))[1])+"i"}if((b=g).test(r)){i=(O=b.exec(r))[1],T=O[2],(b=n).test(i)&&(r=i+e[T])}if((b=v).test(r)){i=(O=b.exec(r))[1],T=O[2],(b=n).test(i)&&(r=i+t[T])}if(P=w,(b=x).test(r)){i=(O=b.exec(r))[1],(b=s).test(i)&&(r=i)}else if(P.test(r)){i=(O=P.exec(r))[1]+O[2],(P=s).test(i)&&(r=i)}if((b=k).test(r)){i=(O=b.exec(r))[1],P=o,E=L,((b=s).test(i)||P.test(i)&&!E.test(i))&&(r=i)}return P=s,(b=Q).test(r)&&P.test(r)&&(b=c,r=r.replace(b,"")),"y"==S&&(r=S.toLowerCase()+r.substr(1)),r};return function(e){return e.update(T)}}(),e.Pipeline.registerFunction(e.stemmer,"stemmer"),e.generateStopWordFilter=function(e){var t=e.reduce(function(e,t){return e[t]=t,e},{});return function(e){if(e&&t[e.toString()]!==e.toString())return e}},e.stopWordFilter=e.generateStopWordFilter(["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]),e.Pipeline.registerFunction(e.stopWordFilter,"stopWordFilter"),e.trimmer=function(e){return e.update(function(e){return e.replace(/^\W+/,"").replace(/\W+$/,"")})},e.Pipeline.registerFunction(e.trimmer,"trimmer"),e.TokenSet=function(){this.final=!1,this.edges={},this.id=e.TokenSet._nextId,e.TokenSet._nextId+=1},e.TokenSet._nextId=1,e.TokenSet.fromArray=function(t){for(var r=new e.TokenSet.Builder,i=0,n=t.length;i<n;i++)r.insert(t[i]);return r.finish(),r.root},e.TokenSet.fromClause=function(t){return"editDistance"in t?e.TokenSet.fromFuzzyString(t.term,t.editDistance):e.TokenSet.fromString(t.term)},e.TokenSet.fromFuzzyString=function(t,r){for(var i=new e.TokenSet,n=[{node:i,editsRemaining:r,str:t}];n.length;){var s=n.pop();if(s.str.length>0){var o;(a=s.str.charAt(0))in s.node.edges?o=s.node.edges[a]:(o=new e.TokenSet,s.node.edges[a]=o),1==s.str.length?o.final=!0:n.push({node:o,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining>0&&s.str.length>1){var a,u;(a=s.str.charAt(1))in s.node.edges?u=s.node.edges[a]:(u=new e.TokenSet,s.node.edges[a]=u),s.str.length<=2?u.final=!0:n.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(2)})}if(s.editsRemaining>0&&1==s.str.length&&(s.node.final=!0),s.editsRemaining>0&&s.str.length>=1){if("*"in s.node.edges)var l=s.node.edges["*"];else{l=new e.TokenSet;s.node.edges["*"]=l}1==s.str.length?l.final=!0:n.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.editsRemaining>0){if("*"in s.node.edges)var d=s.node.edges["*"];else{d=new e.TokenSet;s.node.edges["*"]=d}0==s.str.length?d.final=!0:n.push({node:d,editsRemaining:s.editsRemaining-1,str:s.str})}if(s.editsRemaining>0&&s.str.length>1){var h,c=s.str.charAt(0),f=s.str.charAt(1);f in s.node.edges?h=s.node.edges[f]:(h=new e.TokenSet,s.node.edges[f]=h),1==s.str.length?h.final=!0:n.push({node:h,editsRemaining:s.editsRemaining-1,str:c+s.str.slice(2)})}}return i},e.TokenSet.fromString=function(t){for(var r=new e.TokenSet,i=r,n=!1,s=0,o=t.length;s<o;s++){var a=t[s],u=s==o-1;if("*"==a)n=!0,r.edges[a]=r,r.final=u;else{var l=new e.TokenSet;l.final=u,r.edges[a]=l,r=l,n&&(r.edges["*"]=i)}}return i},e.TokenSet.prototype.toArray=function(){for(var e=[],t=[{prefix:"",node:this}];t.length;){var r=t.pop(),i=Object.keys(r.node.edges),n=i.length;r.node.final&&e.push(r.prefix);for(var s=0;s<n;s++){var o=i[s];t.push({prefix:r.prefix.concat(o),node:r.node.edges[o]})}}return e},e.TokenSet.prototype.toString=function(){if(this._str)return this._str;for(var e=this.final?"1":"0",t=Object.keys(this.edges).sort(),r=t.length,i=0;i<r;i++){var n=t[i];e=e+n+this.edges[n].id}return e},e.TokenSet.prototype.intersect=function(t){for(var r=new e.TokenSet,i=void 0,n=[{qNode:t,output:r,node:this}];n.length;){i=n.pop();for(var s=Object.keys(i.qNode.edges),o=s.length,a=Object.keys(i.node.edges),u=a.length,l=0;l<o;l++)for(var d=s[l],h=0;h<u;h++){var c=a[h];if(c==d||"*"==d){var f=i.node.edges[c],p=i.qNode.edges[d],y=f.final&&p.final,m=void 0;c in i.output.edges?(m=i.output.edges[c]).final=m.final||y:((m=new e.TokenSet).final=y,i.output.edges[c]=m),n.push({qNode:p,output:m,node:f})}}}return r},e.TokenSet.Builder=function(){this.previousWord="",this.root=new e.TokenSet,this.uncheckedNodes=[],this.minimizedNodes={}},e.TokenSet.Builder.prototype.insert=function(t){var r,i=0;if(t<this.previousWord)throw new Error("Out of order word insertion");for(var n=0;n<t.length&&n<this.previousWord.length&&t[n]==this.previousWord[n];n++)i++;this.minimize(i),r=0==this.uncheckedNodes.length?this.root:this.uncheckedNodes[this.uncheckedNodes.length-1].child;for(n=i;n<t.length;n++){var s=new e.TokenSet,o=t[n];r.edges[o]=s,this.uncheckedNodes.push({parent:r,char:o,child:s}),r=s}r.final=!0,this.previousWord=t},e.TokenSet.Builder.prototype.finish=function(){this.minimize(0)},e.TokenSet.Builder.prototype.minimize=function(e){for(var t=this.uncheckedNodes.length-1;t>=e;t--){var r=this.uncheckedNodes[t],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}},e.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},e.Index.prototype.search=function(t){return this.query(function(r){new e.QueryParser(t,r).parse()})},e.Index.prototype.query=function(t){var r=new e.Query(this.fields),i=Object.create(null),n=Object.create(null),s=Object.create(null);t.call(r,r);for(var o=0;o<r.clauses.length;o++){var a=r.clauses[o],u=null;u=a.usePipeline?this.pipeline.runString(a.term):[a.term];for(var l=0;l<u.length;l++){var d=u[l];a.term=d;for(var h=e.TokenSet.fromClause(a),c=this.tokenSet.intersect(h).toArray(),f=0;f<c.length;f++)for(var p=c[f],y=this.invertedIndex[p],m=y._index,g=0;g<a.fields.length;g++){var v=a.fields[g],x=y[v],w=Object.keys(x),k=p+"/"+v;if(void 0===n[v]&&(n[v]=new e.Vector),n[v].upsert(m,1*a.boost,function(e,t){return e+t}),!s[k]){for(var Q=0;Q<w.length;Q++){var L,T=w[Q],S=new e.FieldRef(T,v),b=x[T];void 0===(L=i[S])?i[S]=new e.MatchData(p,v,b):L.add(p,v,b)}s[k]=!0}}}}var P=Object.keys(i),E=[],I=Object.create(null);for(o=0;o<P.length;o++){var O,F=e.FieldRef.fromString(P[o]),R=F.docRef,_=this.fieldVectors[F],N=n[F.fieldName].similarity(_);if(void 0!==(O=I[R]))O.score+=N,O.matchData.combine(i[F]);else{var C={ref:R,score:N,matchData:i[F]};I[R]=C,E.push(C)}}return E.sort(function(e,t){return t.score-e.score})},e.Index.prototype.toJSON=function(){var t=Object.keys(this.invertedIndex).sort().map(function(e){return[e,this.invertedIndex[e]]},this),r=Object.keys(this.fieldVectors).map(function(e){return[e,this.fieldVectors[e].toJSON()]},this);return{version:e.version,fields:this.fields,fieldVectors:r,invertedIndex:t,pipeline:this.pipeline.toJSON()}},e.Index.load=function(t){var r={},i={},n=t.fieldVectors,s={},o=t.invertedIndex,a=new e.TokenSet.Builder,u=e.Pipeline.load(t.pipeline);t.version!=e.version&&e.utils.warn("Version mismatch when loading serialised index. Current version of lunr '"+e.version+"' does not match serialized index '"+t.version+"'");for(var l=0;l<n.length;l++){var d=(c=n[l])[0],h=c[1];i[d]=new e.Vector(h)}for(l=0;l<o.length;l++){var c,f=(c=o[l])[0],p=c[1];a.insert(f),s[f]=p}return a.finish(),r.fields=t.fields,r.fieldVectors=i,r.invertedIndex=s,r.tokenSet=a.root,r.pipeline=u,new e.Index(r)},e.Builder=function(){this._ref="id",this._fields=[],this.invertedIndex=Object.create(null),this.fieldTermFrequencies={},this.fieldLengths={},this.tokenizer=e.tokenizer,this.pipeline=new e.Pipeline,this.searchPipeline=new e.Pipeline,this.documentCount=0,this._b=.75,this._k1=1.2,this.termIndex=0,this.metadataWhitelist=[]},e.Builder.prototype.ref=function(e){this._ref=e},e.Builder.prototype.field=function(e){this._fields.push(e)},e.Builder.prototype.b=function(e){this._b=e<0?0:e>1?1:e},e.Builder.prototype.k1=function(e){this._k1=e},e.Builder.prototype.add=function(t){var r=t[this._ref];this.documentCount+=1;for(var i=0;i<this._fields.length;i++){var n=this._fields[i],s=t[n],o=this.tokenizer(s),a=this.pipeline.run(o),u=new e.FieldRef(r,n),l=Object.create(null);this.fieldTermFrequencies[u]=l,this.fieldLengths[u]=0,this.fieldLengths[u]+=a.length;for(var d=0;d<a.length;d++){var h=a[d];if(void 0==l[h]&&(l[h]=0),l[h]+=1,void 0==this.invertedIndex[h]){var c=Object.create(null);c._index=this.termIndex,this.termIndex+=1;for(var f=0;f<this._fields.length;f++)c[this._fields[f]]=Object.create(null);this.invertedIndex[h]=c}void 0==this.invertedIndex[h][n][r]&&(this.invertedIndex[h][n][r]=Object.create(null));for(var p=0;p<this.metadataWhitelist.length;p++){var y=this.metadataWhitelist[p],m=h.metadata[y];void 0==this.invertedIndex[h][n][r][y]&&(this.invertedIndex[h][n][r][y]=[]),this.invertedIndex[h][n][r][y].push(m)}}}},e.Builder.prototype.calculateAverageFieldLengths=function(){for(var t=Object.keys(this.fieldLengths),r=t.length,i={},n={},s=0;s<r;s++){var o=e.FieldRef.fromString(t[s]);n[a=o.fieldName]||(n[a]=0),n[a]+=1,i[a]||(i[a]=0),i[a]+=this.fieldLengths[o]}for(s=0;s<this._fields.length;s++){var a;i[a=this._fields[s]]=i[a]/n[a]}this.averageFieldLength=i},e.Builder.prototype.createFieldVectors=function(){for(var t={},r=Object.keys(this.fieldTermFrequencies),i=r.length,n=Object.create(null),s=0;s<i;s++){for(var o=e.FieldRef.fromString(r[s]),a=o.fieldName,u=this.fieldLengths[o],l=new e.Vector,d=this.fieldTermFrequencies[o],h=Object.keys(d),c=h.length,f=0;f<c;f++){var p,y,m,g=h[f],v=d[g],x=this.invertedIndex[g]._index;void 0===n[g]?(p=e.idf(this.invertedIndex[g],this.documentCount),n[g]=p):p=n[g],y=p*((this._k1+1)*v)/(this._k1*(1-this._b+this._b*(u/this.averageFieldLength[a]))+v),m=Math.round(1e3*y)/1e3,l.insert(x,m)}t[o]=l}this.fieldVectors=t},e.Builder.prototype.createTokenSet=function(){this.tokenSet=e.TokenSet.fromArray(Object.keys(this.invertedIndex).sort())},e.Builder.prototype.build=function(){return this.calculateAverageFieldLengths(),this.createFieldVectors(),this.createTokenSet(),new e.Index({invertedIndex:this.invertedIndex,fieldVectors:this.fieldVectors,tokenSet:this.tokenSet,fields:this._fields,pipeline:this.searchPipeline})},e.Builder.prototype.use=function(e){var t=Array.prototype.slice.call(arguments,1);t.unshift(this),e.apply(this,t)},e.MatchData=function(e,t,r){for(var i=Object.create(null),n=Object.keys(r),s=0;s<n.length;s++){var o=n[s];i[o]=r[o].slice()}this.metadata=Object.create(null),this.metadata[e]=Object.create(null),this.metadata[e][t]=i},e.MatchData.prototype.combine=function(e){for(var t=Object.keys(e.metadata),r=0;r<t.length;r++){var i=t[r],n=Object.keys(e.metadata[i]);void 0==this.metadata[i]&&(this.metadata[i]=Object.create(null));for(var s=0;s<n.length;s++){var o=n[s],a=Object.keys(e.metadata[i][o]);void 0==this.metadata[i][o]&&(this.metadata[i][o]=Object.create(null));for(var u=0;u<a.length;u++){var l=a[u];void 0==this.metadata[i][o][l]?this.metadata[i][o][l]=e.metadata[i][o][l]:this.metadata[i][o][l]=this.metadata[i][o][l].concat(e.metadata[i][o][l])}}}},e.MatchData.prototype.add=function(e,t,r){if(!(e in this.metadata))return this.metadata[e]=Object.create(null),void(this.metadata[e][t]=r);if(t in this.metadata[e])for(var i=Object.keys(r),n=0;n<i.length;n++){var s=i[n];s in this.metadata[e][t]?this.metadata[e][t][s]=this.metadata[e][t][s].concat(r[s]):this.metadata[e][t][s]=r[s]}else this.metadata[e][t]=r},e.Query=function(e){this.clauses=[],this.allFields=e},e.Query.wildcard=new String("*"),e.Query.wildcard.NONE=0,e.Query.wildcard.LEADING=1,e.Query.wildcard.TRAILING=2,e.Query.prototype.clause=function(t){return"fields"in t||(t.fields=this.allFields),"boost"in t||(t.boost=1),"usePipeline"in t||(t.usePipeline=!0),"wildcard"in t||(t.wildcard=e.Query.wildcard.NONE),t.wildcard&e.Query.wildcard.LEADING&&t.term.charAt(0)!=e.Query.wildcard&&(t.term="*"+t.term),t.wildcard&e.Query.wildcard.TRAILING&&t.term.slice(-1)!=e.Query.wildcard&&(t.term=t.term+"*"),this.clauses.push(t),this},e.Query.prototype.term=function(e,t){var r=t||{};return r.term=e,this.clause(r),this},e.QueryParseError=function(e,t,r){this.name="QueryParseError",this.message=e,this.start=t,this.end=r},e.QueryParseError.prototype=new Error,e.QueryLexer=function(e){this.lexemes=[],this.str=e,this.length=e.length,this.pos=0,this.start=0,this.escapeCharPositions=[]},e.QueryLexer.prototype.run=function(){for(var t=e.QueryLexer.lexText;t;)t=t(this)},e.QueryLexer.prototype.sliceString=function(){for(var e=[],t=this.start,r=this.pos,i=0;i<this.escapeCharPositions.length;i++)r=this.escapeCharPositions[i],e.push(this.str.slice(t,r)),t=r+1;return e.push(this.str.slice(t,this.pos)),this.escapeCharPositions.length=0,e.join("")},e.QueryLexer.prototype.emit=function(e){this.lexemes.push({type:e,str:this.sliceString(),start:this.start,end:this.pos}),this.start=this.pos},e.QueryLexer.prototype.escapeCharacter=function(){this.escapeCharPositions.push(this.pos-1),this.pos+=1},e.QueryLexer.prototype.next=function(){if(this.pos>=this.length)return e.QueryLexer.EOS;var t=this.str.charAt(this.pos);return this.pos+=1,t},e.QueryLexer.prototype.width=function(){return this.pos-this.start},e.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},e.QueryLexer.prototype.backup=function(){this.pos-=1},e.QueryLexer.prototype.acceptDigitRun=function(){var t,r;do{r=(t=this.next()).charCodeAt(0)}while(r>47&&r<58);t!=e.QueryLexer.EOS&&this.backup()},e.QueryLexer.prototype.more=function(){return this.pos<this.length},e.QueryLexer.EOS="EOS",e.QueryLexer.FIELD="FIELD",e.QueryLexer.TERM="TERM",e.QueryLexer.EDIT_DISTANCE="EDIT_DISTANCE",e.QueryLexer.BOOST="BOOST",e.QueryLexer.lexField=function(t){return t.backup(),t.emit(e.QueryLexer.FIELD),t.ignore(),e.QueryLexer.lexText},e.QueryLexer.lexTerm=function(t){if(t.width()>1&&(t.backup(),t.emit(e.QueryLexer.TERM)),t.ignore(),t.more())return e.QueryLexer.lexText},e.QueryLexer.lexEditDistance=function(t){return t.ignore(),t.acceptDigitRun(),t.emit(e.QueryLexer.EDIT_DISTANCE),e.QueryLexer.lexText},e.QueryLexer.lexBoost=function(t){return t.ignore(),t.acceptDigitRun(),t.emit(e.QueryLexer.BOOST),e.QueryLexer.lexText},e.QueryLexer.lexEOS=function(t){t.width()>0&&t.emit(e.QueryLexer.TERM)},e.QueryLexer.termSeparator=e.tokenizer.separator,e.QueryLexer.lexText=function(t){for(;;){var r=t.next();if(r==e.QueryLexer.EOS)return e.QueryLexer.lexEOS;if(92!=r.charCodeAt(0)){if(":"==r)return e.QueryLexer.lexField;if("~"==r)return t.backup(),t.width()>0&&t.emit(e.QueryLexer.TERM),e.QueryLexer.lexEditDistance;if("^"==r)return t.backup(),t.width()>0&&t.emit(e.QueryLexer.TERM),e.QueryLexer.lexBoost;if(r.match(e.QueryLexer.termSeparator))return e.QueryLexer.lexTerm}else t.escapeCharacter()}},e.QueryParser=function(t,r){this.lexer=new e.QueryLexer(t),this.query=r,this.currentClause={},this.lexemeIdx=0},e.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var t=e.QueryParser.parseFieldOrTerm;t;)t=t(this);return this.query},e.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},e.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},e.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},e.QueryParser.parseFieldOrTerm=function(t){var r=t.peekLexeme();if(void 0!=r)switch(r.type){case e.QueryLexer.FIELD:return e.QueryParser.parseField;case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var i="expected either a field or a term, found "+r.type;throw r.str.length>=1&&(i+=" with value '"+r.str+"'"),new e.QueryParseError(i,r.start,r.end)}},e.QueryParser.parseField=function(t){var r=t.consumeLexeme();if(void 0!=r){if(-1==t.query.allFields.indexOf(r.str)){var i=t.query.allFields.map(function(e){return"'"+e+"'"}).join(", "),n="unrecognised field '"+r.str+"', possible fields: "+i;throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.fields=[r.str];var s=t.peekLexeme();if(void 0==s){n="expecting term, found nothing";throw new e.QueryParseError(n,r.start,r.end)}switch(s.type){case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:n="expecting term, found '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}}},e.QueryParser.parseTerm=function(t){var r=t.consumeLexeme();if(void 0!=r){t.currentClause.term=r.str.toLowerCase(),-1!=r.str.indexOf("*")&&(t.currentClause.usePipeline=!1);var i=t.peekLexeme();if(void 0!=i)switch(i.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;default:var n="Unexpected lexeme type '"+i.type+"'";throw new e.QueryParseError(n,i.start,i.end)}else t.nextClause()}},e.QueryParser.parseEditDistance=function(t){var r=t.consumeLexeme();if(void 0!=r){var i=parseInt(r.str,10);if(isNaN(i)){var n="edit distance must be numeric";throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.editDistance=i;var s=t.peekLexeme();if(void 0!=s)switch(s.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;default:n="Unexpected lexeme type '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}else t.nextClause()}},e.QueryParser.parseBoost=function(t){var r=t.consumeLexeme();if(void 0!=r){var i=parseInt(r.str,10);if(isNaN(i)){var n="boost must be numeric";throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.boost=i;var s=t.peekLexeme();if(void 0!=s)switch(s.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;default:n="Unexpected lexeme type '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}else t.nextClause()}},r=this,i=function(){return e},"function"==typeof define&&define.amd?define(i):"object"==typeof exports?module.exports=i():r.lunr=i();var r,i}();
|
15
15
|
|
16
|
-
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
17
16
|
},{}],6:[function(require,module,exports){
|
18
|
-
|
17
|
+
(function (global){
|
18
|
+
!function(e){var o="object"==typeof exports&&exports&&!exports.nodeType&&exports,n="object"==typeof module&&module&&!module.nodeType&&module,r="object"==typeof global&&global;r.global!==r&&r.window!==r&&r.self!==r||(e=r);var t,u,i=2147483647,f=36,c=1,l=26,s=38,d=700,a=72,p=128,h="-",v=/^xn--/,g=/[^\x20-\x7E]/,w=/[\x2E\u3002\uFF0E\uFF61]/g,x={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},b=f-c,y=Math.floor,C=String.fromCharCode;function m(e){throw new RangeError(x[e])}function j(e,o){for(var n=e.length,r=[];n--;)r[n]=o(e[n]);return r}function A(e,o){var n=e.split("@"),r="";n.length>1&&(r=n[0]+"@",e=n[1]);return r+j((e=e.replace(w,".")).split("."),o).join(".")}function I(e){for(var o,n,r=[],t=0,u=e.length;t<u;)(o=e.charCodeAt(t++))>=55296&&o<=56319&&t<u?56320==(64512&(n=e.charCodeAt(t++)))?r.push(((1023&o)<<10)+(1023&n)+65536):(r.push(o),t--):r.push(o);return r}function E(e){return j(e,function(e){var o="";return e>65535&&(o+=C((e-=65536)>>>10&1023|55296),e=56320|1023&e),o+=C(e)}).join("")}function F(e,o){return e+22+75*(e<26)-((0!=o)<<5)}function O(e,o,n){var r=0;for(e=n?y(e/d):e>>1,e+=y(e/o);e>b*l>>1;r+=f)e=y(e/b);return y(r+(b+1)*e/(e+s))}function S(e){var o,n,r,t,u,s,d,v,g,w,x=[],b=e.length,C=0,j=p,A=a;for((n=e.lastIndexOf(h))<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&m("not-basic"),x.push(e.charCodeAt(r));for(t=n>0?n+1:0;t<b;){for(u=C,s=1,d=f;t>=b&&m("invalid-input"),((v=(I=e.charCodeAt(t++))-48<10?I-22:I-65<26?I-65:I-97<26?I-97:f)>=f||v>y((i-C)/s))&&m("overflow"),C+=v*s,!(v<(g=d<=A?c:d>=A+l?l:d-A));d+=f)s>y(i/(w=f-g))&&m("overflow"),s*=w;A=O(C-u,o=x.length+1,0==u),y(C/o)>i-j&&m("overflow"),j+=y(C/o),C%=o,x.splice(C++,0,j)}var I;return E(x)}function T(e){var o,n,r,t,u,s,d,v,g,w,x,b,j,A,E,S=[];for(b=(e=I(e)).length,o=p,n=0,u=a,s=0;s<b;++s)(x=e[s])<128&&S.push(C(x));for(r=t=S.length,t&&S.push(h);r<b;){for(d=i,s=0;s<b;++s)(x=e[s])>=o&&x<d&&(d=x);for(d-o>y((i-n)/(j=r+1))&&m("overflow"),n+=(d-o)*j,o=d,s=0;s<b;++s)if((x=e[s])<o&&++n>i&&m("overflow"),x==o){for(v=n,g=f;!(v<(w=g<=u?c:g>=u+l?l:g-u));g+=f)E=v-w,A=f-w,S.push(C(F(w+E%A,0))),v=y(E/A);S.push(C(F(v,0))),u=O(n,j,r==t),n=0,++r}++n,++o}return S.join("")}if(t={version:"1.4.1",ucs2:{decode:I,encode:E},decode:S,encode:T,toASCII:function(e){return A(e,function(e){return g.test(e)?"xn--"+T(e):e})},toUnicode:function(e){return A(e,function(e){return v.test(e)?S(e.slice(4).toLowerCase()):e})}},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return t});else if(o&&n)if(module.exports==o)n.exports=t;else for(u in t)t.hasOwnProperty(u)&&(o[u]=t[u]);else e.punycode=t}(this);
|
19
19
|
|
20
|
+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
20
21
|
},{}],7:[function(require,module,exports){
|
21
|
-
"use strict";function
|
22
|
+
"use strict";function hasOwnProperty(r,e){return Object.prototype.hasOwnProperty.call(r,e)}module.exports=function(r,e,t,n){e=e||"&",t=t||"=";var o={};if("string"!=typeof r||0===r.length)return o;var a=/\+/g;r=r.split(e);var s=1e3;n&&"number"==typeof n.maxKeys&&(s=n.maxKeys);var p=r.length;s>0&&p>s&&(p=s);for(var y=0;y<p;++y){var u,c,i,l,f=r[y].replace(a,"%20"),v=f.indexOf(t);v>=0?(u=f.substr(0,v),c=f.substr(v+1)):(u=f,c=""),i=decodeURIComponent(u),l=decodeURIComponent(c),hasOwnProperty(o,i)?isArray(o[i])?o[i].push(l):o[i]=[o[i],l]:o[i]=l}return o};var isArray=Array.isArray||function(r){return"[object Array]"===Object.prototype.toString.call(r)};
|
22
23
|
|
23
24
|
},{}],8:[function(require,module,exports){
|
25
|
+
"use strict";var stringifyPrimitive=function(r){switch(typeof r){case"string":return r;case"boolean":return r?"true":"false";case"number":return isFinite(r)?r:"";default:return""}};module.exports=function(r,e,t,n){return e=e||"&",t=t||"=",null===r&&(r=void 0),"object"==typeof r?map(objectKeys(r),function(n){var i=encodeURIComponent(stringifyPrimitive(n))+t;return isArray(r[n])?map(r[n],function(r){return i+encodeURIComponent(stringifyPrimitive(r))}).join(e):i+encodeURIComponent(stringifyPrimitive(r[n]))}).join(e):n?encodeURIComponent(stringifyPrimitive(n))+t+encodeURIComponent(stringifyPrimitive(r)):""};var isArray=Array.isArray||function(r){return"[object Array]"===Object.prototype.toString.call(r)};function map(r,e){if(r.map)return r.map(e);for(var t=[],n=0;n<r.length;n++)t.push(e(r[n],n));return t}var objectKeys=Object.keys||function(r){var e=[];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.push(t);return e};
|
26
|
+
|
27
|
+
},{}],9:[function(require,module,exports){
|
24
28
|
"use strict";exports.decode=exports.parse=require("./decode"),exports.encode=exports.stringify=require("./encode");
|
25
29
|
|
26
|
-
},{"./decode":
|
27
|
-
function Url(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}
|
30
|
+
},{"./decode":7,"./encode":8}],10:[function(require,module,exports){
|
31
|
+
"use strict";var punycode=require("punycode"),util=require("./util");exports.parse=urlParse,exports.resolve=urlResolve,exports.resolveObject=urlResolveObject,exports.format=urlFormat,exports.Url=Url;function Url(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var protocolPattern=/^([a-z0-9.+-]+:)/i,portPattern=/:[0-9]*$/,simplePathPattern=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,delims=["<",">",'"',"`"," ","\r","\n","\t"],unwise=["{","}","|","\\","^","`"].concat(delims),autoEscape=["'"].concat(unwise),nonHostChars=["%","/","?",";","#"].concat(autoEscape),hostEndingChars=["/","?","#"],hostnameMaxLen=255,hostnamePartPattern=/^[+a-z0-9A-Z_-]{0,63}$/,hostnamePartStart=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,unsafeProtocol={javascript:!0,"javascript:":!0},hostlessProtocol={javascript:!0,"javascript:":!0},slashedProtocol={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},querystring=require("querystring");function urlParse(t,s,e){if(t&&util.isObject(t)&&t instanceof Url)return t;var h=new Url;return h.parse(t,s,e),h}Url.prototype.parse=function(t,s,e){if(!util.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var h=t.indexOf("?"),r=-1!==h&&h<t.indexOf("#")?"?":"#",a=t.split(r);a[0]=a[0].replace(/\\/g,"/");var o=t=a.join(r);if(o=o.trim(),!e&&1===t.split("#").length){var n=simplePathPattern.exec(o);if(n)return this.path=o,this.href=o,this.pathname=n[1],n[2]?(this.search=n[2],this.query=s?querystring.parse(this.search.substr(1)):this.search.substr(1)):s&&(this.search="",this.query={}),this}var i=protocolPattern.exec(o);if(i){var l=(i=i[0]).toLowerCase();this.protocol=l,o=o.substr(i.length)}if(e||i||o.match(/^\/\/[^@\/]+@[^@\/]+/)){var u="//"===o.substr(0,2);!u||i&&hostlessProtocol[i]||(o=o.substr(2),this.slashes=!0)}if(!hostlessProtocol[i]&&(u||i&&!slashedProtocol[i])){for(var p=-1,c=0;c<hostEndingChars.length;c++){-1!==(v=o.indexOf(hostEndingChars[c]))&&(-1===p||v<p)&&(p=v)}var f,m;-1!==(m=-1===p?o.lastIndexOf("@"):o.lastIndexOf("@",p))&&(f=o.slice(0,m),o=o.slice(m+1),this.auth=decodeURIComponent(f)),p=-1;for(c=0;c<nonHostChars.length;c++){var v;-1!==(v=o.indexOf(nonHostChars[c]))&&(-1===p||v<p)&&(p=v)}-1===p&&(p=o.length),this.host=o.slice(0,p),o=o.slice(p),this.parseHost(),this.hostname=this.hostname||"";var g="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!g)for(var y=this.hostname.split(/\./),P=(c=0,y.length);c<P;c++){var d=y[c];if(d&&!d.match(hostnamePartPattern)){for(var b="",q=0,O=d.length;q<O;q++)d.charCodeAt(q)>127?b+="x":b+=d[q];if(!b.match(hostnamePartPattern)){var j=y.slice(0,c),x=y.slice(c+1),U=d.match(hostnamePartStart);U&&(j.push(U[1]),x.unshift(U[2])),x.length&&(o="/"+x.join(".")+o),this.hostname=j.join(".");break}}}this.hostname.length>hostnameMaxLen?this.hostname="":this.hostname=this.hostname.toLowerCase(),g||(this.hostname=punycode.toASCII(this.hostname));var C=this.port?":"+this.port:"",A=this.hostname||"";this.host=A+C,this.href+=this.host,g&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==o[0]&&(o="/"+o))}if(!unsafeProtocol[l])for(c=0,P=autoEscape.length;c<P;c++){var w=autoEscape[c];if(-1!==o.indexOf(w)){var E=encodeURIComponent(w);E===w&&(E=escape(w)),o=o.split(w).join(E)}}var I=o.indexOf("#");-1!==I&&(this.hash=o.substr(I),o=o.slice(0,I));var R=o.indexOf("?");if(-1!==R?(this.search=o.substr(R),this.query=o.substr(R+1),s&&(this.query=querystring.parse(this.query)),o=o.slice(0,R)):s&&(this.search="",this.query={}),o&&(this.pathname=o),slashedProtocol[l]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){C=this.pathname||"";var S=this.search||"";this.path=C+S}return this.href=this.format(),this};function urlFormat(t){return util.isString(t)&&(t=urlParse(t)),t instanceof Url?t.format():Url.prototype.format.call(t)}Url.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var s=this.protocol||"",e=this.pathname||"",h=this.hash||"",r=!1,a="";this.host?r=t+this.host:this.hostname&&(r=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(r+=":"+this.port)),this.query&&util.isObject(this.query)&&Object.keys(this.query).length&&(a=querystring.stringify(this.query));var o=this.search||a&&"?"+a||"";return s&&":"!==s.substr(-1)&&(s+=":"),this.slashes||(!s||slashedProtocol[s])&&!1!==r?(r="//"+(r||""),e&&"/"!==e.charAt(0)&&(e="/"+e)):r||(r=""),h&&"#"!==h.charAt(0)&&(h="#"+h),o&&"?"!==o.charAt(0)&&(o="?"+o),s+r+(e=e.replace(/[?#]/g,function(t){return encodeURIComponent(t)}))+(o=o.replace("#","%23"))+h};function urlResolve(t,s){return urlParse(t,!1,!0).resolve(s)}Url.prototype.resolve=function(t){return this.resolveObject(urlParse(t,!1,!0)).format()};function urlResolveObject(t,s){return t?urlParse(t,!1,!0).resolveObject(s):s}Url.prototype.resolveObject=function(t){if(util.isString(t)){var s=new Url;s.parse(t,!1,!0),t=s}for(var e=new Url,h=Object.keys(this),r=0;r<h.length;r++){var a=h[r];e[a]=this[a]}if(e.hash=t.hash,""===t.href)return e.href=e.format(),e;if(t.slashes&&!t.protocol){for(var o=Object.keys(t),n=0;n<o.length;n++){var i=o[n];"protocol"!==i&&(e[i]=t[i])}return slashedProtocol[e.protocol]&&e.hostname&&!e.pathname&&(e.path=e.pathname="/"),e.href=e.format(),e}if(t.protocol&&t.protocol!==e.protocol){if(!slashedProtocol[t.protocol]){for(var l=Object.keys(t),u=0;u<l.length;u++){var p=l[u];e[p]=t[p]}return e.href=e.format(),e}if(e.protocol=t.protocol,t.host||hostlessProtocol[t.protocol])e.pathname=t.pathname;else{for(var c=(t.pathname||"").split("/");c.length&&!(t.host=c.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==c[0]&&c.unshift(""),c.length<2&&c.unshift(""),e.pathname=c.join("/")}if(e.search=t.search,e.query=t.query,e.host=t.host||"",e.auth=t.auth,e.hostname=t.hostname||t.host,e.port=t.port,e.pathname||e.search){var f=e.pathname||"",m=e.search||"";e.path=f+m}return e.slashes=e.slashes||t.slashes,e.href=e.format(),e}var v=e.pathname&&"/"===e.pathname.charAt(0),g=t.host||t.pathname&&"/"===t.pathname.charAt(0),y=g||v||e.host&&t.pathname,P=y,d=e.pathname&&e.pathname.split("/")||[],b=(c=t.pathname&&t.pathname.split("/")||[],e.protocol&&!slashedProtocol[e.protocol]);if(b&&(e.hostname="",e.port=null,e.host&&(""===d[0]?d[0]=e.host:d.unshift(e.host)),e.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===c[0]?c[0]=t.host:c.unshift(t.host)),t.host=null),y=y&&(""===c[0]||""===d[0])),g)e.host=t.host||""===t.host?t.host:e.host,e.hostname=t.hostname||""===t.hostname?t.hostname:e.hostname,e.search=t.search,e.query=t.query,d=c;else if(c.length)d||(d=[]),d.pop(),d=d.concat(c),e.search=t.search,e.query=t.query;else if(!util.isNullOrUndefined(t.search)){if(b){e.hostname=e.host=d.shift();(C=!!(e.host&&e.host.indexOf("@")>0)&&e.host.split("@"))&&(e.auth=C.shift(),e.host=e.hostname=C.shift())}return e.search=t.search,e.query=t.query,util.isNull(e.pathname)&&util.isNull(e.search)||(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!d.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var q=d.slice(-1)[0],O=(e.host||t.host||d.length>1)&&("."===q||".."===q)||""===q,j=0,x=d.length;x>=0;x--)"."===(q=d[x])?d.splice(x,1):".."===q?(d.splice(x,1),j++):j&&(d.splice(x,1),j--);if(!y&&!P)for(;j--;j)d.unshift("..");!y||""===d[0]||d[0]&&"/"===d[0].charAt(0)||d.unshift(""),O&&"/"!==d.join("/").substr(-1)&&d.push("");var U=""===d[0]||d[0]&&"/"===d[0].charAt(0);if(b){e.hostname=e.host=U?"":d.length?d.shift():"";var C;(C=!!(e.host&&e.host.indexOf("@")>0)&&e.host.split("@"))&&(e.auth=C.shift(),e.host=e.hostname=C.shift())}return(y=y||e.host&&d.length)&&!U&&d.unshift(""),d.length?e.pathname=d.join("/"):(e.pathname=null,e.path=null),util.isNull(e.pathname)&&util.isNull(e.search)||(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=t.auth||e.auth,e.slashes=e.slashes||t.slashes,e.href=e.format(),e},Url.prototype.parseHost=function(){var t=this.host,s=portPattern.exec(t);s&&(":"!==(s=s[0])&&(this.port=s.substr(1)),t=t.substr(0,t.length-s.length)),t&&(this.hostname=t)};
|
32
|
+
|
33
|
+
},{"./util":11,"punycode":6,"querystring":9}],11:[function(require,module,exports){
|
34
|
+
"use strict";module.exports={isString:function(n){return"string"==typeof n},isObject:function(n){return"object"==typeof n&&null!==n},isNull:function(n){return null===n},isNullOrUndefined:function(n){return null==n}};
|
28
35
|
|
29
|
-
},{
|
36
|
+
},{}]},{},[4]);
|
Binary file
|
data/assets/js/search-engine.js
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
'use strict';
|
4
4
|
|
5
|
+
var mergeOptions = require('./merge-options');
|
5
6
|
var lunr = require('lunr');
|
6
7
|
var querystring = require('querystring');
|
7
8
|
var url = require('url');
|
@@ -9,21 +10,16 @@ var url = require('url');
|
|
9
10
|
module.exports = SearchEngine;
|
10
11
|
|
11
12
|
function SearchEngine(options) {
|
12
|
-
|
13
|
-
|
14
|
-
this.indexPath = opts.indexPath || SearchEngine.DEFAULT_SEARCH_INDEX_PATH;
|
15
|
-
this.queryParam = opts.queryParam || SearchEngine.DEFAULT_QUERY_PARAM;
|
13
|
+
mergeOptions(SearchEngine.DEFAULTS, options || {}, this);
|
16
14
|
}
|
17
15
|
|
18
|
-
SearchEngine.
|
19
|
-
|
20
|
-
|
21
|
-
SearchEngine.prototype.fetchIndex = function(baseUrl) {
|
22
|
-
var engine = this;
|
16
|
+
SearchEngine.DEFAULTS = {
|
17
|
+
queryParam: 'q'
|
18
|
+
};
|
23
19
|
|
20
|
+
SearchEngine.prototype.fetchIndex = function(indexUrl) {
|
24
21
|
return new Promise(function(resolve, reject) {
|
25
|
-
var req = new XMLHttpRequest()
|
26
|
-
indexUrl = baseUrl + engine.indexPath;
|
22
|
+
var req = new XMLHttpRequest();
|
27
23
|
|
28
24
|
req.addEventListener('load', function() {
|
29
25
|
var rawJson;
|
@@ -38,6 +34,10 @@ SearchEngine.prototype.fetchIndex = function(baseUrl) {
|
|
38
34
|
reject(new Error('failed to parse ' + indexUrl));
|
39
35
|
}
|
40
36
|
});
|
37
|
+
req.addEventListener('error', function() {
|
38
|
+
reject(new Error('failed to make XMLHttpRequest; ' +
|
39
|
+
'see console for details'));
|
40
|
+
});
|
41
41
|
req.open('GET', indexUrl);
|
42
42
|
req.send();
|
43
43
|
});
|
data/assets/js/search-ui.js
CHANGED
@@ -1,33 +1,37 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
+
var mergeOptions = require('./merge-options');
|
4
|
+
|
3
5
|
module.exports = SearchUi;
|
4
6
|
|
5
7
|
// eslint-disable-next-line
|
6
8
|
// based on https://github.com/angular/angular.js/blob/54ddca537/docs/app/src/search.js#L198-L206
|
7
9
|
function SearchUi(doc, options) {
|
8
|
-
|
9
|
-
|
10
|
+
mergeOptions(SearchUi.DEFAULTS, options || {}, this);
|
10
11
|
this.doc = doc;
|
11
|
-
this.inputElement = doc.getElementById(
|
12
|
-
|
13
|
-
this.resultsElement = doc.getElementById(
|
14
|
-
opts.searchResultsId || SearchUi.DEFAULT_SEARCH_RESULTS_ID);
|
15
|
-
this.emptyResultsMessagePrefix = opts.emptyResultsMessagePrefix ||
|
16
|
-
SearchUi.DEFAULT_EMPTY_RESULTS_MESSAGE_PREFIX;
|
17
|
-
this.emptyResultsElementType = opts.emptyResultsElementType ||
|
18
|
-
SearchUi.DEFAULT_EMPTY_RESULTS_ELEMENT_TYPE;
|
19
|
-
this.emptyResultsElementClass = opts.emptyResultsElementClass ||
|
20
|
-
SearchUi.DEFAULT_EMPTY_RESULTS_ELEMENT_CLASS;
|
12
|
+
this.inputElement = doc.getElementById(this.inputElementId);
|
13
|
+
this.resultsElement = doc.getElementById(this.searchResultsId);
|
21
14
|
}
|
22
15
|
|
23
|
-
SearchUi.
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
16
|
+
SearchUi.DEFAULTS = {
|
17
|
+
inputElementId: 'search-input',
|
18
|
+
searchResultsId: 'search-results',
|
19
|
+
emptyResultsMessagePrefix: 'No results found for',
|
20
|
+
emptyResultsElementType: 'p',
|
21
|
+
emptyResultsElementClass: 'search-empty',
|
22
|
+
|
23
|
+
// Note that if any of these change, they must all change. It's the
|
24
|
+
// responsibility of the caller to ensure they remain correct and in-sync.
|
25
|
+
globalShortcutKey: '/',
|
26
|
+
globalShortcutKeyCode: 'Slash',
|
27
|
+
globalShortcutKeyNumericCode: 191
|
28
|
+
};
|
28
29
|
|
29
|
-
function isForwardSlash(
|
30
|
-
|
30
|
+
function isForwardSlash(searchUi, keyEvent) {
|
31
|
+
// The former condition is more conformant; the latter for backward
|
32
|
+
// compatibility (i.e. Safari).
|
33
|
+
return keyEvent.code === searchUi.globalShortcutKeyCode ||
|
34
|
+
keyEvent.keyCode === searchUi.globalShortcutKeyNumericCode;
|
31
35
|
}
|
32
36
|
|
33
37
|
function isInput(element) {
|
@@ -35,17 +39,18 @@ function isInput(element) {
|
|
35
39
|
}
|
36
40
|
|
37
41
|
SearchUi.prototype.enableGlobalShortcut = function() {
|
38
|
-
var
|
42
|
+
var searchUi = this,
|
43
|
+
doc = this.doc,
|
39
44
|
inputElement = this.inputElement;
|
40
45
|
|
41
|
-
doc.body.
|
42
|
-
if (isForwardSlash(
|
43
|
-
|
44
|
-
|
46
|
+
doc.body.addEventListener('keydown', function(e) {
|
47
|
+
if (isForwardSlash(searchUi, e) && !isInput(doc.activeElement)) {
|
48
|
+
e.stopPropagation();
|
49
|
+
e.preventDefault();
|
45
50
|
inputElement.focus();
|
46
51
|
inputElement.select();
|
47
52
|
}
|
48
|
-
};
|
53
|
+
}, false);
|
49
54
|
};
|
50
55
|
|
51
56
|
SearchUi.prototype.renderResults = function(query, results, renderResults) {
|
@@ -55,19 +60,21 @@ SearchUi.prototype.renderResults = function(query, results, renderResults) {
|
|
55
60
|
this.inputElement.value = query;
|
56
61
|
|
57
62
|
if (results.length === 0) {
|
58
|
-
|
63
|
+
createEmptyResultsMessage(this, query);
|
59
64
|
this.inputElement.focus();
|
65
|
+
this.inputElement.select();
|
66
|
+
return;
|
60
67
|
}
|
61
68
|
renderResults(query, results, this.doc, this.resultsElement);
|
62
69
|
};
|
63
70
|
|
64
|
-
|
65
|
-
var item =
|
66
|
-
message =
|
67
|
-
|
68
|
-
parentItem =
|
71
|
+
function createEmptyResultsMessage(searchUi, query) {
|
72
|
+
var item = searchUi.doc.createElement(searchUi.emptyResultsElementType),
|
73
|
+
message = searchUi.doc.createTextNode(
|
74
|
+
searchUi.emptyResultsMessagePrefix + ' "' + query + '".'),
|
75
|
+
parentItem = searchUi.resultsElement.parentElement;
|
69
76
|
|
70
|
-
item.
|
77
|
+
item.className = searchUi.emptyResultsElementClass;
|
71
78
|
item.appendChild(message);
|
72
|
-
parentItem.insertBefore(item,
|
73
|
-
}
|
79
|
+
parentItem.insertBefore(item, searchUi.resultsElement);
|
80
|
+
}
|