ovto 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.gitmodules +3 -0
  4. data/CHANGELOG.md +22 -0
  5. data/Gemfile +7 -0
  6. data/Gemfile.lock +57 -0
  7. data/LICENSE.txt +44 -0
  8. data/README.md +84 -0
  9. data/Rakefile +41 -0
  10. data/book/README.md +1 -0
  11. data/book/SUMMARY.md +13 -0
  12. data/book/api/actions.md +77 -0
  13. data/book/api/app.md +86 -0
  14. data/book/api/component.md +175 -0
  15. data/book/api/fetch.md +42 -0
  16. data/book/api/state.md +97 -0
  17. data/book/guides/debugging.md +23 -0
  18. data/book/guides/development.md +11 -0
  19. data/book/guides/tutorial.md +288 -0
  20. data/book/screenshot.png +0 -0
  21. data/docs/api/Ovto/Actions.html +135 -0
  22. data/docs/api/Ovto/App.html +531 -0
  23. data/docs/api/Ovto/Component/MoreThanOneNode.html +135 -0
  24. data/docs/api/Ovto/Component.html +350 -0
  25. data/docs/api/Ovto/Runtime.html +315 -0
  26. data/docs/api/Ovto/State/MissingValue.html +135 -0
  27. data/docs/api/Ovto/State/UnknownKey.html +135 -0
  28. data/docs/api/Ovto/State.html +699 -0
  29. data/docs/api/Ovto/WiredActions.html +343 -0
  30. data/docs/api/Ovto.html +319 -0
  31. data/docs/api/_index.html +229 -0
  32. data/docs/api/actions.html +398 -0
  33. data/docs/api/app.html +411 -0
  34. data/docs/api/class_list.html +51 -0
  35. data/docs/api/component.html +469 -0
  36. data/docs/api/css/common.css +1 -0
  37. data/docs/api/css/full_list.css +58 -0
  38. data/docs/api/css/style.css +499 -0
  39. data/docs/api/file.README.html +162 -0
  40. data/docs/api/file_list.html +56 -0
  41. data/docs/api/frames.html +17 -0
  42. data/docs/api/index.html +162 -0
  43. data/docs/api/js/app.js +248 -0
  44. data/docs/api/js/full_list.js +216 -0
  45. data/docs/api/js/jquery.js +4 -0
  46. data/docs/api/method_list.html +243 -0
  47. data/docs/api/state.html +430 -0
  48. data/docs/api/top-level-namespace.html +110 -0
  49. data/docs/gitbook/fonts/fontawesome/FontAwesome.otf +0 -0
  50. data/docs/gitbook/fonts/fontawesome/fontawesome-webfont.eot +0 -0
  51. data/docs/gitbook/fonts/fontawesome/fontawesome-webfont.svg +685 -0
  52. data/docs/gitbook/fonts/fontawesome/fontawesome-webfont.ttf +0 -0
  53. data/docs/gitbook/fonts/fontawesome/fontawesome-webfont.woff +0 -0
  54. data/docs/gitbook/fonts/fontawesome/fontawesome-webfont.woff2 +0 -0
  55. data/docs/gitbook/gitbook-plugin-fontsettings/fontsettings.js +240 -0
  56. data/docs/gitbook/gitbook-plugin-fontsettings/website.css +291 -0
  57. data/docs/gitbook/gitbook-plugin-highlight/ebook.css +135 -0
  58. data/docs/gitbook/gitbook-plugin-highlight/website.css +434 -0
  59. data/docs/gitbook/gitbook-plugin-lunr/lunr.min.js +7 -0
  60. data/docs/gitbook/gitbook-plugin-lunr/search-lunr.js +59 -0
  61. data/docs/gitbook/gitbook-plugin-search/lunr.min.js +7 -0
  62. data/docs/gitbook/gitbook-plugin-search/search-engine.js +50 -0
  63. data/docs/gitbook/gitbook-plugin-search/search.css +35 -0
  64. data/docs/gitbook/gitbook-plugin-search/search.js +213 -0
  65. data/docs/gitbook/gitbook-plugin-sharing/buttons.js +90 -0
  66. data/docs/gitbook/gitbook.js +4 -0
  67. data/docs/gitbook/images/apple-touch-icon-precomposed-152.png +0 -0
  68. data/docs/gitbook/images/favicon.ico +0 -0
  69. data/docs/gitbook/style.css +9 -0
  70. data/docs/gitbook/theme.js +4 -0
  71. data/docs/guides/debugging.html +355 -0
  72. data/docs/guides/development.html +361 -0
  73. data/docs/guides/tutorial.html +571 -0
  74. data/docs/index.html +422 -0
  75. data/docs/screenshot.png +0 -0
  76. data/docs/search_index.json +1 -0
  77. data/example/sinatra/Gemfile +6 -0
  78. data/example/sinatra/Gemfile.lock +59 -0
  79. data/example/sinatra/README.md +21 -0
  80. data/example/sinatra/app.rb +18 -0
  81. data/example/sinatra/config.ru +30 -0
  82. data/example/sinatra/ovto/app.rb +171 -0
  83. data/example/sinatra/public/style.css +4 -0
  84. data/example/sinatra/public/todomvc-app-css_index.css +376 -0
  85. data/example/sinatra/public/todomvc-common_base.css +141 -0
  86. data/example/sinatra/views/index.erb +21 -0
  87. data/example/static/Gemfile +3 -0
  88. data/example/static/Gemfile.lock +30 -0
  89. data/example/static/README.md +10 -0
  90. data/example/static/Rakefile +4 -0
  91. data/example/static/app.js +24808 -0
  92. data/example/static/app.rb +43 -0
  93. data/example/static/index.html +11 -0
  94. data/lib/ovto/actions.rb +10 -0
  95. data/lib/ovto/app.rb +58 -0
  96. data/lib/ovto/component.rb +191 -0
  97. data/lib/ovto/fetch.rb +53 -0
  98. data/lib/ovto/runtime.rb +388 -0
  99. data/lib/ovto/state.rb +69 -0
  100. data/lib/ovto/version.rb +3 -0
  101. data/lib/ovto/wired_actions.rb +33 -0
  102. data/lib/ovto.rb +50 -0
  103. data/ovto.gemspec +22 -0
  104. data/screenshot.png +0 -0
  105. metadata +161 -0
@@ -0,0 +1,434 @@
1
+ .book .book-body .page-wrapper .page-inner section.normal pre,
2
+ .book .book-body .page-wrapper .page-inner section.normal code {
3
+ /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
4
+ /* Tomorrow Comment */
5
+ /* Tomorrow Red */
6
+ /* Tomorrow Orange */
7
+ /* Tomorrow Yellow */
8
+ /* Tomorrow Green */
9
+ /* Tomorrow Aqua */
10
+ /* Tomorrow Blue */
11
+ /* Tomorrow Purple */
12
+ }
13
+ .book .book-body .page-wrapper .page-inner section.normal pre .hljs-comment,
14
+ .book .book-body .page-wrapper .page-inner section.normal code .hljs-comment,
15
+ .book .book-body .page-wrapper .page-inner section.normal pre .hljs-title,
16
+ .book .book-body .page-wrapper .page-inner section.normal code .hljs-title {
17
+ color: #8e908c;
18
+ }
19
+ .book .book-body .page-wrapper .page-inner section.normal pre .hljs-variable,
20
+ .book .book-body .page-wrapper .page-inner section.normal code .hljs-variable,
21
+ .book .book-body .page-wrapper .page-inner section.normal pre .hljs-attribute,
22
+ .book .book-body .page-wrapper .page-inner section.normal code .hljs-attribute,
23
+ .book .book-body .page-wrapper .page-inner section.normal pre .hljs-tag,
24
+ .book .book-body .page-wrapper .page-inner section.normal code .hljs-tag,
25
+ .book .book-body .page-wrapper .page-inner section.normal pre .hljs-regexp,
26
+ .book .book-body .page-wrapper .page-inner section.normal code .hljs-regexp,
27
+ .book .book-body .page-wrapper .page-inner section.normal pre .hljs-deletion,
28
+ .book .book-body .page-wrapper .page-inner section.normal code .hljs-deletion,
29
+ .book .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-constant,
30
+ .book .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-constant,
31
+ .book .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-tag .hljs-title,
32
+ .book .book-body .page-wrapper .page-inner section.normal code .xml .hljs-tag .hljs-title,
33
+ .book .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-pi,
34
+ .book .book-body .page-wrapper .page-inner section.normal code .xml .hljs-pi,
35
+ .book .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-doctype,
36
+ .book .book-body .page-wrapper .page-inner section.normal code .xml .hljs-doctype,
37
+ .book .book-body .page-wrapper .page-inner section.normal pre .html .hljs-doctype,
38
+ .book .book-body .page-wrapper .page-inner section.normal code .html .hljs-doctype,
39
+ .book .book-body .page-wrapper .page-inner section.normal pre .css .hljs-id,
40
+ .book .book-body .page-wrapper .page-inner section.normal code .css .hljs-id,
41
+ .book .book-body .page-wrapper .page-inner section.normal pre .css .hljs-class,
42
+ .book .book-body .page-wrapper .page-inner section.normal code .css .hljs-class,
43
+ .book .book-body .page-wrapper .page-inner section.normal pre .css .hljs-pseudo,
44
+ .book .book-body .page-wrapper .page-inner section.normal code .css .hljs-pseudo {
45
+ color: #c82829;
46
+ }
47
+ .book .book-body .page-wrapper .page-inner section.normal pre .hljs-number,
48
+ .book .book-body .page-wrapper .page-inner section.normal code .hljs-number,
49
+ .book .book-body .page-wrapper .page-inner section.normal pre .hljs-preprocessor,
50
+ .book .book-body .page-wrapper .page-inner section.normal code .hljs-preprocessor,
51
+ .book .book-body .page-wrapper .page-inner section.normal pre .hljs-pragma,
52
+ .book .book-body .page-wrapper .page-inner section.normal code .hljs-pragma,
53
+ .book .book-body .page-wrapper .page-inner section.normal pre .hljs-built_in,
54
+ .book .book-body .page-wrapper .page-inner section.normal code .hljs-built_in,
55
+ .book .book-body .page-wrapper .page-inner section.normal pre .hljs-literal,
56
+ .book .book-body .page-wrapper .page-inner section.normal code .hljs-literal,
57
+ .book .book-body .page-wrapper .page-inner section.normal pre .hljs-params,
58
+ .book .book-body .page-wrapper .page-inner section.normal code .hljs-params,
59
+ .book .book-body .page-wrapper .page-inner section.normal pre .hljs-constant,
60
+ .book .book-body .page-wrapper .page-inner section.normal code .hljs-constant {
61
+ color: #f5871f;
62
+ }
63
+ .book .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-class .hljs-title,
64
+ .book .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-class .hljs-title,
65
+ .book .book-body .page-wrapper .page-inner section.normal pre .css .hljs-rules .hljs-attribute,
66
+ .book .book-body .page-wrapper .page-inner section.normal code .css .hljs-rules .hljs-attribute {
67
+ color: #eab700;
68
+ }
69
+ .book .book-body .page-wrapper .page-inner section.normal pre .hljs-string,
70
+ .book .book-body .page-wrapper .page-inner section.normal code .hljs-string,
71
+ .book .book-body .page-wrapper .page-inner section.normal pre .hljs-value,
72
+ .book .book-body .page-wrapper .page-inner section.normal code .hljs-value,
73
+ .book .book-body .page-wrapper .page-inner section.normal pre .hljs-inheritance,
74
+ .book .book-body .page-wrapper .page-inner section.normal code .hljs-inheritance,
75
+ .book .book-body .page-wrapper .page-inner section.normal pre .hljs-header,
76
+ .book .book-body .page-wrapper .page-inner section.normal code .hljs-header,
77
+ .book .book-body .page-wrapper .page-inner section.normal pre .hljs-addition,
78
+ .book .book-body .page-wrapper .page-inner section.normal code .hljs-addition,
79
+ .book .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-symbol,
80
+ .book .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-symbol,
81
+ .book .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-cdata,
82
+ .book .book-body .page-wrapper .page-inner section.normal code .xml .hljs-cdata {
83
+ color: #718c00;
84
+ }
85
+ .book .book-body .page-wrapper .page-inner section.normal pre .css .hljs-hexcolor,
86
+ .book .book-body .page-wrapper .page-inner section.normal code .css .hljs-hexcolor {
87
+ color: #3e999f;
88
+ }
89
+ .book .book-body .page-wrapper .page-inner section.normal pre .hljs-function,
90
+ .book .book-body .page-wrapper .page-inner section.normal code .hljs-function,
91
+ .book .book-body .page-wrapper .page-inner section.normal pre .python .hljs-decorator,
92
+ .book .book-body .page-wrapper .page-inner section.normal code .python .hljs-decorator,
93
+ .book .book-body .page-wrapper .page-inner section.normal pre .python .hljs-title,
94
+ .book .book-body .page-wrapper .page-inner section.normal code .python .hljs-title,
95
+ .book .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-function .hljs-title,
96
+ .book .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-function .hljs-title,
97
+ .book .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-title .hljs-keyword,
98
+ .book .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-title .hljs-keyword,
99
+ .book .book-body .page-wrapper .page-inner section.normal pre .perl .hljs-sub,
100
+ .book .book-body .page-wrapper .page-inner section.normal code .perl .hljs-sub,
101
+ .book .book-body .page-wrapper .page-inner section.normal pre .javascript .hljs-title,
102
+ .book .book-body .page-wrapper .page-inner section.normal code .javascript .hljs-title,
103
+ .book .book-body .page-wrapper .page-inner section.normal pre .coffeescript .hljs-title,
104
+ .book .book-body .page-wrapper .page-inner section.normal code .coffeescript .hljs-title {
105
+ color: #4271ae;
106
+ }
107
+ .book .book-body .page-wrapper .page-inner section.normal pre .hljs-keyword,
108
+ .book .book-body .page-wrapper .page-inner section.normal code .hljs-keyword,
109
+ .book .book-body .page-wrapper .page-inner section.normal pre .javascript .hljs-function,
110
+ .book .book-body .page-wrapper .page-inner section.normal code .javascript .hljs-function {
111
+ color: #8959a8;
112
+ }
113
+ .book .book-body .page-wrapper .page-inner section.normal pre .hljs,
114
+ .book .book-body .page-wrapper .page-inner section.normal code .hljs {
115
+ display: block;
116
+ background: white;
117
+ color: #4d4d4c;
118
+ padding: 0.5em;
119
+ }
120
+ .book .book-body .page-wrapper .page-inner section.normal pre .coffeescript .javascript,
121
+ .book .book-body .page-wrapper .page-inner section.normal code .coffeescript .javascript,
122
+ .book .book-body .page-wrapper .page-inner section.normal pre .javascript .xml,
123
+ .book .book-body .page-wrapper .page-inner section.normal code .javascript .xml,
124
+ .book .book-body .page-wrapper .page-inner section.normal pre .tex .hljs-formula,
125
+ .book .book-body .page-wrapper .page-inner section.normal code .tex .hljs-formula,
126
+ .book .book-body .page-wrapper .page-inner section.normal pre .xml .javascript,
127
+ .book .book-body .page-wrapper .page-inner section.normal code .xml .javascript,
128
+ .book .book-body .page-wrapper .page-inner section.normal pre .xml .vbscript,
129
+ .book .book-body .page-wrapper .page-inner section.normal code .xml .vbscript,
130
+ .book .book-body .page-wrapper .page-inner section.normal pre .xml .css,
131
+ .book .book-body .page-wrapper .page-inner section.normal code .xml .css,
132
+ .book .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-cdata,
133
+ .book .book-body .page-wrapper .page-inner section.normal code .xml .hljs-cdata {
134
+ opacity: 0.5;
135
+ }
136
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre,
137
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code {
138
+ /*
139
+
140
+ Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull <sourdrums@gmail.com>
141
+
142
+ */
143
+ /* Solarized Green */
144
+ /* Solarized Cyan */
145
+ /* Solarized Blue */
146
+ /* Solarized Yellow */
147
+ /* Solarized Orange */
148
+ /* Solarized Red */
149
+ /* Solarized Violet */
150
+ }
151
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs,
152
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs {
153
+ display: block;
154
+ padding: 0.5em;
155
+ background: #fdf6e3;
156
+ color: #657b83;
157
+ }
158
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-comment,
159
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-comment,
160
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-template_comment,
161
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-template_comment,
162
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .diff .hljs-header,
163
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .diff .hljs-header,
164
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-doctype,
165
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-doctype,
166
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-pi,
167
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-pi,
168
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .lisp .hljs-string,
169
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .lisp .hljs-string,
170
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-javadoc,
171
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-javadoc {
172
+ color: #93a1a1;
173
+ }
174
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-keyword,
175
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-keyword,
176
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-winutils,
177
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-winutils,
178
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .method,
179
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .method,
180
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-addition,
181
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-addition,
182
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-tag,
183
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .css .hljs-tag,
184
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-request,
185
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-request,
186
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-status,
187
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-status,
188
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .nginx .hljs-title,
189
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .nginx .hljs-title {
190
+ color: #859900;
191
+ }
192
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-number,
193
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-number,
194
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-command,
195
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-command,
196
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-string,
197
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-string,
198
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-tag .hljs-value,
199
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-tag .hljs-value,
200
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-rules .hljs-value,
201
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-rules .hljs-value,
202
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-phpdoc,
203
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-phpdoc,
204
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .tex .hljs-formula,
205
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .tex .hljs-formula,
206
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-regexp,
207
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-regexp,
208
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-hexcolor,
209
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-hexcolor,
210
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-link_url,
211
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-link_url {
212
+ color: #2aa198;
213
+ }
214
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-title,
215
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-title,
216
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-localvars,
217
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-localvars,
218
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-chunk,
219
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-chunk,
220
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-decorator,
221
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-decorator,
222
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-built_in,
223
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-built_in,
224
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-identifier,
225
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-identifier,
226
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .vhdl .hljs-literal,
227
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .vhdl .hljs-literal,
228
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-id,
229
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-id,
230
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-function,
231
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .css .hljs-function {
232
+ color: #268bd2;
233
+ }
234
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-attribute,
235
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-attribute,
236
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-variable,
237
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-variable,
238
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .lisp .hljs-body,
239
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .lisp .hljs-body,
240
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .smalltalk .hljs-number,
241
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .smalltalk .hljs-number,
242
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-constant,
243
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-constant,
244
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-class .hljs-title,
245
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-class .hljs-title,
246
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-parent,
247
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-parent,
248
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .haskell .hljs-type,
249
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .haskell .hljs-type,
250
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-link_reference,
251
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-link_reference {
252
+ color: #b58900;
253
+ }
254
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-preprocessor,
255
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-preprocessor,
256
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-preprocessor .hljs-keyword,
257
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-preprocessor .hljs-keyword,
258
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-pragma,
259
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-pragma,
260
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-shebang,
261
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-shebang,
262
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-symbol,
263
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-symbol,
264
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-symbol .hljs-string,
265
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-symbol .hljs-string,
266
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .diff .hljs-change,
267
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .diff .hljs-change,
268
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-special,
269
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-special,
270
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-attr_selector,
271
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-attr_selector,
272
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-subst,
273
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-subst,
274
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-cdata,
275
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-cdata,
276
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .clojure .hljs-title,
277
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .clojure .hljs-title,
278
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-pseudo,
279
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .css .hljs-pseudo,
280
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-header,
281
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-header {
282
+ color: #cb4b16;
283
+ }
284
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-deletion,
285
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-deletion,
286
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-important,
287
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-important {
288
+ color: #dc322f;
289
+ }
290
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-link_label,
291
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-link_label {
292
+ color: #6c71c4;
293
+ }
294
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .tex .hljs-formula,
295
+ .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .tex .hljs-formula {
296
+ background: #eee8d5;
297
+ }
298
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre,
299
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code {
300
+ /* Tomorrow Night Bright Theme */
301
+ /* Original theme - https://github.com/chriskempson/tomorrow-theme */
302
+ /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
303
+ /* Tomorrow Comment */
304
+ /* Tomorrow Red */
305
+ /* Tomorrow Orange */
306
+ /* Tomorrow Yellow */
307
+ /* Tomorrow Green */
308
+ /* Tomorrow Aqua */
309
+ /* Tomorrow Blue */
310
+ /* Tomorrow Purple */
311
+ }
312
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-comment,
313
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-comment,
314
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-title,
315
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-title {
316
+ color: #969896;
317
+ }
318
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-variable,
319
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-variable,
320
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-attribute,
321
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-attribute,
322
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-tag,
323
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-tag,
324
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-regexp,
325
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-regexp,
326
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-deletion,
327
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-deletion,
328
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-constant,
329
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-constant,
330
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-tag .hljs-title,
331
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .hljs-tag .hljs-title,
332
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-pi,
333
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .hljs-pi,
334
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-doctype,
335
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .hljs-doctype,
336
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .html .hljs-doctype,
337
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .html .hljs-doctype,
338
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-id,
339
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .css .hljs-id,
340
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-class,
341
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .css .hljs-class,
342
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-pseudo,
343
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .css .hljs-pseudo {
344
+ color: #d54e53;
345
+ }
346
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-number,
347
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-number,
348
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-preprocessor,
349
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-preprocessor,
350
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-pragma,
351
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-pragma,
352
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-built_in,
353
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-built_in,
354
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-literal,
355
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-literal,
356
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-params,
357
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-params,
358
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-constant,
359
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-constant {
360
+ color: #e78c45;
361
+ }
362
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-class .hljs-title,
363
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-class .hljs-title,
364
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-rules .hljs-attribute,
365
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .css .hljs-rules .hljs-attribute {
366
+ color: #e7c547;
367
+ }
368
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-string,
369
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-string,
370
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-value,
371
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-value,
372
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-inheritance,
373
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-inheritance,
374
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-header,
375
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-header,
376
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-addition,
377
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-addition,
378
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-symbol,
379
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-symbol,
380
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-cdata,
381
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .hljs-cdata {
382
+ color: #b9ca4a;
383
+ }
384
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-hexcolor,
385
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .css .hljs-hexcolor {
386
+ color: #70c0b1;
387
+ }
388
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-function,
389
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-function,
390
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .python .hljs-decorator,
391
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .python .hljs-decorator,
392
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .python .hljs-title,
393
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .python .hljs-title,
394
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-function .hljs-title,
395
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-function .hljs-title,
396
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-title .hljs-keyword,
397
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-title .hljs-keyword,
398
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .perl .hljs-sub,
399
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .perl .hljs-sub,
400
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .javascript .hljs-title,
401
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .javascript .hljs-title,
402
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .coffeescript .hljs-title,
403
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .coffeescript .hljs-title {
404
+ color: #7aa6da;
405
+ }
406
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-keyword,
407
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-keyword,
408
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .javascript .hljs-function,
409
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .javascript .hljs-function {
410
+ color: #c397d8;
411
+ }
412
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs,
413
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs {
414
+ display: block;
415
+ background: black;
416
+ color: #eaeaea;
417
+ padding: 0.5em;
418
+ }
419
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .coffeescript .javascript,
420
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .coffeescript .javascript,
421
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .javascript .xml,
422
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .javascript .xml,
423
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .tex .hljs-formula,
424
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .tex .hljs-formula,
425
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .javascript,
426
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .javascript,
427
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .vbscript,
428
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .vbscript,
429
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .css,
430
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .css,
431
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-cdata,
432
+ .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .hljs-cdata {
433
+ opacity: 0.5;
434
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.5.12
3
+ * Copyright (C) 2015 Oliver Nightingale
4
+ * MIT Licensed
5
+ * @license
6
+ */
7
+ !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.5.12",t.utils={},t.utils.warn=function(t){return function(e){t.console&&console.warn&&console.warn(e)}}(this),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(t){return arguments.length&&null!=t&&void 0!=t?Array.isArray(t)?t.map(function(t){return t.toLowerCase()}):t.toString().trim().toLowerCase().split(/[\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,o=0;n>o;o++){for(var r=t[o],s=0;i>s&&(r=this._stack[s](r,o,t),void 0!==r);s++);void 0!==r&&e.push(r)}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 o=i,r=i.next;void 0!=r;){if(e<r.idx)return o.next=new t.Vector.Node(e,n,r),this.length++;o=r,r=r.next}return o.next=new t.Vector.Node(e,n,r),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,o=e+Math.floor(i/2),r=this.elements[o];i>1;){if(r===t)return o;t>r&&(e=o),r>t&&(n=o),i=n-e,o=e+Math.floor(i/2),r=this.elements[o]}return r===t?o:-1},t.SortedSet.prototype.locationFor=function(t){for(var e=0,n=this.elements.length,i=n-e,o=e+Math.floor(i/2),r=this.elements[o];i>1;)t>r&&(e=o),r>t&&(n=o),i=n-e,o=e+Math.floor(i/2),r=this.elements[o];return r>t?o:t>r?o+1:void 0},t.SortedSet.prototype.intersect=function(e){for(var n=new t.SortedSet,i=0,o=0,r=this.length,s=e.length,a=this.elements,h=e.elements;;){if(i>r-1||o>s-1)break;a[i]!==h[o]?a[i]<h[o]?i++:a[i]>h[o]&&o++:(n.add(a[i]),i++,o++)}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={},o=new t.SortedSet,r=e[this._ref],n=void 0===n?!0:n;this._fields.forEach(function(n){var r=this.pipeline.run(t.tokenizer(e[n.name]));i[n.name]=r,t.SortedSet.prototype.add.apply(o,r)},this),this.documentStore.set(r,o),t.SortedSet.prototype.add.apply(this.corpusTokens,o.toArray());for(var s=0;s<o.length;s++){var a=o.elements[s],h=this._fields.reduce(function(t,e){var n=i[e.name].length;if(!n)return t;var o=i[e.name].filter(function(t){return t===a}).length;return t+o/n*e.boost},0);this.tokenStore.add(a,{ref:r,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,o=[],r=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*r,h=this,l=this.tokenStore.expand(e).reduce(function(n,o){var r=h.corpusTokens.indexOf(o),s=h.idf(o),l=1,u=new t.SortedSet;if(o!==e){var c=Math.max(3,o.length-e.length);l=1/Math.log(c)}return r>-1&&i.insert(r,a*s*l),Object.keys(h.tokenStore.get(o)).forEach(function(t){u.add(t)}),n.union(u)},new t.SortedSet);o.push(l)},this);var a=o.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,o=new t.Vector,r=0;i>r;r++){var s=n.elements[r],a=this.tokenStore.get(s)[e].tf,h=this.idf(s);o.insert(this.corpusTokens.indexOf(s),a*h)}return o},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]",o=n+"[^aeiouy]*",r=i+"[aeiou]*",s="^("+o+")?"+r+o,a="^("+o+")?"+r+o+"("+r+")?$",h="^("+o+")?"+r+o+r+o,l="^("+o+")?"+i,u=new RegExp(s),c=new RegExp(h),f=new RegExp(a),d=new RegExp(l),p=/^(.+?)(ss|i)es$/,m=/^(.+?)([^s])s$/,v=/^(.+?)eed$/,y=/^(.+?)(ed|ing)$/,g=/.$/,S=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\1$"),x=new RegExp("^"+o+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("^"+o+i+"[^aeiouwxy]$"),T=function(n){var i,o,r,s,a,h,l;if(n.length<3)return n;if(r=n.substr(0,1),"y"==r&&(n=r.toUpperCase()+n.substr(1)),s=p,a=m,s.test(n)?n=n.replace(s,"$1$2"):a.test(n)&&(n=n.replace(a,"$1$2")),s=v,a=y,s.test(n)){var T=s.exec(n);s=u,s.test(T[1])&&(s=g,n=n.replace(s,""))}else if(a.test(n)){var T=a.exec(n);i=T[1],a=d,a.test(i)&&(n=i,a=S,h=w,l=x,a.test(n)?n+="e":h.test(n)?(s=g,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],o=T[2],s=u,s.test(i)&&(n=i+t[o])}if(s=E,s.test(n)){var T=s.exec(n);i=T[1],o=T[2],s=u,s.test(i)&&(n=i+e[o])}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=g,n=n.replace(s,"")),"y"==r&&(n=r.toLowerCase()+n.substr(1)),n};return T}(),t.Pipeline.registerFunction(t.stemmer,"stemmer"),t.stopWordFilter=function(e){return e&&t.stopWordFilter.stopWords[e]!==e?e:void 0},t.stopWordFilter.stopWords={a:"a",able:"able",about:"about",across:"across",after:"after",all:"all",almost:"almost",also:"also",am:"am",among:"among",an:"an",and:"and",any:"any",are:"are",as:"as",at:"at",be:"be",because:"because",been:"been",but:"but",by:"by",can:"can",cannot:"cannot",could:"could",dear:"dear",did:"did","do":"do",does:"does",either:"either","else":"else",ever:"ever",every:"every","for":"for",from:"from",get:"get",got:"got",had:"had",has:"has",have:"have",he:"he",her:"her",hers:"hers",him:"him",his:"his",how:"how",however:"however",i:"i","if":"if","in":"in",into:"into",is:"is",it:"it",its:"its",just:"just",least:"least",let:"let",like:"like",likely:"likely",may:"may",me:"me",might:"might",most:"most",must:"must",my:"my",neither:"neither",no:"no",nor:"nor",not:"not",of:"of",off:"off",often:"often",on:"on",only:"only",or:"or",other:"other",our:"our",own:"own",rather:"rather",said:"said",say:"say",says:"says",she:"she",should:"should",since:"since",so:"so",some:"some",than:"than",that:"that",the:"the",their:"their",them:"them",then:"then",there:"there",these:"these",they:"they","this":"this",tis:"tis",to:"to",too:"too",twas:"twas",us:"us",wants:"wants",was:"was",we:"we",were:"were",what:"what",when:"when",where:"where",which:"which","while":"while",who:"who",whom:"whom",why:"why",will:"will","with":"with",would:"would",yet:"yet",you:"you",your:"your"},t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter"),t.trimmer=function(t){var e=t.replace(/^\W+/,"").replace(/\W+$/,"");return""===e?void 0:e},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[0],o=t.slice(1);return i in n||(n[i]={docs:{}}),0===o.length?(n[i].docs[e.ref]=e,void(this.length+=1)):this.add(o,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[n]])return!1;e=e[t[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[n]])return{};e=e[t[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[i]in n))return;n=n[t[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})}();
@@ -0,0 +1,59 @@
1
+ require([
2
+ 'gitbook',
3
+ 'jquery'
4
+ ], function(gitbook, $) {
5
+ // Define global search engine
6
+ function LunrSearchEngine() {
7
+ this.index = null;
8
+ this.store = {};
9
+ this.name = 'LunrSearchEngine';
10
+ }
11
+
12
+ // Initialize lunr by fetching the search index
13
+ LunrSearchEngine.prototype.init = function() {
14
+ var that = this;
15
+ var d = $.Deferred();
16
+
17
+ $.getJSON(gitbook.state.basePath+'/search_index.json')
18
+ .then(function(data) {
19
+ // eslint-disable-next-line no-undef
20
+ that.index = lunr.Index.load(data.index);
21
+ that.store = data.store;
22
+ d.resolve();
23
+ });
24
+
25
+ return d.promise();
26
+ };
27
+
28
+ // Search for a term and return results
29
+ LunrSearchEngine.prototype.search = function(q, offset, length) {
30
+ var that = this;
31
+ var results = [];
32
+
33
+ if (this.index) {
34
+ results = $.map(this.index.search(q), function(result) {
35
+ var doc = that.store[result.ref];
36
+
37
+ return {
38
+ title: doc.title,
39
+ url: doc.url,
40
+ body: doc.summary || doc.body
41
+ };
42
+ });
43
+ }
44
+
45
+ return $.Deferred().resolve({
46
+ query: q,
47
+ results: results.slice(0, length),
48
+ count: results.length
49
+ }).promise();
50
+ };
51
+
52
+ // Set gitbook research
53
+ gitbook.events.bind('start', function(e, config) {
54
+ var engine = gitbook.search.getEngine();
55
+ if (!engine) {
56
+ gitbook.search.setEngine(LunrSearchEngine, config);
57
+ }
58
+ });
59
+ });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.5.12
3
+ * Copyright (C) 2015 Oliver Nightingale
4
+ * MIT Licensed
5
+ * @license
6
+ */
7
+ !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.5.12",t.utils={},t.utils.warn=function(t){return function(e){t.console&&console.warn&&console.warn(e)}}(this),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(t){return arguments.length&&null!=t&&void 0!=t?Array.isArray(t)?t.map(function(t){return t.toLowerCase()}):t.toString().trim().toLowerCase().split(/[\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,o=0;n>o;o++){for(var r=t[o],s=0;i>s&&(r=this._stack[s](r,o,t),void 0!==r);s++);void 0!==r&&e.push(r)}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 o=i,r=i.next;void 0!=r;){if(e<r.idx)return o.next=new t.Vector.Node(e,n,r),this.length++;o=r,r=r.next}return o.next=new t.Vector.Node(e,n,r),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,o=e+Math.floor(i/2),r=this.elements[o];i>1;){if(r===t)return o;t>r&&(e=o),r>t&&(n=o),i=n-e,o=e+Math.floor(i/2),r=this.elements[o]}return r===t?o:-1},t.SortedSet.prototype.locationFor=function(t){for(var e=0,n=this.elements.length,i=n-e,o=e+Math.floor(i/2),r=this.elements[o];i>1;)t>r&&(e=o),r>t&&(n=o),i=n-e,o=e+Math.floor(i/2),r=this.elements[o];return r>t?o:t>r?o+1:void 0},t.SortedSet.prototype.intersect=function(e){for(var n=new t.SortedSet,i=0,o=0,r=this.length,s=e.length,a=this.elements,h=e.elements;;){if(i>r-1||o>s-1)break;a[i]!==h[o]?a[i]<h[o]?i++:a[i]>h[o]&&o++:(n.add(a[i]),i++,o++)}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={},o=new t.SortedSet,r=e[this._ref],n=void 0===n?!0:n;this._fields.forEach(function(n){var r=this.pipeline.run(t.tokenizer(e[n.name]));i[n.name]=r,t.SortedSet.prototype.add.apply(o,r)},this),this.documentStore.set(r,o),t.SortedSet.prototype.add.apply(this.corpusTokens,o.toArray());for(var s=0;s<o.length;s++){var a=o.elements[s],h=this._fields.reduce(function(t,e){var n=i[e.name].length;if(!n)return t;var o=i[e.name].filter(function(t){return t===a}).length;return t+o/n*e.boost},0);this.tokenStore.add(a,{ref:r,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,o=[],r=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*r,h=this,l=this.tokenStore.expand(e).reduce(function(n,o){var r=h.corpusTokens.indexOf(o),s=h.idf(o),l=1,u=new t.SortedSet;if(o!==e){var c=Math.max(3,o.length-e.length);l=1/Math.log(c)}return r>-1&&i.insert(r,a*s*l),Object.keys(h.tokenStore.get(o)).forEach(function(t){u.add(t)}),n.union(u)},new t.SortedSet);o.push(l)},this);var a=o.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,o=new t.Vector,r=0;i>r;r++){var s=n.elements[r],a=this.tokenStore.get(s)[e].tf,h=this.idf(s);o.insert(this.corpusTokens.indexOf(s),a*h)}return o},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]",o=n+"[^aeiouy]*",r=i+"[aeiou]*",s="^("+o+")?"+r+o,a="^("+o+")?"+r+o+"("+r+")?$",h="^("+o+")?"+r+o+r+o,l="^("+o+")?"+i,u=new RegExp(s),c=new RegExp(h),f=new RegExp(a),d=new RegExp(l),p=/^(.+?)(ss|i)es$/,m=/^(.+?)([^s])s$/,v=/^(.+?)eed$/,y=/^(.+?)(ed|ing)$/,g=/.$/,S=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\1$"),x=new RegExp("^"+o+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("^"+o+i+"[^aeiouwxy]$"),T=function(n){var i,o,r,s,a,h,l;if(n.length<3)return n;if(r=n.substr(0,1),"y"==r&&(n=r.toUpperCase()+n.substr(1)),s=p,a=m,s.test(n)?n=n.replace(s,"$1$2"):a.test(n)&&(n=n.replace(a,"$1$2")),s=v,a=y,s.test(n)){var T=s.exec(n);s=u,s.test(T[1])&&(s=g,n=n.replace(s,""))}else if(a.test(n)){var T=a.exec(n);i=T[1],a=d,a.test(i)&&(n=i,a=S,h=w,l=x,a.test(n)?n+="e":h.test(n)?(s=g,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],o=T[2],s=u,s.test(i)&&(n=i+t[o])}if(s=E,s.test(n)){var T=s.exec(n);i=T[1],o=T[2],s=u,s.test(i)&&(n=i+e[o])}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=g,n=n.replace(s,"")),"y"==r&&(n=r.toLowerCase()+n.substr(1)),n};return T}(),t.Pipeline.registerFunction(t.stemmer,"stemmer"),t.stopWordFilter=function(e){return e&&t.stopWordFilter.stopWords[e]!==e?e:void 0},t.stopWordFilter.stopWords={a:"a",able:"able",about:"about",across:"across",after:"after",all:"all",almost:"almost",also:"also",am:"am",among:"among",an:"an",and:"and",any:"any",are:"are",as:"as",at:"at",be:"be",because:"because",been:"been",but:"but",by:"by",can:"can",cannot:"cannot",could:"could",dear:"dear",did:"did","do":"do",does:"does",either:"either","else":"else",ever:"ever",every:"every","for":"for",from:"from",get:"get",got:"got",had:"had",has:"has",have:"have",he:"he",her:"her",hers:"hers",him:"him",his:"his",how:"how",however:"however",i:"i","if":"if","in":"in",into:"into",is:"is",it:"it",its:"its",just:"just",least:"least",let:"let",like:"like",likely:"likely",may:"may",me:"me",might:"might",most:"most",must:"must",my:"my",neither:"neither",no:"no",nor:"nor",not:"not",of:"of",off:"off",often:"often",on:"on",only:"only",or:"or",other:"other",our:"our",own:"own",rather:"rather",said:"said",say:"say",says:"says",she:"she",should:"should",since:"since",so:"so",some:"some",than:"than",that:"that",the:"the",their:"their",them:"them",then:"then",there:"there",these:"these",they:"they","this":"this",tis:"tis",to:"to",too:"too",twas:"twas",us:"us",wants:"wants",was:"was",we:"we",were:"were",what:"what",when:"when",where:"where",which:"which","while":"while",who:"who",whom:"whom",why:"why",will:"will","with":"with",would:"would",yet:"yet",you:"you",your:"your"},t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter"),t.trimmer=function(t){var e=t.replace(/^\W+/,"").replace(/\W+$/,"");return""===e?void 0:e},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[0],o=t.slice(1);return i in n||(n[i]={docs:{}}),0===o.length?(n[i].docs[e.ref]=e,void(this.length+=1)):this.add(o,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[n]])return!1;e=e[t[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[n]])return{};e=e[t[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[i]in n))return;n=n[t[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})}();
@@ -0,0 +1,50 @@
1
+ require([
2
+ 'gitbook',
3
+ 'jquery'
4
+ ], function(gitbook, $) {
5
+ // Global search objects
6
+ var engine = null;
7
+ var initialized = false;
8
+
9
+ // Set a new search engine
10
+ function setEngine(Engine, config) {
11
+ initialized = false;
12
+ engine = new Engine(config);
13
+
14
+ init(config);
15
+ }
16
+
17
+ // Initialize search engine with config
18
+ function init(config) {
19
+ if (!engine) throw new Error('No engine set for research. Set an engine using gitbook.research.setEngine(Engine).');
20
+
21
+ return engine.init(config)
22
+ .then(function() {
23
+ initialized = true;
24
+ gitbook.events.trigger('search.ready');
25
+ });
26
+ }
27
+
28
+ // Launch search for query q
29
+ function query(q, offset, length) {
30
+ if (!initialized) throw new Error('Search has not been initialized');
31
+ return engine.search(q, offset, length);
32
+ }
33
+
34
+ // Get stats about search
35
+ function getEngine() {
36
+ return engine? engine.name : null;
37
+ }
38
+
39
+ function isInitialized() {
40
+ return initialized;
41
+ }
42
+
43
+ // Initialize gitbook.search
44
+ gitbook.search = {
45
+ setEngine: setEngine,
46
+ getEngine: getEngine,
47
+ query: query,
48
+ isInitialized: isInitialized
49
+ };
50
+ });