jekyll_pages_api_search 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +174 -2
- data/assets/js/search-bundle.js +17 -11
- data/assets/js/search-bundle.js.gz +0 -0
- data/assets/js/search-engine.js +71 -0
- data/assets/js/search-ui.js +74 -0
- data/assets/js/search.js +14 -88
- data/lib/jekyll_pages_api_search/browserify.js +44 -0
- data/lib/jekyll_pages_api_search/browserify.rb +29 -0
- data/lib/jekyll_pages_api_search/generator.rb +1 -0
- data/lib/jekyll_pages_api_search/sass/jekyll_pages_api_search.scss +6 -5
- data/lib/jekyll_pages_api_search/search.html +10 -11
- data/lib/jekyll_pages_api_search/search_hook.rb +1 -0
- data/lib/jekyll_pages_api_search/tags.rb +12 -4
- data/lib/jekyll_pages_api_search/version.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 09d94bd8932c1de46d25f1d433187181c81079e4
|
4
|
+
data.tar.gz: 6bb7b2bfc0644cdd7f93d9ffad0b3590fdafc521
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d79c8f85ff9206d471a5927b91520a54c092986971662a6cb74afecc0147a5e977e9a4cc1c3fab46d594a1caf645a89cd4ac9288a687c7290ae028bab17c14b
|
7
|
+
data.tar.gz: adc25239e1ef135ad813dfcd4dce3b2ca782b73efa655549673b6765f84b7f6cf8ed4151005b45ce7866d2324b0462db057c7d0bd1dda79787828153a7a5d056
|
data/README.md
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/18F/jekyll_pages_api_search.svg?branch=master)](https://travis-ci.org/18F/jekyll_pages_api_search)
|
4
4
|
|
5
|
-
|
5
|
+
The [`jekyll_pages_api_search` Ruby
|
6
|
+
gem](https://rubygems.org/gems/jekyll_pages_api_search) adds a
|
7
|
+
[lunr.js](http://lunrjs.com) search index to a
|
6
8
|
[Jekyll](http://jekyllrb.com/)-based web site.
|
7
9
|
|
8
10
|
The search index is generated and compressed automatically via `jekyll build`
|
@@ -74,12 +76,23 @@ All of the client-side components are bundled together with
|
|
74
76
|
url:
|
75
77
|
boost: 5
|
76
78
|
body:
|
79
|
+
|
80
|
+
# If defined and browserify and uglifyify are installed, the plugin will
|
81
|
+
# generate a bundle to define the renderJekyllPagesApiSearchResults
|
82
|
+
# function.
|
83
|
+
browserify:
|
84
|
+
source: js/my-search.js
|
85
|
+
target: js/my-search-bundle.js
|
77
86
|
```
|
78
87
|
|
79
88
|
1. Run `jekyll build` or `jekyll serve` to produce `search-index.json` and
|
80
89
|
`search-index.json.gz` files in the `_site` directory (or other output
|
81
90
|
directory, as configured).
|
82
91
|
|
92
|
+
If `browserify:` is defined, it will also produce the `target:` bundle file
|
93
|
+
and its gzipped version. See the [browserify section](#using-browserify)
|
94
|
+
for more details.
|
95
|
+
|
83
96
|
1. If you're running [Nginx](http://nginx.org), you may want to use the
|
84
97
|
[`gzip_static on`
|
85
98
|
directive](http://nginx.org/en/docs/http/ngx_http_gzip_static_module.html)
|
@@ -117,7 +130,142 @@ instructions](#installation), the following properties of the
|
|
117
130
|
- **endpoint**: The name of the endpoint generated for the search results
|
118
131
|
page. Defaults to `search`.
|
119
132
|
|
120
|
-
##
|
133
|
+
## Results UI and search engine options
|
134
|
+
|
135
|
+
To customize elements of the search user interface and search engine, add the
|
136
|
+
following objects to your search result page's layout _before_ the
|
137
|
+
`{% jekyll_pages_api_search_load %}` tag. Override only the properties
|
138
|
+
required for your installation (default values shown below).
|
139
|
+
|
140
|
+
```html
|
141
|
+
<script>
|
142
|
+
var JEKYLL_PAGES_API_SEARCH_UI_OPTIONS = {
|
143
|
+
// ID of the search input element
|
144
|
+
inputElementId: 'search-input',
|
145
|
+
|
146
|
+
// ID of the search results element; the search will only run on the page or
|
147
|
+
// pages that contain an element matching this ID
|
148
|
+
searchResultsId: 'search-results',
|
149
|
+
|
150
|
+
// Prefix of the message generated to indicate an empty result set; the
|
151
|
+
// query string will be appended
|
152
|
+
emptyResultsMessagePrefix: 'No results found for',
|
153
|
+
|
154
|
+
// Type of HTML element that will contain the empty results message; will be
|
155
|
+
// added to the parent of the searchResultsId element, before the
|
156
|
+
// searchResultsId element
|
157
|
+
emptyResultsElementType: 'p',
|
158
|
+
|
159
|
+
// CSS class assigned to the empty results message element
|
160
|
+
emptyResultsElementClass: 'search-empty'
|
161
|
+
};
|
162
|
+
|
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
|
+
// URL query string parameter containing the search query string
|
170
|
+
queryParam: 'q'
|
171
|
+
};
|
172
|
+
</script>
|
173
|
+
```
|
174
|
+
|
175
|
+
To override the default search results rendering function, define a function
|
176
|
+
called `renderJekyllPagesApiSearchResults` that conforms to the following
|
177
|
+
interface. This is the default implementation, which creates new `<li>`
|
178
|
+
elements containing a link for each search result.
|
179
|
+
|
180
|
+
```html
|
181
|
+
<script>
|
182
|
+
/*
|
183
|
+
* Params:
|
184
|
+
* - query: query string
|
185
|
+
* - results: search results matching the query
|
186
|
+
* - doc: window.document object
|
187
|
+
* - resultsElem: HTML element to which generated search results elements will
|
188
|
+
* be appended
|
189
|
+
*/
|
190
|
+
function renderJekyllPagesApiSearchResults(query, results, doc, resultsElem) {
|
191
|
+
results.forEach(function(result, index) {
|
192
|
+
var item = doc.createElement('li'),
|
193
|
+
link = doc.createElement('a'),
|
194
|
+
text = doc.createTextNode(result.title);
|
195
|
+
|
196
|
+
link.appendChild(text);
|
197
|
+
link.title = result.title;
|
198
|
+
link.href = result.url;
|
199
|
+
item.appendChild(link);
|
200
|
+
resultsElem.appendChild(item);
|
201
|
+
|
202
|
+
link.tabindex = index;
|
203
|
+
if (index === 0) {
|
204
|
+
link.focus();
|
205
|
+
}
|
206
|
+
});
|
207
|
+
}
|
208
|
+
</script>
|
209
|
+
```
|
210
|
+
|
211
|
+
### Using browserify
|
212
|
+
|
213
|
+
The most modular means of defining `renderJekyllPagesApiSearchResults` may be
|
214
|
+
to create a Node.js implementation file and generate a browser-compatible
|
215
|
+
version using [browserify](http://browserify.org/). First create the
|
216
|
+
implementation as described above. Then perform the following steps:
|
217
|
+
|
218
|
+
```shell
|
219
|
+
# Create a package.json file
|
220
|
+
$ npm init
|
221
|
+
|
222
|
+
# Install browserify and uglifyify, a JavaScript minimizer
|
223
|
+
$ npm install browserify uglifyify --save-dev
|
224
|
+
```
|
225
|
+
|
226
|
+
Add the `browserify:` configuration as defined in the [installation
|
227
|
+
instructions](#installation) above, replacing `js/my-search.js` with the path
|
228
|
+
to your `renderJekyllPagesApiSearchResults` implementation script and
|
229
|
+
`js/my-search-bundle.js` with the path to your generated bundle.
|
230
|
+
|
231
|
+
### Examples from apps.gov
|
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/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
|
121
269
|
|
122
270
|
If you prefer to craft your own versions of these tags and styles, you can
|
123
271
|
capture the output of these tags and the Sass `@import` statement, then create
|
@@ -174,6 +322,30 @@ group :jekyll_plugins do
|
|
174
322
|
end
|
175
323
|
```
|
176
324
|
|
325
|
+
## Releasing
|
326
|
+
|
327
|
+
After following the steps from the [Developing section](#developing) to build
|
328
|
+
and test the gem:
|
329
|
+
|
330
|
+
1. Ensure all changes for the release have already been merged all into the
|
331
|
+
`master` branch.
|
332
|
+
|
333
|
+
1. Bump the version number by editing
|
334
|
+
[`lib/jekyll_pages_api_search/version.rb`](lib/jekyll_pages_api_search/version.rb).
|
335
|
+
|
336
|
+
1. Commit the version number update directly to the `master` branch, replacing
|
337
|
+
`X.X.X` with the new version number:
|
338
|
+
```sh
|
339
|
+
$ git commit -m 'Bump to vX.X.X' lib/jekyll_pages_api_search/version.rb
|
340
|
+
```
|
341
|
+
|
342
|
+
1. Finally, run the following command. It will build the gem, tag the head
|
343
|
+
commit in `git`, push the branch and tag to GitHub, and ultimately push the
|
344
|
+
release to [`jekyll_pages_api_search` on RubyGems.org](https://rubygems.org/gems/jekyll_pages_api_search).
|
345
|
+
```sh
|
346
|
+
$ bundle exec rake release
|
347
|
+
```
|
348
|
+
|
177
349
|
## Contributing
|
178
350
|
|
179
351
|
If you'd like to contribute to this repository, please follow our
|
data/assets/js/search-bundle.js
CHANGED
@@ -1,23 +1,29 @@
|
|
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";function SearchEngine(e){var r=e||{};this.indexPath=r.indexPath||SearchEngine.DEFAULT_SEARCH_INDEX_PATH,this.queryParam=r.queryParam||SearchEngine.DEFAULT_QUERY_PARAM}var lunr=require("lunr"),querystring=require("querystring"),url=require("url");module.exports=SearchEngine,SearchEngine.DEFAULT_SEARCH_INDEX_PATH="/search-index.json",SearchEngine.DEFAULT_QUERY_PARAM="q",SearchEngine.prototype.fetchIndex=function(e){var r=this;return new Promise(function(n,t){var a=new XMLHttpRequest,i=e+r.indexPath;a.addEventListener("load",function(){var e;try{e=JSON.parse(this.responseText),n({urlToDoc:e.urlToDoc,index:lunr.Index.load(e.index)})}catch(r){t(new Error("failed to parse "+i))}}),a.open("GET",i),a.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),a=n.getResults(t,e);return Promise.resolve({query:t,results:a})})};
|
3
|
+
|
4
|
+
},{"lunr":4,"querystring":8,"url":9}],2:[function(require,module,exports){
|
5
|
+
"use strict";function SearchUi(e,t){var s=t||{};this.doc=e,this.inputElement=e.getElementById(s.inputElementId||SearchUi.DEFAULT_SEARCH_INPUT_ID),this.resultsElement=e.getElementById(s.searchResultsId||SearchUi.DEFAULT_SEARCH_RESULTS_ID),this.emptyResultsMessagePrefix=s.emptyResultsMessagePrefix||SearchUi.DEFAULT_EMPTY_RESULTS_MESSAGE_PREFIX,this.emptyResultsElementType=s.emptyResultsElementType||SearchUi.DEFAULT_EMPTY_RESULTS_ELEMENT_TYPE,this.emptyResultsElementClass=s.emptyResultsElementClass||SearchUi.DEFAULT_EMPTY_RESULTS_ELEMENT_CLASS}function isForwardSlash(e){return 191===e}function isInput(e){return"input"===e.tagName.toLowerCase()}module.exports=SearchUi,SearchUi.DEFAULT_SEARCH_INPUT_ID="search-input",SearchUi.DEFAULT_SEARCH_RESULTS_ID="search-results",SearchUi.DEFAULT_EMPTY_RESULTS_MESSAGE_PREFIX="No results found for",SearchUi.DEFAULT_EMPTY_RESULTS_ELEMENT_TYPE="p",SearchUi.DEFAULT_EMPTY_RESULTS_ELEMENT_CLASS="search-empty",SearchUi.prototype.enableGlobalShortcut=function(){var e=this.doc,t=this.inputElement;e.body.onkeydown=function(s){isForwardSlash(s.keyCode)&&!isInput(e.activeElement)&&(s.stopPropagation(),s.preventDefault(),t.focus(),t.select())}},SearchUi.prototype.renderResults=function(e,t,s){return e?(this.inputElement.value=e,0===t.length?(this.createEmptyResultsMessage(e),void this.inputElement.focus()):void s(e,t,this.doc,this.resultsElement)):void 0},SearchUi.prototype.createEmptyResultsMessage=function(e){var t=this.doc.createElement(this.emptyResultsElementType),s=this.doc.createTextNode(this.emptyResultsMessagePrefix+' "'+e+'".'),E=this.resultsElement.parentElement;t.style.className=this.emptyResultsElementClass,t.appendChild(s),E.insertBefore(t,this.resultsElement)};
|
6
|
+
|
7
|
+
},{}],3:[function(require,module,exports){
|
8
|
+
"use strict";function writeResultsToList(e,t,n,r){t.forEach(function(e,t){var i=n.createElement("li"),o=n.createElement("a"),c=n.createTextNode(e.title);o.appendChild(c),o.title=e.title,o.href=e.url,i.appendChild(o),r.appendChild(i),o.tabindex=t,0===t&&o.focus()})}var SearchEngine=require("./search-engine"),SearchUi=require("./search-ui");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);return e.enableGlobalShortcut(),e.resultsElement?t.executeSearch(window.JEKYLL_PAGES_API_SEARCH_BASEURL,window.location.href).then(function(t){e.renderResults(t.query,t.results,window.renderJekyllPagesApiSearchResults||writeResultsToList)})["catch"](function(e){console.error(e)}):void 0}();
|
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(-1==i)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(-1==i)throw new Error("Cannot find existingFn");this._stack.splice(i,0,n)},t.Pipeline.prototype.remove=function(t){var e=this._stack.indexOf(t);-1!=e&&this._stack.splice(e,1)},t.Pipeline.prototype.run=function(t){for(var e=[],n=t.length,i=this._stack.length,r=0;n>r;r++){for(var o=t[r],s=0;i>s&&(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;t>o&&(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;)t>o&&(e=r),o>t&&(n=r),i=n-e,r=e+Math.floor(i/2),o=this.elements[r];return o>t?r:t>o?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?!0: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?!0: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?!0: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;d>v;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;i>o;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){return t&&e[t]!==t?t:void 0}},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})}();
|
11
|
+
|
12
|
+
},{}],5:[function(require,module,exports){
|
2
13
|
(function (global){
|
3
|
-
!function(e){function o(e){throw RangeError(T[e])}function n(e,o){for(var n=e.length,r=[];n--;)r[n]=o(e[n]);return r}function r(e,o){var r=e.split("@"),t="";r.length>1&&(t=r[0]+"@",e=r[1]),e=e.replace(S,".");var u=e.split("."),i=n(u,o).join(".");return t+i}function t(e){for(var o,n,r=[],t=0,u=e.length;u>t;)o=e.charCodeAt(t++),o>=55296&&56319>=o&&u>t?(n=e.charCodeAt(t++),56320==(64512&n)?r.push(((1023&o)<<10)+(1023&n)+65536):(r.push(o),t--)):r.push(o);return r}function u(e){return n(e,function(e){var o="";return e>65535&&(e-=65536,o+=P(e>>>10&1023|55296),e=56320|1023&e),o+=P(e)}).join("")}function i(e){return 10>e-48?e-22:26>e-65?e-65:26>e-97?e-97:b}function f(e,o){return e+22+75*(26>e)-((0!=o)<<5)}function c(e,o,n){var r=0;for(e=n?M(e/j):e>>1,e+=M(e/o);e>L*C>>1;r+=b)e=M(e/L);return M(r+(L+1)*e/(e+m))}function l(e){var n,r,t,f,l,s,d,a,p,h,v=[],g=e.length,w=0,m=I,j=A;for(r=e.lastIndexOf(E),0>r&&(r=0),t=0;r>t;++t)e.charCodeAt(t)>=128&&o("not-basic"),v.push(e.charCodeAt(t));for(f=r>0?r+1:0;g>f;){for(l=w,s=1,d=b;f>=g&&o("invalid-input"),a=i(e.charCodeAt(f++)),(a>=b||a>M((x-w)/s))&&o("overflow"),w+=a*s,p=j>=d?y:d>=j+C?C:d-j,!(p>a);d+=b)h=b-p,s>M(x/h)&&o("overflow"),s*=h;n=v.length+1,j=c(w-l,n,0==l),M(w/n)>x-m&&o("overflow"),m+=M(w/n),w%=n,v.splice(w++,0,m)}return u(v)}function s(e){var n,r,u,i,l,s,d,a,p,h,v,g,w,m,j,F=[];for(e=t(e),g=e.length,n=I,r=0,l=A,s=0;g>s;++s)v=e[s],128>v&&F.push(P(v));for(u=i=F.length,i&&F.push(E);g>u;){for(d=x,s=0;g>s;++s)v=e[s],v>=n&&d>v&&(d=v);for(w=u+1,d-n>M((x-r)/w)&&o("overflow"),r+=(d-n)*w,n=d,s=0;g>s;++s)if(v=e[s],n>v&&++r>x&&o("overflow"),v==n){for(a=r,p=b;h=l>=p?y:p>=l+C?C:p-l,!(h>a);p+=b)j=a-h,m=b-h,F.push(P(f(h+j%m,0))),a=M(j/m);F.push(P(f(a,0))),l=c(r,w,u==i),r=0,++u}++r,++n}return F.join("")}function d(e){return r(e,function(e){return F.test(e)?l(e.slice(4).toLowerCase()):e})}function a(e){return r(e,function(e){return O.test(e)?"xn--"+s(e):e})}var p="object"==typeof exports&&exports&&!exports.nodeType&&exports,h="object"==typeof module&&module&&!module.nodeType&&module,v="object"==typeof global&&global;
|
14
|
+
!function(e){function o(e){throw new RangeError(T[e])}function n(e,o){for(var n=e.length,r=[];n--;)r[n]=o(e[n]);return r}function r(e,o){var r=e.split("@"),t="";r.length>1&&(t=r[0]+"@",e=r[1]),e=e.replace(S,".");var u=e.split("."),i=n(u,o).join(".");return t+i}function t(e){for(var o,n,r=[],t=0,u=e.length;u>t;)o=e.charCodeAt(t++),o>=55296&&56319>=o&&u>t?(n=e.charCodeAt(t++),56320==(64512&n)?r.push(((1023&o)<<10)+(1023&n)+65536):(r.push(o),t--)):r.push(o);return r}function u(e){return n(e,function(e){var o="";return e>65535&&(e-=65536,o+=P(e>>>10&1023|55296),e=56320|1023&e),o+=P(e)}).join("")}function i(e){return 10>e-48?e-22:26>e-65?e-65:26>e-97?e-97:b}function f(e,o){return e+22+75*(26>e)-((0!=o)<<5)}function c(e,o,n){var r=0;for(e=n?M(e/j):e>>1,e+=M(e/o);e>L*C>>1;r+=b)e=M(e/L);return M(r+(L+1)*e/(e+m))}function l(e){var n,r,t,f,l,s,d,a,p,h,v=[],g=e.length,w=0,m=I,j=A;for(r=e.lastIndexOf(E),0>r&&(r=0),t=0;r>t;++t)e.charCodeAt(t)>=128&&o("not-basic"),v.push(e.charCodeAt(t));for(f=r>0?r+1:0;g>f;){for(l=w,s=1,d=b;f>=g&&o("invalid-input"),a=i(e.charCodeAt(f++)),(a>=b||a>M((x-w)/s))&&o("overflow"),w+=a*s,p=j>=d?y:d>=j+C?C:d-j,!(p>a);d+=b)h=b-p,s>M(x/h)&&o("overflow"),s*=h;n=v.length+1,j=c(w-l,n,0==l),M(w/n)>x-m&&o("overflow"),m+=M(w/n),w%=n,v.splice(w++,0,m)}return u(v)}function s(e){var n,r,u,i,l,s,d,a,p,h,v,g,w,m,j,F=[];for(e=t(e),g=e.length,n=I,r=0,l=A,s=0;g>s;++s)v=e[s],128>v&&F.push(P(v));for(u=i=F.length,i&&F.push(E);g>u;){for(d=x,s=0;g>s;++s)v=e[s],v>=n&&d>v&&(d=v);for(w=u+1,d-n>M((x-r)/w)&&o("overflow"),r+=(d-n)*w,n=d,s=0;g>s;++s)if(v=e[s],n>v&&++r>x&&o("overflow"),v==n){for(a=r,p=b;h=l>=p?y:p>=l+C?C:p-l,!(h>a);p+=b)j=a-h,m=b-h,F.push(P(f(h+j%m,0))),a=M(j/m);F.push(P(f(a,0))),l=c(r,w,u==i),r=0,++u}++r,++n}return F.join("")}function d(e){return r(e,function(e){return F.test(e)?l(e.slice(4).toLowerCase()):e})}function a(e){return r(e,function(e){return O.test(e)?"xn--"+s(e):e})}var p="object"==typeof exports&&exports&&!exports.nodeType&&exports,h="object"==typeof module&&module&&!module.nodeType&&module,v="object"==typeof global&&global;v.global!==v&&v.window!==v&&v.self!==v||(e=v);var g,w,x=2147483647,b=36,y=1,C=26,m=38,j=700,A=72,I=128,E="-",F=/^xn--/,O=/[^\x20-\x7E]/,S=/[\x2E\u3002\uFF0E\uFF61]/g,T={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},L=b-y,M=Math.floor,P=String.fromCharCode;if(g={version:"1.3.2",ucs2:{decode:t,encode:u},decode:l,encode:s,toASCII:a,toUnicode:d},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return g});else if(p&&h)if(module.exports==p)h.exports=g;else for(w in g)g.hasOwnProperty(w)&&(p[w]=g[w]);else e.punycode=g}(this);
|
4
15
|
|
5
16
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
6
|
-
},{}],
|
17
|
+
},{}],6:[function(require,module,exports){
|
7
18
|
"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;p>y;++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)};
|
8
19
|
|
9
|
-
},{}],
|
20
|
+
},{}],7:[function(require,module,exports){
|
10
21
|
"use strict";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 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)},objectKeys=Object.keys||function(r){var e=[];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.push(t);return e};
|
11
22
|
|
12
|
-
},{}],
|
23
|
+
},{}],8:[function(require,module,exports){
|
13
24
|
"use strict";exports.decode=exports.parse=require("./decode"),exports.encode=exports.stringify=require("./encode");
|
14
25
|
|
15
|
-
},{"./decode":
|
26
|
+
},{"./decode":6,"./encode":7}],9:[function(require,module,exports){
|
16
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}function urlParse(t,s,e){if(t&&isObject(t)&&t instanceof Url)return t;var h=new Url;return h.parse(t,s,e),h}function urlFormat(t){return isString(t)&&(t=urlParse(t)),t instanceof Url?t.format():Url.prototype.format.call(t)}function urlResolve(t,s){return urlParse(t,!1,!0).resolve(s)}function urlResolveObject(t,s){return t?urlParse(t,!1,!0).resolveObject(s):s}function isString(t){return"string"==typeof t}function isObject(t){return"object"==typeof t&&null!==t}function isNull(t){return null===t}function isNullOrUndefined(t){return null==t}var punycode=require("punycode");exports.parse=urlParse,exports.resolve=urlResolve,exports.resolveObject=urlResolveObject,exports.format=urlFormat,exports.Url=Url;var protocolPattern=/^([a-z0-9.+-]+:)/i,portPattern=/:[0-9]*$/,delims=["<",">",'"',"`"," ","\r","\n"," "],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");Url.prototype.parse=function(t,s,e){if(!isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var h=t;h=h.trim();var r=protocolPattern.exec(h);if(r){r=r[0];var o=r.toLowerCase();this.protocol=o,h=h.substr(r.length)}if(e||r||h.match(/^\/\/[^@\/]+@[^@\/]+/)){var a="//"===h.substr(0,2);!a||r&&hostlessProtocol[r]||(h=h.substr(2),this.slashes=!0)}if(!hostlessProtocol[r]&&(a||r&&!slashedProtocol[r])){for(var n=-1,i=0;i<hostEndingChars.length;i++){var l=h.indexOf(hostEndingChars[i]);-1!==l&&(-1===n||n>l)&&(n=l)}var c,u;u=-1===n?h.lastIndexOf("@"):h.lastIndexOf("@",n),-1!==u&&(c=h.slice(0,u),h=h.slice(u+1),this.auth=decodeURIComponent(c)),n=-1;for(var i=0;i<nonHostChars.length;i++){var l=h.indexOf(nonHostChars[i]);-1!==l&&(-1===n||n>l)&&(n=l)}-1===n&&(n=h.length),this.host=h.slice(0,n),h=h.slice(n),this.parseHost(),this.hostname=this.hostname||"";var p="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!p)for(var f=this.hostname.split(/\./),i=0,m=f.length;m>i;i++){var v=f[i];if(v&&!v.match(hostnamePartPattern)){for(var g="",y=0,d=v.length;d>y;y++)g+=v.charCodeAt(y)>127?"x":v[y];if(!g.match(hostnamePartPattern)){var P=f.slice(0,i),b=f.slice(i+1),j=v.match(hostnamePartStart);j&&(P.push(j[1]),b.unshift(j[2])),b.length&&(h="/"+b.join(".")+h),this.hostname=P.join(".");break}}}if(this.hostname.length>hostnameMaxLen?this.hostname="":this.hostname=this.hostname.toLowerCase(),!p){for(var O=this.hostname.split("."),q=[],i=0;i<O.length;++i){var x=O[i];q.push(x.match(/[^A-Za-z0-9_-]/)?"xn--"+punycode.encode(x):x)}this.hostname=q.join(".")}var U=this.port?":"+this.port:"",C=this.hostname||"";this.host=C+U,this.href+=this.host,p&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==h[0]&&(h="/"+h))}if(!unsafeProtocol[o])for(var i=0,m=autoEscape.length;m>i;i++){var A=autoEscape[i],E=encodeURIComponent(A);E===A&&(E=escape(A)),h=h.split(A).join(E)}var w=h.indexOf("#");-1!==w&&(this.hash=h.substr(w),h=h.slice(0,w));var R=h.indexOf("?");if(-1!==R?(this.search=h.substr(R),this.query=h.substr(R+1),s&&(this.query=querystring.parse(this.query)),h=h.slice(0,R)):s&&(this.search="",this.query={}),h&&(this.pathname=h),slashedProtocol[o]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var U=this.pathname||"",x=this.search||"";this.path=U+x}return this.href=this.format(),this},Url.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var s=this.protocol||"",e=this.pathname||"",h=this.hash||"",r=!1,o="";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&&isObject(this.query)&&Object.keys(this.query).length&&(o=querystring.stringify(this.query));var a=this.search||o&&"?"+o||"";return s&&":"!==s.substr(-1)&&(s+=":"),this.slashes||(!s||slashedProtocol[s])&&r!==!1?(r="//"+(r||""),e&&"/"!==e.charAt(0)&&(e="/"+e)):r||(r=""),h&&"#"!==h.charAt(0)&&(h="#"+h),a&&"?"!==a.charAt(0)&&(a="?"+a),e=e.replace(/[?#]/g,function(t){return encodeURIComponent(t)}),a=a.replace("#","%23"),s+r+e+a+h},Url.prototype.resolve=function(t){return this.resolveObject(urlParse(t,!1,!0)).format()},Url.prototype.resolveObject=function(t){if(isString(t)){var s=new Url;s.parse(t,!1,!0),t=s}var e=new Url;if(Object.keys(this).forEach(function(t){e[t]=this[t]},this),e.hash=t.hash,""===t.href)return e.href=e.format(),e;if(t.slashes&&!t.protocol)return Object.keys(t).forEach(function(s){"protocol"!==s&&(e[s]=t[s])}),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])return Object.keys(t).forEach(function(s){e[s]=t[s]}),e.href=e.format(),e;if(e.protocol=t.protocol,t.host||hostlessProtocol[t.protocol])e.pathname=t.pathname;else{for(var h=(t.pathname||"").split("/");h.length&&!(t.host=h.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==h[0]&&h.unshift(""),h.length<2&&h.unshift(""),e.pathname=h.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 r=e.pathname||"",o=e.search||"";e.path=r+o}return e.slashes=e.slashes||t.slashes,e.href=e.format(),e}var a=e.pathname&&"/"===e.pathname.charAt(0),n=t.host||t.pathname&&"/"===t.pathname.charAt(0),i=n||a||e.host&&t.pathname,l=i,c=e.pathname&&e.pathname.split("/")||[],h=t.pathname&&t.pathname.split("/")||[],u=e.protocol&&!slashedProtocol[e.protocol];if(u&&(e.hostname="",e.port=null,e.host&&(""===c[0]?c[0]=e.host:c.unshift(e.host)),e.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===h[0]?h[0]=t.host:h.unshift(t.host)),t.host=null),i=i&&(""===h[0]||""===c[0])),n)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,c=h;else if(h.length)c||(c=[]),c.pop(),c=c.concat(h),e.search=t.search,e.query=t.query;else if(!isNullOrUndefined(t.search)){if(u){e.hostname=e.host=c.shift();var p=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;p&&(e.auth=p.shift(),e.host=e.hostname=p.shift())}return e.search=t.search,e.query=t.query,isNull(e.pathname)&&isNull(e.search)||(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!c.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var f=c.slice(-1)[0],m=(e.host||t.host)&&("."===f||".."===f)||""===f,v=0,g=c.length;g>=0;g--)f=c[g],"."==f?c.splice(g,1):".."===f?(c.splice(g,1),v++):v&&(c.splice(g,1),v--);if(!i&&!l)for(;v--;v)c.unshift("..");!i||""===c[0]||c[0]&&"/"===c[0].charAt(0)||c.unshift(""),m&&"/"!==c.join("/").substr(-1)&&c.push("");var y=""===c[0]||c[0]&&"/"===c[0].charAt(0);if(u){e.hostname=e.host=y?"":c.length?c.shift():"";var p=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;p&&(e.auth=p.shift(),e.host=e.hostname=p.shift())}return i=i||e.host&&c.length,i&&!y&&c.unshift(""),c.length?e.pathname=c.join("/"):(e.pathname=null,e.path=null),isNull(e.pathname)&&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],":"!==s&&(this.port=s.substr(1)),t=t.substr(0,t.length-s.length)),t&&(this.hostname=t)};
|
17
28
|
|
18
|
-
},{"punycode":
|
19
|
-
!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(-1==i)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(-1==i)throw new Error("Cannot find existingFn");this._stack.splice(i,0,n)},t.Pipeline.prototype.remove=function(t){var e=this._stack.indexOf(t);-1!=e&&this._stack.splice(e,1)},t.Pipeline.prototype.run=function(t){for(var e=[],n=t.length,i=this._stack.length,r=0;n>r;r++){for(var o=t[r],s=0;i>s&&(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;t>o&&(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;)t>o&&(e=r),o>t&&(n=r),i=n-e,r=e+Math.floor(i/2),o=this.elements[r];return o>t?r:t>o?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?!0: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?!0: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?!0: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,u=this.tokenStore.expand(e).reduce(function(n,r){var o=h.corpusTokens.indexOf(r),s=h.idf(r),u=1,l=new t.SortedSet;if(r!==e){var c=Math.max(3,r.length-e.length);u=1/Math.log(c)}o>-1&&i.insert(o,a*s*u);for(var f=h.tokenStore.get(r),p=Object.keys(f),d=p.length,v=0;d>v;v++)l.add(f[p[v]].ref);return n.union(l)},new t.SortedSet);r.push(u)},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;i>o;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,u="^("+r+")?"+i,l=new RegExp(s),c=new RegExp(h),f=new RegExp(a),p=new RegExp(u),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,u;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=l,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,u=x,a.test(n)?n+="e":h.test(n)?(s=y,n=n.replace(s,"")):u.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=l,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=l,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){return t&&e[t]!==t?t:void 0}},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})}();
|
20
|
-
|
21
|
-
},{}],7:[function(require,module,exports){
|
22
|
-
"use strict";function fetchIndex(e){return new Promise(function(n,r){var t=new XMLHttpRequest,o=e+"/search-index.json";t.addEventListener("load",function(){var e;try{e=JSON.parse(this.responseText),n({urlToDoc:e.urlToDoc,index:lunr.Index.load(e.index)})}catch(t){r(new Error("failed to parse "+o))}}),t.open("GET",o),t.send()})}function parseSearchQuery(e){return querystring.parse(url.parse(e).query).q}function getResults(e,n){var r=n.index.search(e);return r.forEach(function(e){var r=n.urlToDoc[e.ref];Object.keys(r).forEach(function(n){e[n]=r[n]})}),r}function writeResults(e,n,r,t,o){e&&(r.value=e),o.forEach(function(e,r){var o=n.createElement("li"),u=n.createElement("a"),i=n.createTextNode(e.title);u.appendChild(i),u.title=e.title,u.href=e.url,o.appendChild(u),t.appendChild(o),u.tabindex=r,0===r&&u.focus()})}function SearchUi(e,n){var r=function(e){return 191===e},t=function(e){return"input"===e.tagName.toLowerCase()},o=function(){n.focus()},u=function(n){r(n.keyCode)&&!t(e.activeElement)&&(n.stopPropagation(),n.preventDefault(),o())};this.enableGlobalShortcut=function(){e.body.onkeydown=u}}var lunr=require("lunr"),querystring=require("querystring"),url=require("url"),SEARCH_INPUT_ID="search-input",SEARCH_RESULTS_ID="search-results";module.exports=function(){var e=window.document,n=e.getElementById(SEARCH_INPUT_ID),r=new SearchUi(e,n),t=e.getElementById(SEARCH_RESULTS_ID);return r.enableGlobalShortcut(),t?fetchIndex(window.SEARCH_BASEURL).then(function(r){var o=parseSearchQuery(window.location.href),u=getResults(o,r);writeResults(o,e,n,t,u)})["catch"](function(e){console.error(e)}):void 0}();
|
23
|
-
},{"lunr":6,"querystring":4,"url":5}]},{},[7]);
|
29
|
+
},{"punycode":5,"querystring":8}]},{},[3]);
|
Binary file
|
@@ -0,0 +1,71 @@
|
|
1
|
+
/* eslint-env browser, node */
|
2
|
+
|
3
|
+
'use strict';
|
4
|
+
|
5
|
+
var lunr = require('lunr');
|
6
|
+
var querystring = require('querystring');
|
7
|
+
var url = require('url');
|
8
|
+
|
9
|
+
module.exports = SearchEngine;
|
10
|
+
|
11
|
+
function SearchEngine(options) {
|
12
|
+
var opts = options || {};
|
13
|
+
|
14
|
+
this.indexPath = opts.indexPath || SearchEngine.DEFAULT_SEARCH_INDEX_PATH;
|
15
|
+
this.queryParam = opts.queryParam || SearchEngine.DEFAULT_QUERY_PARAM;
|
16
|
+
}
|
17
|
+
|
18
|
+
SearchEngine.DEFAULT_SEARCH_INDEX_PATH = '/search-index.json';
|
19
|
+
SearchEngine.DEFAULT_QUERY_PARAM = 'q';
|
20
|
+
|
21
|
+
SearchEngine.prototype.fetchIndex = function(baseUrl) {
|
22
|
+
var engine = this;
|
23
|
+
|
24
|
+
return new Promise(function(resolve, reject) {
|
25
|
+
var req = new XMLHttpRequest(),
|
26
|
+
indexUrl = baseUrl + engine.indexPath;
|
27
|
+
|
28
|
+
req.addEventListener('load', function() {
|
29
|
+
var rawJson;
|
30
|
+
|
31
|
+
try {
|
32
|
+
rawJson = JSON.parse(this.responseText);
|
33
|
+
resolve({
|
34
|
+
urlToDoc: rawJson.urlToDoc,
|
35
|
+
index: lunr.Index.load(rawJson.index)
|
36
|
+
});
|
37
|
+
} catch (err) {
|
38
|
+
reject(new Error('failed to parse ' + indexUrl));
|
39
|
+
}
|
40
|
+
});
|
41
|
+
req.open('GET', indexUrl);
|
42
|
+
req.send();
|
43
|
+
});
|
44
|
+
};
|
45
|
+
|
46
|
+
SearchEngine.prototype.parseSearchQuery = function(queryUrl) {
|
47
|
+
return querystring.parse(url.parse(queryUrl).query)[this.queryParam];
|
48
|
+
};
|
49
|
+
|
50
|
+
SearchEngine.prototype.getResults = function(query, searchIndex) {
|
51
|
+
var results = searchIndex.index.search(query);
|
52
|
+
|
53
|
+
results.forEach(function(result) {
|
54
|
+
var urlAndTitle = searchIndex.urlToDoc[result.ref];
|
55
|
+
|
56
|
+
Object.keys(urlAndTitle).forEach(function(key) {
|
57
|
+
result[key] = urlAndTitle[key];
|
58
|
+
});
|
59
|
+
});
|
60
|
+
return results;
|
61
|
+
};
|
62
|
+
|
63
|
+
SearchEngine.prototype.executeSearch = function(baseUrl, queryUrl) {
|
64
|
+
var searchEngine = this;
|
65
|
+
return searchEngine.fetchIndex(baseUrl)
|
66
|
+
.then(function(searchIndex) {
|
67
|
+
var query = searchEngine.parseSearchQuery(queryUrl),
|
68
|
+
results = searchEngine.getResults(query, searchIndex);
|
69
|
+
return Promise.resolve({ query: query, results: results });
|
70
|
+
});
|
71
|
+
};
|
@@ -0,0 +1,74 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
module.exports = SearchUi;
|
4
|
+
|
5
|
+
// eslint-disable-next-line
|
6
|
+
// based on https://github.com/angular/angular.js/blob/54ddca537/docs/app/src/search.js#L198-L206
|
7
|
+
function SearchUi(doc, options) {
|
8
|
+
var opts = options || {};
|
9
|
+
|
10
|
+
this.doc = doc;
|
11
|
+
this.inputElement = doc.getElementById(
|
12
|
+
opts.inputElementId || SearchUi.DEFAULT_SEARCH_INPUT_ID);
|
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;
|
21
|
+
}
|
22
|
+
|
23
|
+
SearchUi.DEFAULT_SEARCH_INPUT_ID = 'search-input';
|
24
|
+
SearchUi.DEFAULT_SEARCH_RESULTS_ID = 'search-results';
|
25
|
+
SearchUi.DEFAULT_EMPTY_RESULTS_MESSAGE_PREFIX = 'No results found for';
|
26
|
+
SearchUi.DEFAULT_EMPTY_RESULTS_ELEMENT_TYPE = 'p';
|
27
|
+
SearchUi.DEFAULT_EMPTY_RESULTS_ELEMENT_CLASS = 'search-empty';
|
28
|
+
|
29
|
+
function isForwardSlash(keyCode) {
|
30
|
+
return keyCode === 191;
|
31
|
+
}
|
32
|
+
|
33
|
+
function isInput(element) {
|
34
|
+
return element.tagName.toLowerCase() === 'input';
|
35
|
+
}
|
36
|
+
|
37
|
+
SearchUi.prototype.enableGlobalShortcut = function() {
|
38
|
+
var doc = this.doc,
|
39
|
+
inputElement = this.inputElement;
|
40
|
+
|
41
|
+
doc.body.onkeydown = function(event) {
|
42
|
+
if (isForwardSlash(event.keyCode) && !isInput(doc.activeElement)) {
|
43
|
+
event.stopPropagation();
|
44
|
+
event.preventDefault();
|
45
|
+
inputElement.focus();
|
46
|
+
inputElement.select();
|
47
|
+
}
|
48
|
+
};
|
49
|
+
};
|
50
|
+
|
51
|
+
SearchUi.prototype.renderResults = function(query, results, renderResults) {
|
52
|
+
if (!query) {
|
53
|
+
return;
|
54
|
+
}
|
55
|
+
this.inputElement.value = query;
|
56
|
+
|
57
|
+
if (results.length === 0) {
|
58
|
+
this.createEmptyResultsMessage(query);
|
59
|
+
this.inputElement.focus();
|
60
|
+
return;
|
61
|
+
}
|
62
|
+
renderResults(query, results, this.doc, this.resultsElement);
|
63
|
+
};
|
64
|
+
|
65
|
+
SearchUi.prototype.createEmptyResultsMessage = function(query) {
|
66
|
+
var item = this.doc.createElement(this.emptyResultsElementType),
|
67
|
+
message = this.doc.createTextNode(
|
68
|
+
this.emptyResultsMessagePrefix + ' "' + query + '".'),
|
69
|
+
parentItem = this.resultsElement.parentElement;
|
70
|
+
|
71
|
+
item.style.className = this.emptyResultsElementClass;
|
72
|
+
item.appendChild(message);
|
73
|
+
parentItem.insertBefore(item, this.resultsElement);
|
74
|
+
};
|
data/assets/js/search.js
CHANGED
@@ -1,58 +1,11 @@
|
|
1
|
-
/*
|
1
|
+
/* eslint-env browser, node */
|
2
2
|
|
3
3
|
'use strict';
|
4
4
|
|
5
|
-
var
|
6
|
-
var
|
7
|
-
var url = require('url');
|
5
|
+
var SearchEngine = require('./search-engine');
|
6
|
+
var SearchUi = require('./search-ui');
|
8
7
|
|
9
|
-
|
10
|
-
var SEARCH_RESULTS_ID = 'search-results';
|
11
|
-
|
12
|
-
function fetchIndex(baseUrl) {
|
13
|
-
return new Promise(function(resolve, reject) {
|
14
|
-
var req = new XMLHttpRequest(),
|
15
|
-
indexUrl = baseUrl + '/search-index.json';
|
16
|
-
|
17
|
-
req.addEventListener('load', function() {
|
18
|
-
var rawJson;
|
19
|
-
|
20
|
-
try {
|
21
|
-
rawJson = JSON.parse(this.responseText);
|
22
|
-
resolve({
|
23
|
-
urlToDoc: rawJson.urlToDoc,
|
24
|
-
index: lunr.Index.load(rawJson.index)
|
25
|
-
});
|
26
|
-
} catch (err) {
|
27
|
-
reject(new Error('failed to parse ' + indexUrl));
|
28
|
-
}
|
29
|
-
});
|
30
|
-
req.open('GET', indexUrl);
|
31
|
-
req.send();
|
32
|
-
});
|
33
|
-
}
|
34
|
-
|
35
|
-
function parseSearchQuery(queryUrl) {
|
36
|
-
return querystring.parse(url.parse(queryUrl).query).q;
|
37
|
-
}
|
38
|
-
|
39
|
-
function getResults(query, searchIndex) {
|
40
|
-
var results = searchIndex.index.search(query);
|
41
|
-
|
42
|
-
results.forEach(function(result) {
|
43
|
-
var urlAndTitle = searchIndex.urlToDoc[result.ref];
|
44
|
-
|
45
|
-
Object.keys(urlAndTitle).forEach(function(key) {
|
46
|
-
result[key] = urlAndTitle[key];
|
47
|
-
});
|
48
|
-
});
|
49
|
-
return results;
|
50
|
-
}
|
51
|
-
|
52
|
-
function writeResults(searchQuery, doc, searchBox, resultsList, results) {
|
53
|
-
if (searchQuery) {
|
54
|
-
searchBox.value = searchQuery;
|
55
|
-
}
|
8
|
+
function writeResultsToList(query, results, doc, resultsList) {
|
56
9
|
results.forEach(function(result, index) {
|
57
10
|
var item = doc.createElement('li'),
|
58
11
|
link = doc.createElement('a'),
|
@@ -71,50 +24,23 @@ function writeResults(searchQuery, doc, searchBox, resultsList, results) {
|
|
71
24
|
});
|
72
25
|
}
|
73
26
|
|
74
|
-
// based on https://github.com/angular/angular.js/blob/54ddca537/docs/app/src/search.js#L198-L206
|
75
|
-
function SearchUi(doc, inputElement) {
|
76
|
-
var isForwardSlash = function(keyCode) {
|
77
|
-
return keyCode === 191;
|
78
|
-
};
|
79
|
-
|
80
|
-
var isInput = function(el) {
|
81
|
-
return el.tagName.toLowerCase() === 'input';
|
82
|
-
};
|
83
|
-
|
84
|
-
var giveSearchFocus = function() {
|
85
|
-
inputElement.focus();
|
86
|
-
};
|
87
|
-
|
88
|
-
var onKeyDown = function(event) {
|
89
|
-
if (isForwardSlash(event.keyCode) && !isInput(doc.activeElement)) {
|
90
|
-
event.stopPropagation();
|
91
|
-
event.preventDefault();
|
92
|
-
giveSearchFocus();
|
93
|
-
}
|
94
|
-
};
|
95
|
-
|
96
|
-
this.enableGlobalShortcut = function() {
|
97
|
-
doc.body.onkeydown = onKeyDown;
|
98
|
-
};
|
99
|
-
}
|
100
|
-
|
101
27
|
module.exports = function() {
|
102
|
-
var
|
103
|
-
|
104
|
-
|
105
|
-
|
28
|
+
var searchUi = new SearchUi(window.document,
|
29
|
+
window.JEKYLL_PAGES_API_SEARCH_UI_OPTIONS),
|
30
|
+
searchEngine = new SearchEngine(
|
31
|
+
window.JEKYLL_PAGES_API_SEARCH_ENGINE_OPTIONS);
|
106
32
|
|
107
33
|
searchUi.enableGlobalShortcut();
|
108
34
|
|
109
|
-
if (!resultsElement) {
|
35
|
+
if (!searchUi.resultsElement) {
|
110
36
|
return;
|
111
37
|
}
|
112
38
|
|
113
|
-
return
|
114
|
-
.
|
115
|
-
|
116
|
-
|
117
|
-
|
39
|
+
return searchEngine.executeSearch(
|
40
|
+
window.JEKYLL_PAGES_API_SEARCH_BASEURL, window.location.href)
|
41
|
+
.then(function(searchResults) {
|
42
|
+
searchUi.renderResults(searchResults.query, searchResults.results,
|
43
|
+
window.renderJekyllPagesApiSearchResults || writeResultsToList);
|
118
44
|
})
|
119
45
|
.catch(function(error) {
|
120
46
|
console.error(error);
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#! /usr/bin/env node
|
2
|
+
|
3
|
+
'use strict';
|
4
|
+
|
5
|
+
var browserify = require('browserify');
|
6
|
+
var fs = require('fs');
|
7
|
+
var path = require('path');
|
8
|
+
var zlib = require('zlib');
|
9
|
+
|
10
|
+
var SOURCE = process.argv[2];
|
11
|
+
var TARGET = process.argv[3];
|
12
|
+
var errors = [];
|
13
|
+
|
14
|
+
if (!SOURCE) {
|
15
|
+
errors.push('source file not defined');
|
16
|
+
} else if (!fs.existsSync(SOURCE)) {
|
17
|
+
errors.push('source file ' + SOURCE + ' does not exist');
|
18
|
+
}
|
19
|
+
|
20
|
+
if (!TARGET) {
|
21
|
+
errors.push('target file not defined');
|
22
|
+
} else if (!fs.existsSync(path.dirname(TARGET))) {
|
23
|
+
errors.push('parent directory of target file ' + TARGET + ' does not exist');
|
24
|
+
}
|
25
|
+
|
26
|
+
if (errors.length !== 0) {
|
27
|
+
process.stderr.write(errors.join('\n') + '\n');
|
28
|
+
process.exit(1);
|
29
|
+
}
|
30
|
+
|
31
|
+
var bundler = browserify({ standalone: 'renderJekyllPagesApiSearchResults' });
|
32
|
+
var outputStream = fs.createWriteStream(TARGET);
|
33
|
+
|
34
|
+
bundler.add(SOURCE)
|
35
|
+
.transform({ global: true }, 'uglifyify')
|
36
|
+
.bundle()
|
37
|
+
.pipe(outputStream);
|
38
|
+
|
39
|
+
outputStream.on('close', function() {
|
40
|
+
var gzip = zlib.createGzip({ level: zlib.BEST_COMPRESSION });
|
41
|
+
fs.createReadStream(TARGET)
|
42
|
+
.pipe(gzip)
|
43
|
+
.pipe(fs.createWriteStream(TARGET + '.gz'));
|
44
|
+
});
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require_relative './config'
|
2
|
+
|
3
|
+
require 'English'
|
4
|
+
require 'jekyll/static_file'
|
5
|
+
require 'jekyll_pages_api'
|
6
|
+
|
7
|
+
module JekyllPagesApiSearch
|
8
|
+
class Browserify
|
9
|
+
DIRNAME = File.dirname(__FILE__).freeze
|
10
|
+
BROWSERIFY_SCRIPT = File.join(DIRNAME, 'browserify.js').freeze
|
11
|
+
|
12
|
+
def self.create_bundle(site)
|
13
|
+
browserify_config = Config.get(site, 'browserify')
|
14
|
+
return if browserify_config.nil?
|
15
|
+
source = File.join(site.source, browserify_config['source'])
|
16
|
+
target = File.join(site.dest, browserify_config['target'])
|
17
|
+
execute_browserify(source, target)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.execute_browserify(source, target)
|
21
|
+
status = system("node #{BROWSERIFY_SCRIPT} #{source} #{target}")
|
22
|
+
if $CHILD_STATUS.exitstatus.nil?
|
23
|
+
$stderr.puts('Could not execute browserify script')
|
24
|
+
exit 1
|
25
|
+
end
|
26
|
+
exit $CHILD_STATUS.exitstatus if !status
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
@media screen and (min-width: 45em) {
|
2
|
-
|
2
|
+
.search-interface{
|
3
3
|
width: 30%;
|
4
4
|
float: right;
|
5
5
|
}
|
6
6
|
}
|
7
7
|
|
8
|
-
|
8
|
+
.search-interface input {
|
9
9
|
display: block;
|
10
10
|
-webkit-box-sizing: border-box;
|
11
11
|
width: 100%;
|
@@ -18,7 +18,7 @@ div.search-interface input {
|
|
18
18
|
background-size: 16px;
|
19
19
|
}
|
20
20
|
|
21
|
-
|
21
|
+
.search-interface button {
|
22
22
|
position: absolute;
|
23
23
|
left: -9999em;
|
24
24
|
bottom: 3px;
|
@@ -32,13 +32,14 @@ div.search-interface form button {
|
|
32
32
|
padding: 4px 12px;
|
33
33
|
}
|
34
34
|
|
35
|
-
|
35
|
+
.search-interface button:hover {
|
36
36
|
background-color: #eee;
|
37
37
|
color: #111;
|
38
38
|
border-color: #bbb;
|
39
39
|
}
|
40
40
|
|
41
|
-
.sr-only
|
41
|
+
.sr-only,
|
42
|
+
.search-interface span.label-text {
|
42
43
|
position: absolute;
|
43
44
|
overflow: hidden;
|
44
45
|
width:1px;
|
@@ -1,11 +1,10 @@
|
|
1
|
-
<
|
2
|
-
<
|
3
|
-
<
|
4
|
-
<label>
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
</div>
|
1
|
+
<form action="{{ search_endpoint }}" class="search-interface">
|
2
|
+
<div class="field">
|
3
|
+
<label>
|
4
|
+
<span class="label-text">Search</span>
|
5
|
+
<input type="search" id="search-input" name="q"
|
6
|
+
placeholder="{{ placeholder }}">
|
7
|
+
</label>
|
8
|
+
</div>
|
9
|
+
<button type="submit">Search</button>
|
10
|
+
</form>
|
@@ -28,15 +28,23 @@ module JekyllPagesApiSearch
|
|
28
28
|
|
29
29
|
def render(context)
|
30
30
|
return @code if @code
|
31
|
-
|
32
|
-
|
31
|
+
site = context.registers[:site]
|
32
|
+
baseurl = site.config['baseurl']
|
33
|
+
@code = LoadSearchTag.generate_script(baseurl, site: site)
|
33
34
|
end
|
34
35
|
|
35
|
-
def self.generate_script(baseurl)
|
36
|
-
"<script>
|
36
|
+
def self.generate_script(baseurl, site: nil)
|
37
|
+
"<script>JEKYLL_PAGES_API_SEARCH_BASEURL = '#{baseurl}';</script>\n" +
|
38
|
+
site_bundle_load_tag(site, baseurl) +
|
37
39
|
"<script async src=\"#{baseurl}/assets/js/search-bundle.js\">" +
|
38
40
|
"</script>"
|
39
41
|
end
|
42
|
+
|
43
|
+
def self.site_bundle_load_tag(site, baseurl)
|
44
|
+
browserify_config = site.nil? ? nil : Config.get(site, 'browserify')
|
45
|
+
return '' if browserify_config.nil?
|
46
|
+
"<script src=\"#{baseurl}/#{browserify_config['target']}\"></script>\n"
|
47
|
+
end
|
40
48
|
end
|
41
49
|
|
42
50
|
class SearchResultsTag < Liquid::Tag
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_pages_api_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Bland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll_pages_api
|
@@ -150,12 +150,16 @@ files:
|
|
150
150
|
- README.md
|
151
151
|
- assets/js/search-bundle.js
|
152
152
|
- assets/js/search-bundle.js.gz
|
153
|
+
- assets/js/search-engine.js
|
154
|
+
- assets/js/search-ui.js
|
153
155
|
- assets/js/search.js
|
154
156
|
- assets/png/search.png
|
155
157
|
- assets/svg/search.svg
|
156
158
|
- bin/jekyll_pages_api_search
|
157
159
|
- lib/jekyll_pages_api_search.rb
|
158
160
|
- lib/jekyll_pages_api_search/assets.rb
|
161
|
+
- lib/jekyll_pages_api_search/browserify.js
|
162
|
+
- lib/jekyll_pages_api_search/browserify.rb
|
159
163
|
- lib/jekyll_pages_api_search/compressor.rb
|
160
164
|
- lib/jekyll_pages_api_search/config.rb
|
161
165
|
- lib/jekyll_pages_api_search/generator.rb
|
@@ -193,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
197
|
version: '0'
|
194
198
|
requirements: []
|
195
199
|
rubyforge_project:
|
196
|
-
rubygems_version: 2.4.
|
200
|
+
rubygems_version: 2.4.8
|
197
201
|
signing_key:
|
198
202
|
specification_version: 4
|
199
203
|
summary: Adds lunr.js search based on the jekyll_pages_api gem
|