wwwjdic 14.0.0 → 15.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +19 -0
- data/Gemfile +5 -1
- data/README.md +461 -192
- data/Rakefile +7 -2
- data/copyright.md +17 -29
- data/examples/basics.rb +51 -45
- data/examples/translate.rb +135 -86
- data/examples/uri.rb +34 -78
- data/html/CHANGELOG.html +48 -31
- data/html/COPYING_md.html +31 -35
- data/html/Gemfile.html +28 -32
- data/html/Object.html +71 -71
- data/html/README_md.html +326 -159
- data/html/Rakefile.html +29 -33
- data/html/WWWJDic.html +137 -98
- data/html/WWWJDic/ParsableDuckType.html +55 -55
- data/html/WWWJDic/Parser.html +88 -88
- data/html/WWWJDic/Parsers.html +33 -33
- data/html/WWWJDic/Parsers/Dict.html +71 -73
- data/html/WWWJDic/Parsers/Display.html +66 -66
- data/html/WWWJDic/Parsers/Key.html +67 -67
- data/html/WWWJDic/Parsers/Search.html +59 -58
- data/html/WWWJDic/Parsers/Server.html +66 -66
- data/html/WWWJDic/Splitter.html +173 -172
- data/html/WWWJDic/Utils.html +34 -34
- data/html/WWWJDic/Utils/Downloader.html +33 -33
- data/html/WWWJDic/Utils/Downloader/Downloader.html +91 -89
- data/html/WWWJDic/Utils/Raisers.html +95 -95
- data/html/WWWJDic/WWWJDic.html +343 -345
- data/html/copyright_md.html +37 -51
- data/html/created.rid +55 -57
- data/html/index.html +334 -164
- data/html/js/darkfish.js +84 -84
- data/html/js/navigation.js.gz +0 -0
- data/html/js/search.js +110 -110
- data/html/js/search_index.js +1 -1
- data/html/js/search_index.js.gz +0 -0
- data/html/js/searcher.js +229 -229
- data/html/js/searcher.js.gz +0 -0
- data/html/table_of_contents.html +44 -75
- data/lib/wwwjdic.rb +7 -11
- data/lib/wwwjdic/application.rb +13 -7
- data/lib/wwwjdic/constants.rb +16 -8
- data/lib/wwwjdic/locales/de.yml +5 -4
- data/lib/wwwjdic/locales/en.yml +5 -4
- data/lib/wwwjdic/locales/es.yml +5 -4
- data/lib/wwwjdic/locales/fr.yml +6 -4
- data/lib/wwwjdic/locales/hu.yml +6 -4
- data/lib/wwwjdic/locales/it.yml +6 -4
- data/lib/wwwjdic/locales/ja.yml +8 -4
- data/lib/wwwjdic/locales/nl.yml +5 -4
- data/lib/wwwjdic/locales/ru.yml +5 -4
- data/lib/wwwjdic/locales/sl.yml +5 -4
- data/lib/wwwjdic/locales/sv.yml +5 -4
- data/lib/wwwjdic/parser.rb +8 -4
- data/lib/wwwjdic/parsers/dict.rb +9 -7
- data/lib/wwwjdic/parsers/display.rb +6 -2
- data/lib/wwwjdic/parsers/key.rb +8 -3
- data/lib/wwwjdic/parsers/search.rb +8 -3
- data/lib/wwwjdic/parsers/server.rb +6 -2
- data/lib/wwwjdic/utils/downloader.rb +21 -23
- data/lib/wwwjdic/utils/raisers.rb +7 -3
- data/lib/wwwjdic/utils/splitter.rb +20 -14
- data/lib/wwwjdic/version.rb +2 -6
- data/test/test_helper.rb +5 -1
- data/test/test_wwwjdic.rb +6 -2
- data/test/wwwjdic/locales/de.yml +7 -1
- data/test/wwwjdic/locales/en.yml +7 -1
- data/test/wwwjdic/locales/es.yml +7 -1
- data/test/wwwjdic/locales/fr.yml +7 -1
- data/test/wwwjdic/locales/hu.yml +7 -1
- data/test/wwwjdic/locales/it.yml +10 -3
- data/test/wwwjdic/locales/ja.yml +9 -2
- data/test/wwwjdic/locales/nl.yml +7 -1
- data/test/wwwjdic/locales/ru.yml +7 -1
- data/test/wwwjdic/locales/sl.yml +7 -1
- data/test/wwwjdic/locales/sv.yml +7 -1
- data/test/wwwjdic/locales/test_locales.rb +12 -9
- data/test/wwwjdic/parsers/test_dict.rb +6 -2
- data/test/wwwjdic/parsers/test_display.rb +6 -2
- data/test/wwwjdic/parsers/test_key.rb +6 -2
- data/test/wwwjdic/parsers/test_server.rb +6 -2
- data/test/wwwjdic/test_application.rb +12 -8
- data/test/wwwjdic/test_parsable_duck_type.rb +6 -2
- data/test/wwwjdic/utils/test_downloader.rb +5 -1
- data/test/wwwjdic/utils/test_raisers.rb +10 -6
- data/wwwjdic.gemspec +30 -14
- metadata +50 -22
- data/acknowledgements.md +0 -55
- data/authors.md +0 -67
- data/html/acknowledgements_md.html +0 -150
- data/html/authors_md.html +0 -182
data/html/js/darkfish.js
CHANGED
@@ -1,84 +1,84 @@
|
|
1
|
-
/**
|
2
|
-
*
|
3
|
-
* Darkfish Page Functions
|
4
|
-
* $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $
|
5
|
-
*
|
6
|
-
* Author: Michael Granger <mgranger@laika.com>
|
7
|
-
*
|
8
|
-
*/
|
9
|
-
|
10
|
-
/* Provide console simulation for firebug-less environments */
|
11
|
-
/*
|
12
|
-
if (!("console" in window) || !("firebug" in console)) {
|
13
|
-
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
|
14
|
-
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
|
15
|
-
|
16
|
-
window.console = {};
|
17
|
-
for (var i = 0; i < names.length; ++i)
|
18
|
-
window.console[names[i]] = function() {};
|
19
|
-
};
|
20
|
-
*/
|
21
|
-
|
22
|
-
|
23
|
-
function showSource( e ) {
|
24
|
-
var target = e.target;
|
25
|
-
while (!target.classList.contains('method-detail')) {
|
26
|
-
target = target.parentNode;
|
27
|
-
}
|
28
|
-
if (typeof target !== "undefined" && target !== null) {
|
29
|
-
target = target.querySelector('.method-source-code');
|
30
|
-
}
|
31
|
-
if (typeof target !== "undefined" && target !== null) {
|
32
|
-
target.classList.toggle('active-menu')
|
33
|
-
}
|
34
|
-
}
|
35
|
-
|
36
|
-
function hookSourceViews() {
|
37
|
-
document.querySelectorAll('.method-heading').forEach(function (codeObject) {
|
38
|
-
codeObject.addEventListener('click', showSource);
|
39
|
-
});
|
40
|
-
}
|
41
|
-
|
42
|
-
function hookSearch() {
|
43
|
-
var input = document.querySelector('#search-field');
|
44
|
-
var result = document.querySelector('#search-results');
|
45
|
-
result.classList.remove("initially-hidden");
|
46
|
-
|
47
|
-
var search_section = document.querySelector('#search-section');
|
48
|
-
search_section.classList.remove("initially-hidden");
|
49
|
-
|
50
|
-
var search = new Search(search_data, input, result);
|
51
|
-
|
52
|
-
search.renderItem = function(result) {
|
53
|
-
var li = document.createElement('li');
|
54
|
-
var html = '';
|
55
|
-
|
56
|
-
// TODO add relative path to <script> per-page
|
57
|
-
html += '<p class="search-match"><a href="' + index_rel_prefix + result.path + '">' + this.hlt(result.title);
|
58
|
-
if (result.params)
|
59
|
-
html += '<span class="params">' + result.params + '</span>';
|
60
|
-
html += '</a>';
|
61
|
-
|
62
|
-
|
63
|
-
if (result.namespace)
|
64
|
-
html += '<p class="search-namespace">' + this.hlt(result.namespace);
|
65
|
-
|
66
|
-
if (result.snippet)
|
67
|
-
html += '<div class="search-snippet">' + result.snippet + '</div>';
|
68
|
-
|
69
|
-
li.innerHTML = html;
|
70
|
-
|
71
|
-
return li;
|
72
|
-
}
|
73
|
-
|
74
|
-
search.select = function(result) {
|
75
|
-
window.location.href = result.firstChild.firstChild.href;
|
76
|
-
}
|
77
|
-
|
78
|
-
search.scrollIntoView = search.scrollInWindow;
|
79
|
-
}
|
80
|
-
|
81
|
-
document.addEventListener('DOMContentLoaded', function() {
|
82
|
-
hookSourceViews();
|
83
|
-
hookSearch();
|
84
|
-
});
|
1
|
+
/**
|
2
|
+
*
|
3
|
+
* Darkfish Page Functions
|
4
|
+
* $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $
|
5
|
+
*
|
6
|
+
* Author: Michael Granger <mgranger@laika.com>
|
7
|
+
*
|
8
|
+
*/
|
9
|
+
|
10
|
+
/* Provide console simulation for firebug-less environments */
|
11
|
+
/*
|
12
|
+
if (!("console" in window) || !("firebug" in console)) {
|
13
|
+
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
|
14
|
+
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
|
15
|
+
|
16
|
+
window.console = {};
|
17
|
+
for (var i = 0; i < names.length; ++i)
|
18
|
+
window.console[names[i]] = function() {};
|
19
|
+
};
|
20
|
+
*/
|
21
|
+
|
22
|
+
|
23
|
+
function showSource( e ) {
|
24
|
+
var target = e.target;
|
25
|
+
while (!target.classList.contains('method-detail')) {
|
26
|
+
target = target.parentNode;
|
27
|
+
}
|
28
|
+
if (typeof target !== "undefined" && target !== null) {
|
29
|
+
target = target.querySelector('.method-source-code');
|
30
|
+
}
|
31
|
+
if (typeof target !== "undefined" && target !== null) {
|
32
|
+
target.classList.toggle('active-menu')
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
function hookSourceViews() {
|
37
|
+
document.querySelectorAll('.method-heading').forEach(function (codeObject) {
|
38
|
+
codeObject.addEventListener('click', showSource);
|
39
|
+
});
|
40
|
+
}
|
41
|
+
|
42
|
+
function hookSearch() {
|
43
|
+
var input = document.querySelector('#search-field');
|
44
|
+
var result = document.querySelector('#search-results');
|
45
|
+
result.classList.remove("initially-hidden");
|
46
|
+
|
47
|
+
var search_section = document.querySelector('#search-section');
|
48
|
+
search_section.classList.remove("initially-hidden");
|
49
|
+
|
50
|
+
var search = new Search(search_data, input, result);
|
51
|
+
|
52
|
+
search.renderItem = function(result) {
|
53
|
+
var li = document.createElement('li');
|
54
|
+
var html = '';
|
55
|
+
|
56
|
+
// TODO add relative path to <script> per-page
|
57
|
+
html += '<p class="search-match"><a href="' + index_rel_prefix + result.path + '">' + this.hlt(result.title);
|
58
|
+
if (result.params)
|
59
|
+
html += '<span class="params">' + result.params + '</span>';
|
60
|
+
html += '</a>';
|
61
|
+
|
62
|
+
|
63
|
+
if (result.namespace)
|
64
|
+
html += '<p class="search-namespace">' + this.hlt(result.namespace);
|
65
|
+
|
66
|
+
if (result.snippet)
|
67
|
+
html += '<div class="search-snippet">' + result.snippet + '</div>';
|
68
|
+
|
69
|
+
li.innerHTML = html;
|
70
|
+
|
71
|
+
return li;
|
72
|
+
}
|
73
|
+
|
74
|
+
search.select = function(result) {
|
75
|
+
window.location.href = result.firstChild.firstChild.href;
|
76
|
+
}
|
77
|
+
|
78
|
+
search.scrollIntoView = search.scrollInWindow;
|
79
|
+
}
|
80
|
+
|
81
|
+
document.addEventListener('DOMContentLoaded', function() {
|
82
|
+
hookSourceViews();
|
83
|
+
hookSearch();
|
84
|
+
});
|
data/html/js/navigation.js.gz
CHANGED
Binary file
|
data/html/js/search.js
CHANGED
@@ -1,110 +1,110 @@
|
|
1
|
-
Search = function(data, input, result) {
|
2
|
-
this.data = data;
|
3
|
-
this.input = input;
|
4
|
-
this.result = result;
|
5
|
-
|
6
|
-
this.current = null;
|
7
|
-
this.view = this.result.parentNode;
|
8
|
-
this.searcher = new Searcher(data.index);
|
9
|
-
this.init();
|
10
|
-
}
|
11
|
-
|
12
|
-
Search.prototype = Object.assign({}, Navigation, new function() {
|
13
|
-
var suid = 1;
|
14
|
-
|
15
|
-
this.init = function() {
|
16
|
-
var _this = this;
|
17
|
-
var observer = function(e) {
|
18
|
-
switch(e.keyCode) {
|
19
|
-
case 38: // Event.KEY_UP
|
20
|
-
case 40: // Event.KEY_DOWN
|
21
|
-
return;
|
22
|
-
}
|
23
|
-
_this.search(_this.input.value);
|
24
|
-
};
|
25
|
-
this.input.addEventListener('keyup', observer);
|
26
|
-
this.input.addEventListener('click', observer); // mac's clear field
|
27
|
-
|
28
|
-
this.searcher.ready(function(results, isLast) {
|
29
|
-
_this.addResults(results, isLast);
|
30
|
-
})
|
31
|
-
|
32
|
-
this.initNavigation();
|
33
|
-
this.setNavigationActive(false);
|
34
|
-
}
|
35
|
-
|
36
|
-
this.search = function(value, selectFirstMatch) {
|
37
|
-
value = value.trim().toLowerCase();
|
38
|
-
if (value) {
|
39
|
-
this.setNavigationActive(true);
|
40
|
-
} else {
|
41
|
-
this.setNavigationActive(false);
|
42
|
-
}
|
43
|
-
|
44
|
-
if (value == '') {
|
45
|
-
this.lastQuery = value;
|
46
|
-
this.result.innerHTML = '';
|
47
|
-
this.result.setAttribute('aria-expanded', 'false');
|
48
|
-
this.setNavigationActive(false);
|
49
|
-
} else if (value != this.lastQuery) {
|
50
|
-
this.lastQuery = value;
|
51
|
-
this.result.setAttribute('aria-busy', 'true');
|
52
|
-
this.result.setAttribute('aria-expanded', 'true');
|
53
|
-
this.firstRun = true;
|
54
|
-
this.searcher.find(value);
|
55
|
-
}
|
56
|
-
}
|
57
|
-
|
58
|
-
this.addResults = function(results, isLast) {
|
59
|
-
var target = this.result;
|
60
|
-
if (this.firstRun && (results.length > 0 || isLast)) {
|
61
|
-
this.current = null;
|
62
|
-
this.result.innerHTML = '';
|
63
|
-
}
|
64
|
-
|
65
|
-
for (var i=0, l = results.length; i < l; i++) {
|
66
|
-
var item = this.renderItem.call(this, results[i]);
|
67
|
-
item.setAttribute('id', 'search-result-' + target.childElementCount);
|
68
|
-
target.appendChild(item);
|
69
|
-
}
|
70
|
-
|
71
|
-
if (this.firstRun && results.length > 0) {
|
72
|
-
this.firstRun = false;
|
73
|
-
this.current = target.firstChild;
|
74
|
-
this.current.classList.add('search-selected');
|
75
|
-
}
|
76
|
-
//TODO: ECMAScript
|
77
|
-
//if (jQuery.browser.msie) this.$element[0].className += '';
|
78
|
-
|
79
|
-
if (isLast) this.result.setAttribute('aria-busy', 'false');
|
80
|
-
}
|
81
|
-
|
82
|
-
this.move = function(isDown) {
|
83
|
-
if (!this.current) return;
|
84
|
-
var next = isDown ? this.current.nextElementSibling : this.current.previousElementSibling;
|
85
|
-
if (next) {
|
86
|
-
this.current.classList.remove('search-selected');
|
87
|
-
next.classList.add('search-selected');
|
88
|
-
this.input.setAttribute('aria-activedescendant', next.getAttribute('id'));
|
89
|
-
this.scrollIntoView(next, this.view);
|
90
|
-
this.current = next;
|
91
|
-
this.input.value = next.firstChild.firstChild.text;
|
92
|
-
this.input.select();
|
93
|
-
}
|
94
|
-
return true;
|
95
|
-
}
|
96
|
-
|
97
|
-
this.hlt = function(html) {
|
98
|
-
return this.escapeHTML(html).
|
99
|
-
replace(/\u0001/g, '<em>').
|
100
|
-
replace(/\u0002/g, '</em>');
|
101
|
-
}
|
102
|
-
|
103
|
-
this.escapeHTML = function(html) {
|
104
|
-
return html.replace(/[&<>]/g, function(c) {
|
105
|
-
return '&#' + c.charCodeAt(0) + ';';
|
106
|
-
});
|
107
|
-
}
|
108
|
-
|
109
|
-
});
|
110
|
-
|
1
|
+
Search = function(data, input, result) {
|
2
|
+
this.data = data;
|
3
|
+
this.input = input;
|
4
|
+
this.result = result;
|
5
|
+
|
6
|
+
this.current = null;
|
7
|
+
this.view = this.result.parentNode;
|
8
|
+
this.searcher = new Searcher(data.index);
|
9
|
+
this.init();
|
10
|
+
}
|
11
|
+
|
12
|
+
Search.prototype = Object.assign({}, Navigation, new function() {
|
13
|
+
var suid = 1;
|
14
|
+
|
15
|
+
this.init = function() {
|
16
|
+
var _this = this;
|
17
|
+
var observer = function(e) {
|
18
|
+
switch(e.keyCode) {
|
19
|
+
case 38: // Event.KEY_UP
|
20
|
+
case 40: // Event.KEY_DOWN
|
21
|
+
return;
|
22
|
+
}
|
23
|
+
_this.search(_this.input.value);
|
24
|
+
};
|
25
|
+
this.input.addEventListener('keyup', observer);
|
26
|
+
this.input.addEventListener('click', observer); // mac's clear field
|
27
|
+
|
28
|
+
this.searcher.ready(function(results, isLast) {
|
29
|
+
_this.addResults(results, isLast);
|
30
|
+
})
|
31
|
+
|
32
|
+
this.initNavigation();
|
33
|
+
this.setNavigationActive(false);
|
34
|
+
}
|
35
|
+
|
36
|
+
this.search = function(value, selectFirstMatch) {
|
37
|
+
value = value.trim().toLowerCase();
|
38
|
+
if (value) {
|
39
|
+
this.setNavigationActive(true);
|
40
|
+
} else {
|
41
|
+
this.setNavigationActive(false);
|
42
|
+
}
|
43
|
+
|
44
|
+
if (value == '') {
|
45
|
+
this.lastQuery = value;
|
46
|
+
this.result.innerHTML = '';
|
47
|
+
this.result.setAttribute('aria-expanded', 'false');
|
48
|
+
this.setNavigationActive(false);
|
49
|
+
} else if (value != this.lastQuery) {
|
50
|
+
this.lastQuery = value;
|
51
|
+
this.result.setAttribute('aria-busy', 'true');
|
52
|
+
this.result.setAttribute('aria-expanded', 'true');
|
53
|
+
this.firstRun = true;
|
54
|
+
this.searcher.find(value);
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
this.addResults = function(results, isLast) {
|
59
|
+
var target = this.result;
|
60
|
+
if (this.firstRun && (results.length > 0 || isLast)) {
|
61
|
+
this.current = null;
|
62
|
+
this.result.innerHTML = '';
|
63
|
+
}
|
64
|
+
|
65
|
+
for (var i=0, l = results.length; i < l; i++) {
|
66
|
+
var item = this.renderItem.call(this, results[i]);
|
67
|
+
item.setAttribute('id', 'search-result-' + target.childElementCount);
|
68
|
+
target.appendChild(item);
|
69
|
+
}
|
70
|
+
|
71
|
+
if (this.firstRun && results.length > 0) {
|
72
|
+
this.firstRun = false;
|
73
|
+
this.current = target.firstChild;
|
74
|
+
this.current.classList.add('search-selected');
|
75
|
+
}
|
76
|
+
//TODO: ECMAScript
|
77
|
+
//if (jQuery.browser.msie) this.$element[0].className += '';
|
78
|
+
|
79
|
+
if (isLast) this.result.setAttribute('aria-busy', 'false');
|
80
|
+
}
|
81
|
+
|
82
|
+
this.move = function(isDown) {
|
83
|
+
if (!this.current) return;
|
84
|
+
var next = isDown ? this.current.nextElementSibling : this.current.previousElementSibling;
|
85
|
+
if (next) {
|
86
|
+
this.current.classList.remove('search-selected');
|
87
|
+
next.classList.add('search-selected');
|
88
|
+
this.input.setAttribute('aria-activedescendant', next.getAttribute('id'));
|
89
|
+
this.scrollIntoView(next, this.view);
|
90
|
+
this.current = next;
|
91
|
+
this.input.value = next.firstChild.firstChild.text;
|
92
|
+
this.input.select();
|
93
|
+
}
|
94
|
+
return true;
|
95
|
+
}
|
96
|
+
|
97
|
+
this.hlt = function(html) {
|
98
|
+
return this.escapeHTML(html).
|
99
|
+
replace(/\u0001/g, '<em>').
|
100
|
+
replace(/\u0002/g, '</em>');
|
101
|
+
}
|
102
|
+
|
103
|
+
this.escapeHTML = function(html) {
|
104
|
+
return html.replace(/[&<>]/g, function(c) {
|
105
|
+
return '&#' + c.charCodeAt(0) + ';';
|
106
|
+
});
|
107
|
+
}
|
108
|
+
|
109
|
+
});
|
110
|
+
|
data/html/js/search_index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var search_data = {"index":{"searchIndex":["object","wwwjdic","parsableducktype","parser","parsers","dict","display","key","search","server","splitter","utils","downloader","downloader","raisers","wwwjdic","breener()","content()","dictionary()","dictionary=()","download_file()","json_translate()","json_uri()","lines()","load_yaml_file()","message()","new()","new()","new()","parse()","parse()","parse()","parse()","parse()","parse()","raiser_array()","raiser_downcase()","raiser_to_i()","raw_uri()","reset()","server()","server=()","test_parsable_duck_type()","title()","to_s()","translate()","translation()","uri()","changelog","copying","gemfile","readme","rakefile","acknowledgements","authors","copyright"],"longSearchIndex":["object","wwwjdic","wwwjdic::parsableducktype","wwwjdic::parser","wwwjdic::parsers","wwwjdic::parsers::dict","wwwjdic::parsers::display","wwwjdic::parsers::key","wwwjdic::parsers::search","wwwjdic::parsers::server","wwwjdic::splitter","wwwjdic::utils","wwwjdic::utils::downloader","wwwjdic::utils::downloader::downloader","wwwjdic::utils::raisers","wwwjdic::wwwjdic","wwwjdic::breener()","wwwjdic::splitter#content()","wwwjdic::wwwjdic#dictionary()","wwwjdic::wwwjdic#dictionary=()","wwwjdic::utils::downloader::downloader::download_file()","wwwjdic::wwwjdic#json_translate()","wwwjdic::wwwjdic#json_uri()","wwwjdic::splitter#lines()","object#load_yaml_file()","wwwjdic::splitter#message()","wwwjdic::parser::new()","wwwjdic::splitter::new()","wwwjdic::wwwjdic::new()","wwwjdic::parser#parse()","wwwjdic::parsers::dict#parse()","wwwjdic::parsers::display#parse()","wwwjdic::parsers::key#parse()","wwwjdic::parsers::search#parse()","wwwjdic::parsers::server#parse()","wwwjdic::utils::raisers#raiser_array()","wwwjdic::utils::raisers#raiser_downcase()","wwwjdic::utils::raisers#raiser_to_i()","wwwjdic::wwwjdic#raw_uri()","wwwjdic::wwwjdic#reset()","wwwjdic::wwwjdic#server()","wwwjdic::wwwjdic#server=()","wwwjdic::parsableducktype#test_parsable_duck_type()","wwwjdic::splitter#title()","wwwjdic::wwwjdic#to_s()","wwwjdic::wwwjdic#translate()","wwwjdic::splitter#translation()","wwwjdic::wwwjdic#uri()","","","","","","","",""],"info":[["Object","","Object.html","",""],["WWWJDic","","WWWJDic.html","","<p>Author — Marco Bresciani\n<p>Copyright — Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Marco Bresciani …\n"],["WWWJDic::ParsableDuckType","","WWWJDic/ParsableDuckType.html","","<p>This module represents the parsable duck type element for testing purposes.\n<p>Author — Marco Bresciani\n<p>Copyright … — "],["WWWJDic::Parser","","WWWJDic/Parser.html","","<p>This class is a simple utility that is used to parse and filter parameters for wwwjdic.\n<p>Author — Marco Bresciani …\n"],["WWWJDic::Parsers","","WWWJDic/Parsers.html","",""],["WWWJDic::Parsers::Dict","","WWWJDic/Parsers/Dict.html","","<p>This class is an implementation of the Parsable duck type that checks the dictionary type. The only needed …\n"],["WWWJDic::Parsers::Display","","WWWJDic/Parsers/Display.html","","<p>This class is an implementation of the Parsable duck type that checks the display type. The only needed …\n"],["WWWJDic::Parsers::Key","","WWWJDic/Parsers/Key.html","","<p>This class is an implementation of the Parsable duck type that checks the display type. The only needed …\n"],["WWWJDic::Parsers::Search","","WWWJDic/Parsers/Search.html","","<p>This class is an implementation of the Parsable duck type that checks the display type. The only needed …\n"],["WWWJDic::Parsers::Server","","WWWJDic/Parsers/Server.html","","<p>This class is an implementation of the Parsable duck type that checks the display type. The only needed …\n"],["WWWJDic::Splitter","","WWWJDic/Splitter.html","","<p>This class is a simple API to interact with WWWJDic Backboor Entry/API.\n<p>Author — Marco Bresciani\n<p>Copyright … — "],["WWWJDic::Utils","","WWWJDic/Utils.html","","<p>This module is a simple collection of useful things and methods that I prefer to keep as DRYer as possible. …\n"],["WWWJDic::Utils::Downloader","","WWWJDic/Utils/Downloader.html","","<p>This module is a simple wrapper container for Peter R. Marreck's gist.\n<p>Author — Jon Maken\n<p>License — 3-clause …\n"],["WWWJDic::Utils::Downloader::Downloader","","WWWJDic/Utils/Downloader/Downloader.html","","<p>!/usr/bin/env ruby\n\n<pre>An HTTP/HTTPS/FTP file downloader library/CLI based upon\nMiniPortile's HTTP implementation. ...</pre>\n"],["WWWJDic::Utils::Raisers","","WWWJDic/Utils/Raisers.html","","<p>This module contains some utility method to raise errors according to (possibly) common conditions.\n<p>Author … — "],["WWWJDic::WWWJDic","","WWWJDic/WWWJDic.html","","<p>This class is a simple API to interact with WWWJDic Backboor Entry/API.\n<p>Author — Marco Bresciani\n<p>Copyright … — "],["breener","WWWJDic","WWWJDic.html#method-c-breener","()","<p>Creates a new WWWJDic object (from the verb 'to Breen'… :) ).\n<p>Usage — <p><code>new_wwwjdic = WWWJDic::breener</code> …\n\n"],["content","WWWJDic::Splitter","WWWJDic/Splitter.html#method-i-content","()",""],["dictionary","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-i-dictionary","()","<p>Return the default used dictionary string, if any.\n<p>Returns — a String with the dictionary full name.\n\n"],["dictionary=","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-i-dictionary-3D","(dict)","<p>Configure the default used dictionary using either code/number or (exact) string.\n<p>Usage — <tt>new_wwwjdic.dictionary= …\n"],["download_file","WWWJDic::Utils::Downloader::Downloader","WWWJDic/Utils/Downloader/Downloader.html#method-c-download_file","(url, full_path, count = 3)",""],["json_translate","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-i-json_translate","(word = nil, args = {}, filename = nil)","<p>Save a file, with specified <code>filename</code>, that contains the current wwwjdic configuration, in JSON format. …\n"],["json_uri","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-i-json_uri","(word = nil, args = {})","<p>Create the reference uri for a <code>word</code> translation, according to specified parameters, with JSON output. …\n"],["lines","WWWJDic::Splitter","WWWJDic/Splitter.html#method-i-lines","()",""],["load_yaml_file","Object","Object.html#method-i-load_yaml_file","(locale)",""],["message","WWWJDic::Splitter","WWWJDic/Splitter.html#method-i-message","()",""],["new","WWWJDic::Parser","WWWJDic/Parser.html#method-c-new","(args = {})",""],["new","WWWJDic::Splitter","WWWJDic/Splitter.html#method-c-new","(translation)","<p>Creates a <code>Splitter</code> object.\n<p>Usage — <code>new_splitter = Splitter.new translation_content</code>\n<p>Returns — a <code>Splitter</code> object. …\n"],["new","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-c-new","(parser)","<p>Creates a <code>WWWJDic</code> object. This constructor should be used through the WWWJDic::breener method only.\n<p>Usage … — "],["parse","WWWJDic::Parser","WWWJDic/Parser.html#method-i-parse","(method = nil, value = nil)","<p>Provides the duck type for a generic parsing object.\n"],["parse","WWWJDic::Parsers::Dict","WWWJDic/Parsers/Dict.html#method-i-parse","(value = '1')","<p>The parsable duck type interface to every parser usage.\n"],["parse","WWWJDic::Parsers::Display","WWWJDic/Parsers/Display.html#method-i-parse","(value = :display)","<p>The parsable duck type interface to every parser usage.\n"],["parse","WWWJDic::Parsers::Key","WWWJDic/Parsers/Key.html#method-i-parse","(value = :exact)","<p>The parsable duck type interface to every parser usage.\n"],["parse","WWWJDic::Parsers::Search","WWWJDic/Parsers/Search.html#method-i-parse","(value = '')","<p>The parsable duck type interface to every parser usage.\n"],["parse","WWWJDic::Parsers::Server","WWWJDic/Parsers/Server.html#method-i-parse","(value = :edrdg)","<p>The parsable duck type interface to every parser usage.\n"],["raiser_array","WWWJDic::Utils::Raisers","WWWJDic/Utils/Raisers.html#method-i-raiser_array","(name = 'error.value', value = nil, array = nil)","<p>Raises an <code>ArgumentError</code> according to parameters, unless the <code>array</code> contains the exact <code>value</code>.\n"],["raiser_downcase","WWWJDic::Utils::Raisers","WWWJDic/Utils/Raisers.html#method-i-raiser_downcase","(name = 'error.value', value = nil, array = nil)","<p>Raises an <code>ArgumentError</code> according to parameters, unless the <code>array</code> contains a downcased <code>value</code>.\n"],["raiser_to_i","WWWJDic::Utils::Raisers","WWWJDic/Utils/Raisers.html#method-i-raiser_to_i","(name = 'error.value', value = nil, array = nil)","<p>Raises an <code>ArgumentError</code> according to parameters, unless the <code>array</code> contains the number of the <code>value</code>.\n"],["raw_uri","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-i-raw_uri","(word = nil, args = {})","<p>Create the reference uri for a <code>word</code> translation, according to specified parameters, overriding for raw …\n"],["reset","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-i-reset","()","<p>Restores the original status cleaning up the (possibly) previously saved URIs restoring the default …\n"],["server","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-i-server","()","<p>Return the selected server URI\n<p>Returns — a String with the dictionary full name.\n\n"],["server=","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-i-server-3D","(server = :edrdg)","<p>Store the Backdoor Entry/API server name, default to EDRDG.Org (:edrdg) instead of Monash (:monash). …\n"],["test_parsable_duck_type","WWWJDic::ParsableDuckType","WWWJDic/ParsableDuckType.html#method-i-test_parsable_duck_type","()","<p>The method that tests the parsable duck type interface and its <code>parse</code> method.\n"],["title","WWWJDic::Splitter","WWWJDic/Splitter.html#method-i-title","()",""],["to_s","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-i-to_s","()",""],["translate","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-i-translate","(word = nil, args = {}, filename = nil)","<p>Save a file, with specified <code>filename</code>, that contains the current wwwjdic configuration. Uses the internal …\n"],["translation","WWWJDic::Splitter","WWWJDic/Splitter.html#method-i-translation","()",""],["uri","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-i-uri","(word = nil, args = {})","<p>Create the reference uri for a <code>word</code> translation, according to specified parameters.\n<p>Usage — <tt>new_wwwjdic.uri …\n\n"],["CHANGELOG","","CHANGELOG.html","","<p>Version 14.0.0\n\n<pre>* MAJOR update from Ruby '~> 2.6' to Ruby '~> 2.7'.\n* MINOR update IntelliJ IDEA (RubyGem) ...</pre>\n"],["COPYING","","COPYING_md.html","","<p>GNU GENERAL PUBLIC LICENSE\n<p>Version 3, 29 June 2007\n<p>Copyright (C) 2007 Free Software Foundation, Inc.\nfsf.org ...\n"],["Gemfile","","Gemfile.html","","<p># wwwjdic # Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Marco Bresciani # # This file is part …\n"],["README","","README_md.html","","<p>WWWJDic\n<p><img src=\"https://img.shields.io/gem/v/wwwjdic.svg?style=plastic\">\n<img src=\"https://img.shields.io/gem/dt/wwwjdic.svg?style=plastic\"> ...\n"],["Rakefile","","Rakefile.html","","<p># wwwjdic # Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Marco Bresciani # # This file is part …\n"],["acknowledgements","","acknowledgements_md.html","","<p>Acknowledgements\n<p>FSIJ理事会の理事長、新部裕さんの日本語の翻訳。 Japanese translation by\nYutaka Niibe, President of Free Software ...\n"],["authors","","authors_md.html","","<p>Project and gem owned by\n<p><em>Author</em>: Marco Bresciani\n\n<p>Authors list (in appearing order)\n"],["copyright","","copyright_md.html","","<p>Copyright Notes\n<p>2020-03-12 update.\n<p>wwwjdic\n"]]}}
|
1
|
+
var search_data = {"index":{"searchIndex":["object","wwwjdic","parsableducktype","parser","parsers","dict","display","key","search","server","splitter","utils","downloader","downloader","raisers","wwwjdic","breener()","content()","dictionary()","dictionary=()","download_file()","json_translate()","json_uri()","lines()","load_yaml_file()","message()","new()","new()","new()","parse()","parse()","parse()","parse()","parse()","parse()","parser()","raiser_array()","raiser_downcase()","raiser_to_i()","raw_uri()","reset()","server()","server=()","test_parsable_duck_type()","title()","to_s()","translate()","translation()","uri()","changelog","copying","gemfile","readme","rakefile","copyright"],"longSearchIndex":["object","wwwjdic","wwwjdic::parsableducktype","wwwjdic::parser","wwwjdic::parsers","wwwjdic::parsers::dict","wwwjdic::parsers::display","wwwjdic::parsers::key","wwwjdic::parsers::search","wwwjdic::parsers::server","wwwjdic::splitter","wwwjdic::utils","wwwjdic::utils::downloader","wwwjdic::utils::downloader::downloader","wwwjdic::utils::raisers","wwwjdic::wwwjdic","wwwjdic::breener()","wwwjdic::splitter#content()","wwwjdic::wwwjdic#dictionary()","wwwjdic::wwwjdic#dictionary=()","wwwjdic::utils::downloader::downloader::download_file()","wwwjdic::wwwjdic#json_translate()","wwwjdic::wwwjdic#json_uri()","wwwjdic::splitter#lines()","object#load_yaml_file()","wwwjdic::splitter#message()","wwwjdic::parser::new()","wwwjdic::splitter::new()","wwwjdic::wwwjdic::new()","wwwjdic::parser#parse()","wwwjdic::parsers::dict#parse()","wwwjdic::parsers::display#parse()","wwwjdic::parsers::key#parse()","wwwjdic::parsers::search#parse()","wwwjdic::parsers::server#parse()","wwwjdic::parser()","wwwjdic::utils::raisers#raiser_array()","wwwjdic::utils::raisers#raiser_downcase()","wwwjdic::utils::raisers#raiser_to_i()","wwwjdic::wwwjdic#raw_uri()","wwwjdic::wwwjdic#reset()","wwwjdic::wwwjdic#server()","wwwjdic::wwwjdic#server=()","wwwjdic::parsableducktype#test_parsable_duck_type()","wwwjdic::splitter#title()","wwwjdic::wwwjdic#to_s()","wwwjdic::wwwjdic#translate()","wwwjdic::splitter#translation()","wwwjdic::wwwjdic#uri()","","","","","",""],"info":[["Object","","Object.html","",""],["WWWJDic","","WWWJDic.html","","<p>Author — Marco Bresciani\n<p>Copyright — (C) 2014 Marco Bresciani\n<p>License — GNU General Public License version 3 …\n"],["WWWJDic::ParsableDuckType","","WWWJDic/ParsableDuckType.html","","<p>This module represents the parsable duck type element for testing purposes.\n<p>Author — Marco Bresciani\n<p>Copyright … — "],["WWWJDic::Parser","","WWWJDic/Parser.html","","<p>This class is a simple utility that is used to parse and filter parameters for wwwjdic.\n<p>Author — Marco Bresciani …\n"],["WWWJDic::Parsers","","WWWJDic/Parsers.html","",""],["WWWJDic::Parsers::Dict","","WWWJDic/Parsers/Dict.html","","<p>This class is an implementation of the Parsable duck type that checks the dictionary type. The only needed …\n"],["WWWJDic::Parsers::Display","","WWWJDic/Parsers/Display.html","","<p>This class is an implementation of the Parsable duck type that checks the display type. The only needed …\n"],["WWWJDic::Parsers::Key","","WWWJDic/Parsers/Key.html","","<p>This class is an implementation of the Parsable duck type that checks the display type. The only needed …\n"],["WWWJDic::Parsers::Search","","WWWJDic/Parsers/Search.html","","<p>This class is an implementation of the Parsable duck type that checks the display type. The only needed …\n"],["WWWJDic::Parsers::Server","","WWWJDic/Parsers/Server.html","","<p>This class is an implementation of the Parsable duck type that checks the display type. The only needed …\n"],["WWWJDic::Splitter","","WWWJDic/Splitter.html","","<p>This class is a simple API to interact with WWWJDic Backboor Entry/API.\n<p>Author — Marco Bresciani\n<p>Copyright … — "],["WWWJDic::Utils","","WWWJDic/Utils.html","","<p>This module is a simple collection of useful things and methods that I prefer to keep as DRYer as possible. …\n"],["WWWJDic::Utils::Downloader","","WWWJDic/Utils/Downloader.html","","<p>This module is a simple wrapper container for Peter R. Marreck's gist.\n<p>Author — Jon Maken\n<p>License — 3-clause …\n"],["WWWJDic::Utils::Downloader::Downloader","","WWWJDic/Utils/Downloader/Downloader.html","","<p>An HTTP/HTTPS/FTP file downloader library/CLI based upon MiniPortile's HTTP implementation.\n<p>Author … — "],["WWWJDic::Utils::Raisers","","WWWJDic/Utils/Raisers.html","","<p>This module contains some utility method to raise errors according to (possibly) common conditions.\n<p>Author … — "],["WWWJDic::WWWJDic","","WWWJDic/WWWJDic.html","","<p>This class is a simple API to interact with WWWJDic Backboor Entry/API.\n<p>Author — Marco Bresciani\n<p>Copyright … — "],["breener","WWWJDic","WWWJDic.html#method-c-breener","()","<p>Creates a new WWWJDic object (from the verb 'to Breen'… :) ).\n<p>Usage — <p><code>new_wwwjdic = WWWJDic::breener</code> …\n\n"],["content","WWWJDic::Splitter","WWWJDic/Splitter.html#method-i-content","()","<p>@return [Array] the arrays of elements containing the answer\n"],["dictionary","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-i-dictionary","()","<p>Return the default used dictionary string, if any.\n<p>Returns — a String with the dictionary full name.\n\n"],["dictionary=","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-i-dictionary-3D","(dict)","<p>Configure the default used dictionary using either code/number or (exact) string.\n<p>Usage — <tt>new_wwwjdic.dictionary= …\n"],["download_file","WWWJDic::Utils::Downloader::Downloader","WWWJDic/Utils/Downloader/Downloader.html#method-c-download_file","(url, full_path, count = 3)",""],["json_translate","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-i-json_translate","(word = nil, args = {}, filename = nil)","<p>Save a file, with specified <code>filename</code>, that contains the current wwwjdic configuration, in JSON format. …\n"],["json_uri","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-i-json_uri","(word = nil, args = {})","<p>Create the reference uri for a <code>word</code> translation, according to specified parameters, with JSON output. …\n"],["lines","WWWJDic::Splitter","WWWJDic/Splitter.html#method-i-lines","()",""],["load_yaml_file","Object","Object.html#method-i-load_yaml_file","(locale)",""],["message","WWWJDic::Splitter","WWWJDic/Splitter.html#method-i-message","()",""],["new","WWWJDic::Parser","WWWJDic/Parser.html#method-c-new","(args = {})",""],["new","WWWJDic::Splitter","WWWJDic/Splitter.html#method-c-new","(translation)","<p>Creates a <code>Splitter</code> object.\n<p>Usage — <code>new_splitter = Splitter.new translation_content</code>\n<p>Returns — a <code>Splitter</code> object. …\n"],["new","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-c-new","(parser)","<p>Creates a <code>WWWJDic</code> object. This constructor should be used through the WWWJDic::breener method only.\n<p>Usage … — "],["parse","WWWJDic::Parser","WWWJDic/Parser.html#method-i-parse","(method = nil, value = nil)","<p>Provides the duck type for a generic parsing object.\n"],["parse","WWWJDic::Parsers::Dict","WWWJDic/Parsers/Dict.html#method-i-parse","(value = '1')","<p>The parsable duck type interface to every parser usage.\n"],["parse","WWWJDic::Parsers::Display","WWWJDic/Parsers/Display.html#method-i-parse","(value = :display)","<p>The parsable duck type interface to every parser usage.\n"],["parse","WWWJDic::Parsers::Key","WWWJDic/Parsers/Key.html#method-i-parse","(value = :english)","<p>The parsable duck type interface to every parser usage.\n"],["parse","WWWJDic::Parsers::Search","WWWJDic/Parsers/Search.html#method-i-parse","(value = '')","<p>The parsable duck type interface to every parser usage.\n"],["parse","WWWJDic::Parsers::Server","WWWJDic/Parsers/Server.html#method-i-parse","(value = :edrdg)","<p>The parsable duck type interface to every parser usage.\n"],["parser","WWWJDic","WWWJDic.html#method-c-parser","()","<p>Provides the parameters' parsers object.\n"],["raiser_array","WWWJDic::Utils::Raisers","WWWJDic/Utils/Raisers.html#method-i-raiser_array","(name = 'error.value', value = nil, array = nil)","<p>Raises an <code>ArgumentError</code> according to parameters, unless the <code>array</code> contains the exact <code>value</code>.\n"],["raiser_downcase","WWWJDic::Utils::Raisers","WWWJDic/Utils/Raisers.html#method-i-raiser_downcase","(name = 'error.value', value = nil, array = nil)","<p>Raises an <code>ArgumentError</code> according to parameters, unless the <code>array</code> contains a downcased <code>value</code>.\n"],["raiser_to_i","WWWJDic::Utils::Raisers","WWWJDic/Utils/Raisers.html#method-i-raiser_to_i","(name = 'error.value', value = nil, array = nil)","<p>Raises an <code>ArgumentError</code> according to parameters, unless the <code>array</code> contains the number of the <code>value</code>.\n"],["raw_uri","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-i-raw_uri","(word = nil, args = {})","<p>Create the reference uri for a <code>word</code> translation, according to specified parameters, overriding for raw …\n"],["reset","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-i-reset","()","<p>Restores the original status cleaning up the (possibly) previously saved URIs restoring the default …\n"],["server","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-i-server","()","<p>Return the selected server URI\n<p>Returns — a String with the dictionary full name.\n\n"],["server=","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-i-server-3D","(server = :edrdg)","<p>Store the Backdoor Entry/API server name, default to EDRDG.Org (:edrdg) instead of Monash (:monash). …\n"],["test_parsable_duck_type","WWWJDic::ParsableDuckType","WWWJDic/ParsableDuckType.html#method-i-test_parsable_duck_type","()","<p>The method that tests the parsable duck type interface and its <code>parse</code> method.\n"],["title","WWWJDic::Splitter","WWWJDic/Splitter.html#method-i-title","()",""],["to_s","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-i-to_s","()",""],["translate","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-i-translate","(word = nil, args = {}, filename = nil)","<p>Save a file, with specified <code>filename</code>, that contains the current wwwjdic configuration. Uses the internal …\n"],["translation","WWWJDic::Splitter","WWWJDic/Splitter.html#method-i-translation","()",""],["uri","WWWJDic::WWWJDic","WWWJDic/WWWJDic.html#method-i-uri","(word = nil, args = {})","<p>Create the reference uri for a <code>word</code> translation, according to specified parameters.\n<p>Usage — <tt>new_wwwjdic.uri …\n\n"],["CHANGELOG","","CHANGELOG.html","","<p>Version 15.0.0\n\n<pre>* MAJOR changed key search type default from "exact" to "english".\n* MAJOR changed Monash ...</pre>\n"],["COPYING","","COPYING_md.html","","<p>GNU GENERAL PUBLIC LICENSE\n<p>Version 3, 29 June 2007\n<p>Copyright (C) 2007 Free Software Foundation, Inc.\nfsf.org ...\n"],["Gemfile","","Gemfile.html","","<p># wwwjdic # © 2014 Marco Bresciani # # This file is part of wwwjdic. # # wwwjdic is free software: you …\n"],["README","","README_md.html","","<p>WWWJDic\n<p><img src=\"https://badgen.net/rubygems/n/wwwjdic\">\n<img src=\"https://badgen.net/rubygems/p/wwwjdic\"> ...\n"],["Rakefile","","Rakefile.html","","<p># wwwjdic # © 2014 Marco Bresciani # # This file is part of wwwjdic. # # wwwjdic is free software: you …\n"],["copyright","","copyright_md.html","","<p>Copyright Notes\n<p>2020-11-10 update.\n<p>wwwjdic\n"]]}}
|
data/html/js/search_index.js.gz
CHANGED
Binary file
|
data/html/js/searcher.js
CHANGED
@@ -1,229 +1,229 @@
|
|
1
|
-
Searcher = function(data) {
|
2
|
-
this.data = data;
|
3
|
-
this.handlers = [];
|
4
|
-
}
|
5
|
-
|
6
|
-
Searcher.prototype = new function() {
|
7
|
-
// search is performed in chunks of 1000 for non-blocking user input
|
8
|
-
var CHUNK_SIZE = 1000;
|
9
|
-
// do not try to find more than 100 results
|
10
|
-
var MAX_RESULTS = 100;
|
11
|
-
var huid = 1;
|
12
|
-
var suid = 1;
|
13
|
-
var runs = 0;
|
14
|
-
|
15
|
-
this.find = function(query) {
|
16
|
-
var queries = splitQuery(query);
|
17
|
-
var regexps = buildRegexps(queries);
|
18
|
-
var highlighters = buildHilighters(queries);
|
19
|
-
var state = { from: 0, pass: 0, limit: MAX_RESULTS, n: suid++};
|
20
|
-
var _this = this;
|
21
|
-
|
22
|
-
this.currentSuid = state.n;
|
23
|
-
|
24
|
-
if (!query) return;
|
25
|
-
|
26
|
-
var run = function() {
|
27
|
-
// stop current search thread if new search started
|
28
|
-
if (state.n != _this.currentSuid) return;
|
29
|
-
|
30
|
-
var results =
|
31
|
-
performSearch(_this.data, regexps, queries, highlighters, state);
|
32
|
-
var hasMore = (state.limit > 0 && state.pass < 4);
|
33
|
-
|
34
|
-
triggerResults.call(_this, results, !hasMore);
|
35
|
-
if (hasMore) {
|
36
|
-
setTimeout(run, 2);
|
37
|
-
}
|
38
|
-
runs++;
|
39
|
-
};
|
40
|
-
runs = 0;
|
41
|
-
|
42
|
-
// start search thread
|
43
|
-
run();
|
44
|
-
}
|
45
|
-
|
46
|
-
/* ----- Events ------ */
|
47
|
-
this.ready = function(fn) {
|
48
|
-
fn.huid = huid;
|
49
|
-
this.handlers.push(fn);
|
50
|
-
}
|
51
|
-
|
52
|
-
/* ----- Utilities ------ */
|
53
|
-
function splitQuery(query) {
|
54
|
-
return query.split(/(\s+|::?|\(\)?)/).filter(function(string) {
|
55
|
-
return string.match(/\S/);
|
56
|
-
});
|
57
|
-
}
|
58
|
-
|
59
|
-
function buildRegexps(queries) {
|
60
|
-
return queries.map(function(query) {
|
61
|
-
return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i');
|
62
|
-
});
|
63
|
-
}
|
64
|
-
|
65
|
-
function buildHilighters(queries) {
|
66
|
-
return queries.map(function(query) {
|
67
|
-
return query.split('').map(function(l, i) {
|
68
|
-
return '\u0001$' + (i*2+1) + '\u0002$' + (i*2+2);
|
69
|
-
}).join('');
|
70
|
-
});
|
71
|
-
}
|
72
|
-
|
73
|
-
// function longMatchRegexp(index, longIndex, regexps) {
|
74
|
-
// for (var i = regexps.length - 1; i >= 0; i--){
|
75
|
-
// if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false;
|
76
|
-
// };
|
77
|
-
// return true;
|
78
|
-
// }
|
79
|
-
|
80
|
-
|
81
|
-
/* ----- Mathchers ------ */
|
82
|
-
|
83
|
-
/*
|
84
|
-
* This record matches if the index starts with queries[0] and the record
|
85
|
-
* matches all of the regexps
|
86
|
-
*/
|
87
|
-
function matchPassBeginning(index, longIndex, queries, regexps) {
|
88
|
-
if (index.indexOf(queries[0]) != 0) return false;
|
89
|
-
for (var i=1, l = regexps.length; i < l; i++) {
|
90
|
-
if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
|
91
|
-
return false;
|
92
|
-
}
|
93
|
-
return true;
|
94
|
-
}
|
95
|
-
|
96
|
-
/*
|
97
|
-
* This record matches if the longIndex starts with queries[0] and the
|
98
|
-
* longIndex matches all of the regexps
|
99
|
-
*/
|
100
|
-
function matchPassLongIndex(index, longIndex, queries, regexps) {
|
101
|
-
if (longIndex.indexOf(queries[0]) != 0) return false;
|
102
|
-
for (var i=1, l = regexps.length; i < l; i++) {
|
103
|
-
if (!longIndex.match(regexps[i]))
|
104
|
-
return false;
|
105
|
-
}
|
106
|
-
return true;
|
107
|
-
}
|
108
|
-
|
109
|
-
/*
|
110
|
-
* This record matches if the index contains queries[0] and the record
|
111
|
-
* matches all of the regexps
|
112
|
-
*/
|
113
|
-
function matchPassContains(index, longIndex, queries, regexps) {
|
114
|
-
if (index.indexOf(queries[0]) == -1) return false;
|
115
|
-
for (var i=1, l = regexps.length; i < l; i++) {
|
116
|
-
if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
|
117
|
-
return false;
|
118
|
-
}
|
119
|
-
return true;
|
120
|
-
}
|
121
|
-
|
122
|
-
/*
|
123
|
-
* This record matches if regexps[0] matches the index and the record
|
124
|
-
* matches all of the regexps
|
125
|
-
*/
|
126
|
-
function matchPassRegexp(index, longIndex, queries, regexps) {
|
127
|
-
if (!index.match(regexps[0])) return false;
|
128
|
-
for (var i=1, l = regexps.length; i < l; i++) {
|
129
|
-
if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
|
130
|
-
return false;
|
131
|
-
}
|
132
|
-
return true;
|
133
|
-
}
|
134
|
-
|
135
|
-
|
136
|
-
/* ----- Highlighters ------ */
|
137
|
-
function highlightRegexp(info, queries, regexps, highlighters) {
|
138
|
-
var result = createResult(info);
|
139
|
-
for (var i=0, l = regexps.length; i < l; i++) {
|
140
|
-
result.title = result.title.replace(regexps[i], highlighters[i]);
|
141
|
-
result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
|
142
|
-
}
|
143
|
-
return result;
|
144
|
-
}
|
145
|
-
|
146
|
-
function hltSubstring(string, pos, length) {
|
147
|
-
return string.substring(0, pos) + '\u0001' + string.substring(pos, pos + length) + '\u0002' + string.substring(pos + length);
|
148
|
-
}
|
149
|
-
|
150
|
-
function highlightQuery(info, queries, regexps, highlighters) {
|
151
|
-
var result = createResult(info);
|
152
|
-
var pos = 0;
|
153
|
-
var lcTitle = result.title.toLowerCase();
|
154
|
-
|
155
|
-
pos = lcTitle.indexOf(queries[0]);
|
156
|
-
if (pos != -1) {
|
157
|
-
result.title = hltSubstring(result.title, pos, queries[0].length);
|
158
|
-
}
|
159
|
-
|
160
|
-
result.namespace = result.namespace.replace(regexps[0], highlighters[0]);
|
161
|
-
for (var i=1, l = regexps.length; i < l; i++) {
|
162
|
-
result.title = result.title.replace(regexps[i], highlighters[i]);
|
163
|
-
result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
|
164
|
-
}
|
165
|
-
return result;
|
166
|
-
}
|
167
|
-
|
168
|
-
function createResult(info) {
|
169
|
-
var result = {};
|
170
|
-
result.title = info[0];
|
171
|
-
result.namespace = info[1];
|
172
|
-
result.path = info[2];
|
173
|
-
result.params = info[3];
|
174
|
-
result.snippet = info[4];
|
175
|
-
result.badge = info[6];
|
176
|
-
return result;
|
177
|
-
}
|
178
|
-
|
179
|
-
/* ----- Searching ------ */
|
180
|
-
function performSearch(data, regexps, queries, highlighters, state) {
|
181
|
-
var searchIndex = data.searchIndex;
|
182
|
-
var longSearchIndex = data.longSearchIndex;
|
183
|
-
var info = data.info;
|
184
|
-
var result = [];
|
185
|
-
var i = state.from;
|
186
|
-
var l = searchIndex.length;
|
187
|
-
var togo = CHUNK_SIZE;
|
188
|
-
var matchFunc, hltFunc;
|
189
|
-
|
190
|
-
while (state.pass < 4 && state.limit > 0 && togo > 0) {
|
191
|
-
if (state.pass == 0) {
|
192
|
-
matchFunc = matchPassBeginning;
|
193
|
-
hltFunc = highlightQuery;
|
194
|
-
} else if (state.pass == 1) {
|
195
|
-
matchFunc = matchPassLongIndex;
|
196
|
-
hltFunc = highlightQuery;
|
197
|
-
} else if (state.pass == 2) {
|
198
|
-
matchFunc = matchPassContains;
|
199
|
-
hltFunc = highlightQuery;
|
200
|
-
} else if (state.pass == 3) {
|
201
|
-
matchFunc = matchPassRegexp;
|
202
|
-
hltFunc = highlightRegexp;
|
203
|
-
}
|
204
|
-
|
205
|
-
for (; togo > 0 && i < l && state.limit > 0; i++, togo--) {
|
206
|
-
if (info[i].n == state.n) continue;
|
207
|
-
if (matchFunc(searchIndex[i], longSearchIndex[i], queries, regexps)) {
|
208
|
-
info[i].n = state.n;
|
209
|
-
result.push(hltFunc(info[i], queries, regexps, highlighters));
|
210
|
-
state.limit--;
|
211
|
-
}
|
212
|
-
}
|
213
|
-
if (searchIndex.length <= i) {
|
214
|
-
state.pass++;
|
215
|
-
i = state.from = 0;
|
216
|
-
} else {
|
217
|
-
state.from = i;
|
218
|
-
}
|
219
|
-
}
|
220
|
-
return result;
|
221
|
-
}
|
222
|
-
|
223
|
-
function triggerResults(results, isLast) {
|
224
|
-
this.handlers.forEach(function(fn) {
|
225
|
-
fn.call(this, results, isLast)
|
226
|
-
});
|
227
|
-
}
|
228
|
-
}
|
229
|
-
|
1
|
+
Searcher = function(data) {
|
2
|
+
this.data = data;
|
3
|
+
this.handlers = [];
|
4
|
+
}
|
5
|
+
|
6
|
+
Searcher.prototype = new function() {
|
7
|
+
// search is performed in chunks of 1000 for non-blocking user input
|
8
|
+
var CHUNK_SIZE = 1000;
|
9
|
+
// do not try to find more than 100 results
|
10
|
+
var MAX_RESULTS = 100;
|
11
|
+
var huid = 1;
|
12
|
+
var suid = 1;
|
13
|
+
var runs = 0;
|
14
|
+
|
15
|
+
this.find = function(query) {
|
16
|
+
var queries = splitQuery(query);
|
17
|
+
var regexps = buildRegexps(queries);
|
18
|
+
var highlighters = buildHilighters(queries);
|
19
|
+
var state = { from: 0, pass: 0, limit: MAX_RESULTS, n: suid++};
|
20
|
+
var _this = this;
|
21
|
+
|
22
|
+
this.currentSuid = state.n;
|
23
|
+
|
24
|
+
if (!query) return;
|
25
|
+
|
26
|
+
var run = function() {
|
27
|
+
// stop current search thread if new search started
|
28
|
+
if (state.n != _this.currentSuid) return;
|
29
|
+
|
30
|
+
var results =
|
31
|
+
performSearch(_this.data, regexps, queries, highlighters, state);
|
32
|
+
var hasMore = (state.limit > 0 && state.pass < 4);
|
33
|
+
|
34
|
+
triggerResults.call(_this, results, !hasMore);
|
35
|
+
if (hasMore) {
|
36
|
+
setTimeout(run, 2);
|
37
|
+
}
|
38
|
+
runs++;
|
39
|
+
};
|
40
|
+
runs = 0;
|
41
|
+
|
42
|
+
// start search thread
|
43
|
+
run();
|
44
|
+
}
|
45
|
+
|
46
|
+
/* ----- Events ------ */
|
47
|
+
this.ready = function(fn) {
|
48
|
+
fn.huid = huid;
|
49
|
+
this.handlers.push(fn);
|
50
|
+
}
|
51
|
+
|
52
|
+
/* ----- Utilities ------ */
|
53
|
+
function splitQuery(query) {
|
54
|
+
return query.split(/(\s+|::?|\(\)?)/).filter(function(string) {
|
55
|
+
return string.match(/\S/);
|
56
|
+
});
|
57
|
+
}
|
58
|
+
|
59
|
+
function buildRegexps(queries) {
|
60
|
+
return queries.map(function(query) {
|
61
|
+
return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i');
|
62
|
+
});
|
63
|
+
}
|
64
|
+
|
65
|
+
function buildHilighters(queries) {
|
66
|
+
return queries.map(function(query) {
|
67
|
+
return query.split('').map(function(l, i) {
|
68
|
+
return '\u0001$' + (i*2+1) + '\u0002$' + (i*2+2);
|
69
|
+
}).join('');
|
70
|
+
});
|
71
|
+
}
|
72
|
+
|
73
|
+
// function longMatchRegexp(index, longIndex, regexps) {
|
74
|
+
// for (var i = regexps.length - 1; i >= 0; i--){
|
75
|
+
// if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false;
|
76
|
+
// };
|
77
|
+
// return true;
|
78
|
+
// }
|
79
|
+
|
80
|
+
|
81
|
+
/* ----- Mathchers ------ */
|
82
|
+
|
83
|
+
/*
|
84
|
+
* This record matches if the index starts with queries[0] and the record
|
85
|
+
* matches all of the regexps
|
86
|
+
*/
|
87
|
+
function matchPassBeginning(index, longIndex, queries, regexps) {
|
88
|
+
if (index.indexOf(queries[0]) != 0) return false;
|
89
|
+
for (var i=1, l = regexps.length; i < l; i++) {
|
90
|
+
if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
|
91
|
+
return false;
|
92
|
+
}
|
93
|
+
return true;
|
94
|
+
}
|
95
|
+
|
96
|
+
/*
|
97
|
+
* This record matches if the longIndex starts with queries[0] and the
|
98
|
+
* longIndex matches all of the regexps
|
99
|
+
*/
|
100
|
+
function matchPassLongIndex(index, longIndex, queries, regexps) {
|
101
|
+
if (longIndex.indexOf(queries[0]) != 0) return false;
|
102
|
+
for (var i=1, l = regexps.length; i < l; i++) {
|
103
|
+
if (!longIndex.match(regexps[i]))
|
104
|
+
return false;
|
105
|
+
}
|
106
|
+
return true;
|
107
|
+
}
|
108
|
+
|
109
|
+
/*
|
110
|
+
* This record matches if the index contains queries[0] and the record
|
111
|
+
* matches all of the regexps
|
112
|
+
*/
|
113
|
+
function matchPassContains(index, longIndex, queries, regexps) {
|
114
|
+
if (index.indexOf(queries[0]) == -1) return false;
|
115
|
+
for (var i=1, l = regexps.length; i < l; i++) {
|
116
|
+
if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
|
117
|
+
return false;
|
118
|
+
}
|
119
|
+
return true;
|
120
|
+
}
|
121
|
+
|
122
|
+
/*
|
123
|
+
* This record matches if regexps[0] matches the index and the record
|
124
|
+
* matches all of the regexps
|
125
|
+
*/
|
126
|
+
function matchPassRegexp(index, longIndex, queries, regexps) {
|
127
|
+
if (!index.match(regexps[0])) return false;
|
128
|
+
for (var i=1, l = regexps.length; i < l; i++) {
|
129
|
+
if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
|
130
|
+
return false;
|
131
|
+
}
|
132
|
+
return true;
|
133
|
+
}
|
134
|
+
|
135
|
+
|
136
|
+
/* ----- Highlighters ------ */
|
137
|
+
function highlightRegexp(info, queries, regexps, highlighters) {
|
138
|
+
var result = createResult(info);
|
139
|
+
for (var i=0, l = regexps.length; i < l; i++) {
|
140
|
+
result.title = result.title.replace(regexps[i], highlighters[i]);
|
141
|
+
result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
|
142
|
+
}
|
143
|
+
return result;
|
144
|
+
}
|
145
|
+
|
146
|
+
function hltSubstring(string, pos, length) {
|
147
|
+
return string.substring(0, pos) + '\u0001' + string.substring(pos, pos + length) + '\u0002' + string.substring(pos + length);
|
148
|
+
}
|
149
|
+
|
150
|
+
function highlightQuery(info, queries, regexps, highlighters) {
|
151
|
+
var result = createResult(info);
|
152
|
+
var pos = 0;
|
153
|
+
var lcTitle = result.title.toLowerCase();
|
154
|
+
|
155
|
+
pos = lcTitle.indexOf(queries[0]);
|
156
|
+
if (pos != -1) {
|
157
|
+
result.title = hltSubstring(result.title, pos, queries[0].length);
|
158
|
+
}
|
159
|
+
|
160
|
+
result.namespace = result.namespace.replace(regexps[0], highlighters[0]);
|
161
|
+
for (var i=1, l = regexps.length; i < l; i++) {
|
162
|
+
result.title = result.title.replace(regexps[i], highlighters[i]);
|
163
|
+
result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
|
164
|
+
}
|
165
|
+
return result;
|
166
|
+
}
|
167
|
+
|
168
|
+
function createResult(info) {
|
169
|
+
var result = {};
|
170
|
+
result.title = info[0];
|
171
|
+
result.namespace = info[1];
|
172
|
+
result.path = info[2];
|
173
|
+
result.params = info[3];
|
174
|
+
result.snippet = info[4];
|
175
|
+
result.badge = info[6];
|
176
|
+
return result;
|
177
|
+
}
|
178
|
+
|
179
|
+
/* ----- Searching ------ */
|
180
|
+
function performSearch(data, regexps, queries, highlighters, state) {
|
181
|
+
var searchIndex = data.searchIndex;
|
182
|
+
var longSearchIndex = data.longSearchIndex;
|
183
|
+
var info = data.info;
|
184
|
+
var result = [];
|
185
|
+
var i = state.from;
|
186
|
+
var l = searchIndex.length;
|
187
|
+
var togo = CHUNK_SIZE;
|
188
|
+
var matchFunc, hltFunc;
|
189
|
+
|
190
|
+
while (state.pass < 4 && state.limit > 0 && togo > 0) {
|
191
|
+
if (state.pass == 0) {
|
192
|
+
matchFunc = matchPassBeginning;
|
193
|
+
hltFunc = highlightQuery;
|
194
|
+
} else if (state.pass == 1) {
|
195
|
+
matchFunc = matchPassLongIndex;
|
196
|
+
hltFunc = highlightQuery;
|
197
|
+
} else if (state.pass == 2) {
|
198
|
+
matchFunc = matchPassContains;
|
199
|
+
hltFunc = highlightQuery;
|
200
|
+
} else if (state.pass == 3) {
|
201
|
+
matchFunc = matchPassRegexp;
|
202
|
+
hltFunc = highlightRegexp;
|
203
|
+
}
|
204
|
+
|
205
|
+
for (; togo > 0 && i < l && state.limit > 0; i++, togo--) {
|
206
|
+
if (info[i].n == state.n) continue;
|
207
|
+
if (matchFunc(searchIndex[i], longSearchIndex[i], queries, regexps)) {
|
208
|
+
info[i].n = state.n;
|
209
|
+
result.push(hltFunc(info[i], queries, regexps, highlighters));
|
210
|
+
state.limit--;
|
211
|
+
}
|
212
|
+
}
|
213
|
+
if (searchIndex.length <= i) {
|
214
|
+
state.pass++;
|
215
|
+
i = state.from = 0;
|
216
|
+
} else {
|
217
|
+
state.from = i;
|
218
|
+
}
|
219
|
+
}
|
220
|
+
return result;
|
221
|
+
}
|
222
|
+
|
223
|
+
function triggerResults(results, isLast) {
|
224
|
+
this.handlers.forEach(function(fn) {
|
225
|
+
fn.call(this, results, isLast)
|
226
|
+
});
|
227
|
+
}
|
228
|
+
}
|
229
|
+
|