schemacop 1.0.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/.rubocop.yml +59 -1
- data/CHANGELOG.md +10 -0
- data/README.md +389 -199
- data/Rakefile +2 -0
- data/VERSION +1 -1
- data/doc/Schemacop.html +41 -130
- data/doc/Schemacop/ArrayValidator.html +329 -0
- data/doc/Schemacop/BooleanValidator.html +145 -0
- data/doc/Schemacop/Collector.html +535 -0
- data/doc/Schemacop/Exceptions.html +39 -39
- data/doc/Schemacop/Exceptions/InvalidSchemaError.html +124 -0
- data/doc/Schemacop/Exceptions/ValidationError.html +124 -0
- data/doc/Schemacop/FieldNode.html +409 -0
- data/doc/Schemacop/FloatValidator.html +158 -0
- data/doc/Schemacop/HashValidator.html +263 -0
- data/doc/Schemacop/IntegerValidator.html +158 -0
- data/doc/Schemacop/NilValidator.html +145 -0
- data/doc/Schemacop/Node.html +1426 -0
- data/doc/Schemacop/NodeResolver.html +242 -0
- data/doc/Schemacop/NodeSupportingField.html +590 -0
- data/doc/Schemacop/NodeSupportingType.html +614 -0
- data/doc/Schemacop/NodeWithBlock.html +289 -0
- data/doc/Schemacop/NumberValidator.html +232 -0
- data/doc/Schemacop/ObjectValidator.html +288 -0
- data/doc/Schemacop/RootNode.html +171 -0
- data/doc/Schemacop/Schema.html +697 -0
- data/doc/Schemacop/StringValidator.html +295 -0
- data/doc/ScopedEnv.html +351 -0
- data/doc/_index.html +190 -47
- data/doc/class_list.html +24 -31
- data/doc/css/full_list.css +32 -31
- data/doc/css/style.css +244 -91
- data/doc/file.README.html +428 -232
- data/doc/file_list.html +26 -30
- data/doc/frames.html +7 -16
- data/doc/index.html +428 -232
- data/doc/inheritance.graphml +524 -0
- data/doc/inheritance.pdf +825 -0
- data/doc/js/app.js +106 -77
- data/doc/js/full_list.js +170 -135
- data/doc/method_list.html +494 -38
- data/doc/top-level-namespace.html +36 -36
- data/lib/schemacop.rb +22 -7
- data/lib/schemacop/collector.rb +34 -0
- data/lib/schemacop/exceptions.rb +2 -8
- data/lib/schemacop/field_node.rb +26 -0
- data/lib/schemacop/node.rb +127 -0
- data/lib/schemacop/node_resolver.rb +14 -0
- data/lib/schemacop/node_supporting_field.rb +62 -0
- data/lib/schemacop/node_supporting_type.rb +112 -0
- data/lib/schemacop/node_with_block.rb +16 -0
- data/lib/schemacop/root_node.rb +4 -0
- data/lib/schemacop/schema.rb +61 -0
- data/lib/schemacop/scoped_env.rb +18 -0
- data/lib/schemacop/validator/array_validator.rb +30 -0
- data/lib/schemacop/validator/boolean_validator.rb +5 -0
- data/lib/schemacop/validator/float_validator.rb +5 -0
- data/lib/schemacop/validator/hash_validator.rb +18 -0
- data/lib/schemacop/validator/integer_validator.rb +5 -0
- data/lib/schemacop/validator/nil_validator.rb +5 -0
- data/lib/schemacop/validator/number_validator.rb +19 -0
- data/lib/schemacop/validator/object_validator.rb +21 -0
- data/lib/schemacop/validator/string_validator.rb +37 -0
- data/schemacop.gemspec +7 -5
- data/test/custom_check_test.rb +86 -0
- data/test/custom_if_test.rb +95 -0
- data/test/nil_dis_allow_test.rb +41 -0
- data/test/short_forms_test.rb +316 -0
- data/test/test_helper.rb +6 -0
- data/test/types_test.rb +83 -0
- data/test/validator_array_test.rb +97 -0
- data/test/validator_boolean_test.rb +15 -0
- data/test/validator_float_test.rb +57 -0
- data/test/validator_hash_test.rb +71 -0
- data/test/validator_integer_test.rb +46 -0
- data/test/validator_nil_test.rb +13 -0
- data/test/validator_number_test.rb +60 -0
- data/test/validator_object_test.rb +87 -0
- data/test/validator_string_test.rb +76 -0
- metadata +78 -14
- data/doc/Schemacop/Exceptions/Base.html +0 -127
- data/doc/Schemacop/Exceptions/InvalidSchema.html +0 -141
- data/doc/Schemacop/Exceptions/Validation.html +0 -142
- data/doc/Schemacop/MethodValidation.html +0 -120
- data/doc/Schemacop/MethodValidation/ClassMethods.html +0 -196
- data/doc/Schemacop/Validator.html +0 -254
- data/lib/schemacop/validator.rb +0 -145
- data/test/schemacop_validator_test.rb +0 -257
data/doc/js/app.js
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
(function() {
|
2
|
+
|
3
|
+
var localStorage = {}, sessionStorage = {};
|
4
|
+
try { localStorage = window.localStorage; } catch (e) { }
|
5
|
+
try { sessionStorage = window.sessionStorage; } catch (e) { }
|
6
|
+
|
1
7
|
function createSourceLinks() {
|
2
8
|
$('.method_details_list .source_code').
|
3
9
|
before("<span class='showSource'>[<a href='#' class='toggleSource'>View source</a>]</span>");
|
@@ -16,7 +22,7 @@ function createDefineLinks() {
|
|
16
22
|
$('.defines').after(" <a href='#' class='toggleDefines'>more...</a>");
|
17
23
|
$('.toggleDefines').toggle(function() {
|
18
24
|
tHeight = $(this).parent().prev().height();
|
19
|
-
$(this).prev().
|
25
|
+
$(this).prev().css('display', 'inline');
|
20
26
|
$(this).parent().prev().height($(this).parent().height());
|
21
27
|
$(this).text("(less)");
|
22
28
|
},
|
@@ -42,29 +48,39 @@ function createFullTreeLinks() {
|
|
42
48
|
});
|
43
49
|
}
|
44
50
|
|
45
|
-
function
|
46
|
-
$('dl.box dd.r1, dl.box dd.r2').each(function() {
|
47
|
-
$(this).prev().height($(this).height());
|
48
|
-
});
|
49
|
-
}
|
50
|
-
|
51
|
-
function searchFrameLinks() {
|
51
|
+
function searchFrameButtons() {
|
52
52
|
$('.full_list_link').click(function() {
|
53
53
|
toggleSearchFrame(this, $(this).attr('href'));
|
54
54
|
return false;
|
55
55
|
});
|
56
|
+
window.addEventListener('message', function(e) {
|
57
|
+
if (e.data === 'navEscape') {
|
58
|
+
$('#nav').slideUp(100);
|
59
|
+
$('#search a').removeClass('active inactive');
|
60
|
+
$(window).focus();
|
61
|
+
}
|
62
|
+
});
|
63
|
+
|
64
|
+
$(window).resize(function() {
|
65
|
+
if ($('#search:visible').length === 0) {
|
66
|
+
$('#nav').removeAttr('style');
|
67
|
+
$('#search a').removeClass('active inactive');
|
68
|
+
$(window).focus();
|
69
|
+
}
|
70
|
+
});
|
56
71
|
}
|
57
72
|
|
58
73
|
function toggleSearchFrame(id, link) {
|
59
|
-
var frame = $('#
|
74
|
+
var frame = $('#nav');
|
60
75
|
$('#search a').removeClass('active').addClass('inactive');
|
61
|
-
if (frame.attr('src')
|
76
|
+
if (frame.attr('src') === link && frame.css('display') !== "none") {
|
62
77
|
frame.slideUp(100);
|
63
78
|
$('#search a').removeClass('active inactive');
|
64
79
|
}
|
65
80
|
else {
|
66
81
|
$(id).addClass('active').removeClass('inactive');
|
67
|
-
frame.attr('src'
|
82
|
+
if (frame.attr('src') !== link) frame.attr('src', link);
|
83
|
+
frame.slideDown(100);
|
68
84
|
}
|
69
85
|
}
|
70
86
|
|
@@ -74,43 +90,10 @@ function linkSummaries() {
|
|
74
90
|
});
|
75
91
|
}
|
76
92
|
|
77
|
-
function framesInit() {
|
78
|
-
if (hasFrames) {
|
79
|
-
document.body.className = 'frames';
|
80
|
-
$('#menu .noframes a').attr('href', document.location);
|
81
|
-
try {
|
82
|
-
window.top.document.title = $('html head title').text();
|
83
|
-
} catch(error) {
|
84
|
-
// some browsers will not allow this when serving from file://
|
85
|
-
// but we don't want to stop the world.
|
86
|
-
}
|
87
|
-
}
|
88
|
-
else {
|
89
|
-
$('#menu .noframes a').text('frames').attr('href', framesUrl);
|
90
|
-
}
|
91
|
-
}
|
92
|
-
|
93
|
-
function keyboardShortcuts() {
|
94
|
-
if (window.top.frames.main) return;
|
95
|
-
$(document).keypress(function(evt) {
|
96
|
-
if (evt.altKey || evt.ctrlKey || evt.metaKey || evt.shiftKey) return;
|
97
|
-
if (typeof evt.target !== "undefined" &&
|
98
|
-
(evt.target.nodeName == "INPUT" ||
|
99
|
-
evt.target.nodeName == "TEXTAREA")) return;
|
100
|
-
switch (evt.charCode) {
|
101
|
-
case 67: case 99: $('#class_list_link').click(); break; // 'c'
|
102
|
-
case 77: case 109: $('#method_list_link').click(); break; // 'm'
|
103
|
-
case 70: case 102: $('#file_list_link').click(); break; // 'f'
|
104
|
-
default: break;
|
105
|
-
}
|
106
|
-
});
|
107
|
-
}
|
108
|
-
|
109
93
|
function summaryToggle() {
|
110
|
-
$('.summary_toggle').click(function() {
|
111
|
-
|
112
|
-
|
113
|
-
}
|
94
|
+
$('.summary_toggle').click(function(e) {
|
95
|
+
e.preventDefault();
|
96
|
+
localStorage.summaryCollapsed = $(this).text();
|
114
97
|
$('.summary_toggle').each(function() {
|
115
98
|
$(this).text($(this).text() == "collapse" ? "expand" : "collapse");
|
116
99
|
var next = $(this).parent().parent().nextAll('ul.summary').first();
|
@@ -132,18 +115,9 @@ function summaryToggle() {
|
|
132
115
|
});
|
133
116
|
return false;
|
134
117
|
});
|
135
|
-
if (localStorage) {
|
136
|
-
|
137
|
-
|
138
|
-
}
|
139
|
-
else localStorage.summaryCollapsed = "expand";
|
140
|
-
}
|
141
|
-
}
|
142
|
-
|
143
|
-
function fixOutsideWorldLinks() {
|
144
|
-
$('a').each(function() {
|
145
|
-
if (window.location.host != this.host) this.target = '_parent';
|
146
|
-
});
|
118
|
+
if (localStorage.summaryCollapsed == "collapse") {
|
119
|
+
$('.summary_toggle').first().click();
|
120
|
+
} else { localStorage.summaryCollapsed = "expand"; }
|
147
121
|
}
|
148
122
|
|
149
123
|
function generateTOC() {
|
@@ -185,7 +159,7 @@ function generateTOC() {
|
|
185
159
|
lastTag = thisTag;
|
186
160
|
});
|
187
161
|
if (!show) return;
|
188
|
-
html = '<div id="toc"><p class="title"><a
|
162
|
+
html = '<div id="toc"><p class="title hide_toc"><a href="#"><strong>Table of Contents</strong></a></p></div>';
|
189
163
|
$('#content').prepend(html);
|
190
164
|
$('#toc').append(_toc);
|
191
165
|
$('#toc .hide_toc').toggle(function() {
|
@@ -197,23 +171,78 @@ function generateTOC() {
|
|
197
171
|
$('#toc').toggleClass('hidden');
|
198
172
|
$('#toc .title small').toggle();
|
199
173
|
});
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
174
|
+
}
|
175
|
+
|
176
|
+
function navResizeFn(e) {
|
177
|
+
if (e.which !== 1) {
|
178
|
+
navResizeFnStop();
|
179
|
+
return;
|
180
|
+
}
|
181
|
+
|
182
|
+
sessionStorage.navWidth = e.pageX.toString();
|
183
|
+
$('.nav_wrap').css('width', e.pageX);
|
184
|
+
$('.nav_wrap').css('-ms-flex', 'inherit');
|
185
|
+
}
|
186
|
+
|
187
|
+
function navResizeFnStop() {
|
188
|
+
$(window).unbind('mousemove', navResizeFn);
|
189
|
+
window.removeEventListener('message', navMessageFn, false);
|
190
|
+
}
|
191
|
+
|
192
|
+
function navMessageFn(e) {
|
193
|
+
if (e.data.action === 'mousemove') navResizeFn(e.data.event);
|
194
|
+
if (e.data.action === 'mouseup') navResizeFnStop();
|
195
|
+
}
|
196
|
+
|
197
|
+
function navResizer() {
|
198
|
+
$('#resizer').mousedown(function(e) {
|
199
|
+
e.preventDefault();
|
200
|
+
$(window).mousemove(navResizeFn);
|
201
|
+
window.addEventListener('message', navMessageFn, false);
|
206
202
|
});
|
203
|
+
$(window).mouseup(navResizeFnStop);
|
204
|
+
|
205
|
+
if (sessionStorage.navWidth) {
|
206
|
+
navResizeFn({which: 1, pageX: parseInt(sessionStorage.navWidth, 10)});
|
207
|
+
}
|
208
|
+
}
|
209
|
+
|
210
|
+
function navExpander() {
|
211
|
+
var done = false, timer = setTimeout(postMessage, 500);
|
212
|
+
function postMessage() {
|
213
|
+
if (done) return;
|
214
|
+
clearTimeout(timer);
|
215
|
+
var opts = { action: 'expand', path: pathId };
|
216
|
+
document.getElementById('nav').contentWindow.postMessage(opts, '*');
|
217
|
+
done = true;
|
218
|
+
}
|
219
|
+
|
220
|
+
window.addEventListener('message', function(event) {
|
221
|
+
if (event.data === 'navReady') postMessage();
|
222
|
+
return false;
|
223
|
+
}, false);
|
224
|
+
}
|
225
|
+
|
226
|
+
function mainFocus() {
|
227
|
+
var hash = window.location.hash;
|
228
|
+
if (hash !== '' && $(hash)[0]) {
|
229
|
+
$(hash)[0].scrollIntoView();
|
230
|
+
}
|
231
|
+
|
232
|
+
setTimeout(function() { $('#main').focus(); }, 10);
|
207
233
|
}
|
208
234
|
|
209
|
-
$(
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
235
|
+
$(document).ready(function() {
|
236
|
+
navResizer();
|
237
|
+
navExpander();
|
238
|
+
createSourceLinks();
|
239
|
+
createDefineLinks();
|
240
|
+
createFullTreeLinks();
|
241
|
+
searchFrameButtons();
|
242
|
+
linkSummaries();
|
243
|
+
summaryToggle();
|
244
|
+
generateTOC();
|
245
|
+
mainFocus();
|
246
|
+
});
|
247
|
+
|
248
|
+
})();
|
data/doc/js/full_list.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
(function() {
|
2
|
+
|
3
|
+
var $clicked = $(null);
|
4
|
+
var searchTimeout = null;
|
3
5
|
var searchCache = [];
|
4
|
-
var searchString = '';
|
5
|
-
var regexSearchString = '';
|
6
6
|
var caseSensitiveMatch = false;
|
7
7
|
var ignoreKeyCodeMin = 8;
|
8
8
|
var ignoreKeyCodeMax = 46;
|
@@ -12,170 +12,205 @@ RegExp.escape = function(text) {
|
|
12
12
|
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
13
13
|
}
|
14
14
|
|
15
|
-
function
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
if (link.length === 0) return;
|
21
|
-
var fullName = link.attr('title').split(' ')[0];
|
22
|
-
searchCache.push({name:link.text(), fullName:fullName, node:$(this), link:link});
|
15
|
+
function escapeShortcut() {
|
16
|
+
$(document).keydown(function(evt) {
|
17
|
+
if (evt.which == 27) {
|
18
|
+
window.parent.postMessage('navEscape', '*');
|
19
|
+
}
|
23
20
|
});
|
21
|
+
}
|
24
22
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
23
|
+
function navResizer() {
|
24
|
+
$(window).mousemove(function(e) {
|
25
|
+
window.parent.postMessage({
|
26
|
+
action: 'mousemove', event: {pageX: e.pageX, which: e.which}
|
27
|
+
}, '*');
|
28
|
+
}).mouseup(function(e) {
|
29
|
+
window.parent.postMessage({action: 'mouseup'}, '*');
|
30
|
+
});
|
31
|
+
window.parent.postMessage("navReady", "*");
|
32
|
+
}
|
33
|
+
|
34
|
+
function clearSearchTimeout() {
|
35
|
+
clearTimeout(searchTimeout);
|
36
|
+
searchTimeout = null;
|
37
|
+
}
|
38
|
+
|
39
|
+
function enableLinks() {
|
40
|
+
// load the target page in the parent window
|
41
|
+
$('#full_list li').on('click', function(evt) {
|
42
|
+
$('#full_list li').removeClass('clicked');
|
43
|
+
$clicked = $(this);
|
44
|
+
$clicked.addClass('clicked');
|
45
|
+
evt.stopPropagation();
|
46
|
+
|
47
|
+
if (evt.target.tagName === 'A') return true;
|
48
|
+
|
49
|
+
var elem = $clicked.find('> .item .object_link a')[0];
|
50
|
+
var e = evt.originalEvent;
|
51
|
+
var newEvent = new MouseEvent(evt.originalEvent.type);
|
52
|
+
newEvent.initMouseEvent(e.type, e.canBubble, e.cancelable, e.view, e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget);
|
53
|
+
elem.dispatchEvent(newEvent);
|
54
|
+
evt.preventDefault();
|
55
|
+
return false;
|
56
|
+
});
|
57
|
+
}
|
58
|
+
|
59
|
+
function enableToggles() {
|
60
|
+
// show/hide nested classes on toggle click
|
61
|
+
$('#full_list a.toggle').on('click', function(evt) {
|
62
|
+
evt.stopPropagation();
|
63
|
+
evt.preventDefault();
|
64
|
+
$(this).parent().parent().toggleClass('collapsed');
|
65
|
+
highlight();
|
66
|
+
});
|
67
|
+
}
|
68
|
+
|
69
|
+
function populateSearchCache() {
|
70
|
+
$('#full_list li .item').each(function() {
|
71
|
+
var $node = $(this);
|
72
|
+
var $link = $node.find('.object_link a');
|
73
|
+
if ($link.length > 0) {
|
74
|
+
searchCache.push({
|
75
|
+
node: $node,
|
76
|
+
link: $link,
|
77
|
+
name: $link.text(),
|
78
|
+
fullName: $link.attr('title').split(' ')[0]
|
46
79
|
});
|
47
|
-
if (clicked) {
|
48
|
-
clicked.parents('ul').each(function() {
|
49
|
-
$(this).removeClass('collapsed').prev().removeClass('collapsed');
|
50
|
-
});
|
51
|
-
}
|
52
|
-
highlight();
|
53
80
|
}
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
81
|
+
});
|
82
|
+
}
|
83
|
+
|
84
|
+
function enableSearch() {
|
85
|
+
$('#search input').keyup(function(event) {
|
86
|
+
if (ignoredKeyPress(event)) return;
|
87
|
+
if (this.value === "") {
|
88
|
+
clearSearch();
|
89
|
+
} else {
|
90
|
+
performSearch(this.value);
|
61
91
|
}
|
62
92
|
});
|
63
93
|
|
64
|
-
$('#
|
65
|
-
|
94
|
+
$('#full_list').after("<div id='noresults' style='display:none'></div>");
|
95
|
+
}
|
96
|
+
|
97
|
+
function ignoredKeyPress(event) {
|
98
|
+
if (
|
99
|
+
(event.keyCode > ignoreKeyCodeMin && event.keyCode < ignoreKeyCodeMax) ||
|
100
|
+
(event.keyCode == commandKey)
|
101
|
+
) {
|
102
|
+
return true;
|
103
|
+
} else {
|
104
|
+
return false;
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
function clearSearch() {
|
109
|
+
clearSearchTimeout();
|
110
|
+
$('#full_list .found').removeClass('found').each(function() {
|
111
|
+
var $link = $(this).find('.object_link a');
|
112
|
+
$link.text($link.text());
|
113
|
+
});
|
114
|
+
$('#full_list, #content').removeClass('insearch');
|
115
|
+
$clicked.parents().removeClass('collapsed');
|
116
|
+
highlight();
|
117
|
+
}
|
118
|
+
|
119
|
+
function performSearch(searchString) {
|
120
|
+
clearSearchTimeout();
|
121
|
+
$('#full_list, #content').addClass('insearch');
|
122
|
+
$('#noresults').text('').hide();
|
123
|
+
partialSearch(searchString, 0);
|
66
124
|
}
|
67
125
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
126
|
+
function partialSearch(searchString, offset) {
|
127
|
+
var lastRowClass = '';
|
128
|
+
var i = null;
|
129
|
+
for (i = offset; i < Math.min(offset + 50, searchCache.length); i++) {
|
130
|
+
var item = searchCache[i];
|
72
131
|
var searchName = (searchString.indexOf('::') != -1 ? item.fullName : item.name);
|
73
|
-
var matchString =
|
132
|
+
var matchString = buildMatchString(searchString);
|
74
133
|
var matchRegexp = new RegExp(matchString, caseSensitiveMatch ? "" : "i");
|
75
134
|
if (searchName.match(matchRegexp) == null) {
|
76
135
|
item.node.removeClass('found');
|
136
|
+
item.link.text(item.link.text());
|
77
137
|
}
|
78
138
|
else {
|
79
|
-
item.node.
|
80
|
-
item.node.parents().addClass('search_uncollapsed');
|
139
|
+
item.node.addClass('found');
|
81
140
|
item.node.removeClass(lastRowClass).addClass(lastRowClass == 'r1' ? 'r2' : 'r1');
|
82
141
|
lastRowClass = item.node.hasClass('r1') ? 'r1' : 'r2';
|
83
142
|
item.link.html(item.name.replace(matchRegexp, "<strong>$&</strong>"));
|
84
143
|
}
|
85
|
-
|
86
|
-
if (searchCache.length === searchIndex + 1) {
|
87
|
-
searchDone();
|
88
|
-
return;
|
89
|
-
}
|
90
|
-
else {
|
91
|
-
searchIndex++;
|
92
|
-
}
|
93
144
|
}
|
94
|
-
|
145
|
+
if(i == searchCache.length) {
|
146
|
+
searchDone();
|
147
|
+
} else {
|
148
|
+
searchTimeout = setTimeout(function() {
|
149
|
+
partialSearch(searchString, i);
|
150
|
+
}, 0);
|
151
|
+
}
|
95
152
|
}
|
96
153
|
|
97
154
|
function searchDone() {
|
98
|
-
|
155
|
+
searchTimeout = null;
|
156
|
+
highlight();
|
99
157
|
if ($('#full_list li:visible').size() === 0) {
|
100
158
|
$('#noresults').text('No results were found.').hide().fadeIn();
|
101
|
-
}
|
102
|
-
|
103
|
-
$('#noresults').text('');
|
159
|
+
} else {
|
160
|
+
$('#noresults').text('').hide();
|
104
161
|
}
|
105
162
|
$('#content').removeClass('insearch');
|
106
|
-
clearTimeout(inSearch);
|
107
|
-
inSearch = null;
|
108
|
-
}
|
109
|
-
|
110
|
-
clicked = null;
|
111
|
-
function linkList() {
|
112
|
-
$('#full_list li, #full_list li a:last').click(function(evt) {
|
113
|
-
if ($(this).hasClass('toggle')) return true;
|
114
|
-
if (this.tagName.toLowerCase() == "li") {
|
115
|
-
if ($(this).find('.object_link a').length === 0) {
|
116
|
-
$(this).children('a.toggle').click();
|
117
|
-
return false;
|
118
|
-
}
|
119
|
-
var toggle = $(this).children('a.toggle');
|
120
|
-
if (toggle.size() > 0 && evt.pageX < toggle.offset().left) {
|
121
|
-
toggle.click();
|
122
|
-
return false;
|
123
|
-
}
|
124
|
-
}
|
125
|
-
if (clicked) clicked.removeClass('clicked');
|
126
|
-
var win;
|
127
|
-
try {
|
128
|
-
win = window.top.frames.main ? window.top.frames.main : window.parent;
|
129
|
-
} catch (e) { win = window.parent; }
|
130
|
-
if (this.tagName.toLowerCase() == "a") {
|
131
|
-
clicked = $(this).parents('li').addClass('clicked');
|
132
|
-
win.location = this.href;
|
133
|
-
}
|
134
|
-
else {
|
135
|
-
clicked = $(this).addClass('clicked');
|
136
|
-
win.location = $(this).find('a:last').attr('href');
|
137
|
-
}
|
138
|
-
return false;
|
139
|
-
});
|
140
163
|
}
|
141
164
|
|
142
|
-
function
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
});
|
152
|
-
$('#full_list.class').children().removeClass('collapsed');
|
153
|
-
highlight();
|
165
|
+
function buildMatchString(searchString, event) {
|
166
|
+
caseSensitiveMatch = searchString.match(/[A-Z]/) != null;
|
167
|
+
var regexSearchString = RegExp.escape(searchString);
|
168
|
+
if (caseSensitiveMatch) {
|
169
|
+
regexSearchString += "|" +
|
170
|
+
$.map(searchString.split(''), function(e) { return RegExp.escape(e); }).
|
171
|
+
join('.+?');
|
172
|
+
}
|
173
|
+
return regexSearchString;
|
154
174
|
}
|
155
175
|
|
156
|
-
function highlight(
|
157
|
-
|
158
|
-
|
159
|
-
var next = n == 1 ? 2 : 1;
|
160
|
-
$(this).removeClass("r" + next).addClass("r" + n);
|
161
|
-
if (!no_padding && $('#full_list').hasClass('class')) {
|
162
|
-
$(this).css('padding-left', (10 + $(this).parents('ul').size() * 15) + 'px');
|
163
|
-
}
|
164
|
-
n = next;
|
176
|
+
function highlight() {
|
177
|
+
$('#full_list li:visible').each(function(n) {
|
178
|
+
$(this).removeClass('even odd').addClass(n % 2 == 0 ? 'odd' : 'even');
|
165
179
|
});
|
166
180
|
}
|
167
181
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
182
|
+
/**
|
183
|
+
* Expands the tree to the target element and its immediate
|
184
|
+
* children.
|
185
|
+
*/
|
186
|
+
function expandTo(path) {
|
187
|
+
var $target = $(document.getElementById('object_' + path));
|
188
|
+
$target.addClass('clicked');
|
189
|
+
$target.removeClass('collapsed');
|
190
|
+
$target.parentsUntil('#full_list', 'li').removeClass('collapsed');
|
191
|
+
if($target[0]) {
|
192
|
+
window.scrollTo(window.scrollX, $target.offset().top - 250);
|
193
|
+
highlight();
|
194
|
+
}
|
195
|
+
}
|
196
|
+
|
197
|
+
function windowEvents(event) {
|
198
|
+
var msg = event.data;
|
199
|
+
if (msg.action === "expand") {
|
200
|
+
expandTo(msg.path);
|
201
|
+
}
|
202
|
+
return false;
|
176
203
|
}
|
177
204
|
|
178
|
-
|
179
|
-
|
180
|
-
$(
|
181
|
-
|
205
|
+
window.addEventListener("message", windowEvents, false);
|
206
|
+
|
207
|
+
$(document).ready(function() {
|
208
|
+
escapeShortcut();
|
209
|
+
navResizer();
|
210
|
+
enableLinks();
|
211
|
+
enableToggles();
|
212
|
+
populateSearchCache();
|
213
|
+
enableSearch();
|
214
|
+
});
|
215
|
+
|
216
|
+
})();
|