diff options
author | David Walter Seikel | 2014-01-13 19:47:58 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-01-13 19:47:58 +1000 |
commit | f9158592e1478b2013afc7041d9ed041cf2d2f4a (patch) | |
tree | b16e389d7988700e21b4c9741044cefa536dcbae /libraries/irrlicht-1.8/doc/html/search/search.js | |
parent | Libraries readme updated with change markers and more of the Irrlicht changes. (diff) | |
download | SledjHamr-f9158592e1478b2013afc7041d9ed041cf2d2f4a.zip SledjHamr-f9158592e1478b2013afc7041d9ed041cf2d2f4a.tar.gz SledjHamr-f9158592e1478b2013afc7041d9ed041cf2d2f4a.tar.bz2 SledjHamr-f9158592e1478b2013afc7041d9ed041cf2d2f4a.tar.xz |
Update Irrlicht to 1.8.1. Include actual change markers this time. lol
Diffstat (limited to 'libraries/irrlicht-1.8/doc/html/search/search.js')
-rw-r--r-- | libraries/irrlicht-1.8/doc/html/search/search.js | 746 |
1 files changed, 0 insertions, 746 deletions
diff --git a/libraries/irrlicht-1.8/doc/html/search/search.js b/libraries/irrlicht-1.8/doc/html/search/search.js deleted file mode 100644 index dfce251..0000000 --- a/libraries/irrlicht-1.8/doc/html/search/search.js +++ /dev/null | |||
@@ -1,746 +0,0 @@ | |||
1 | // Search script generated by doxygen | ||
2 | // Copyright (C) 2009 by Dimitri van Heesch. | ||
3 | |||
4 | // The code in this file is loosly based on main.js, part of Natural Docs, | ||
5 | // which is Copyright (C) 2003-2008 Greg Valure | ||
6 | // Natural Docs is licensed under the GPL. | ||
7 | |||
8 | var indexSectionsWithContent = | ||
9 | { | ||
10 | 0: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010111111111111111111111111110001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
11 | 1: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101100001001110111110101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
12 | 2: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
13 | 3: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101111011011100111110100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
14 | 4: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111101111111111111100001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
15 | 5: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111101111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
16 | 6: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101101001001110101111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
17 | 7: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
18 | 8: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111001011110101111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
19 | 9: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000001001100000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
20 | 10: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010110001001000100101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" | ||
21 | }; | ||
22 | |||
23 | var indexSectionNames = | ||
24 | { | ||
25 | 0: "all", | ||
26 | 1: "classes", | ||
27 | 2: "namespaces", | ||
28 | 3: "files", | ||
29 | 4: "functions", | ||
30 | 5: "variables", | ||
31 | 6: "typedefs", | ||
32 | 7: "enums", | ||
33 | 8: "enumvalues", | ||
34 | 9: "related", | ||
35 | 10: "defines" | ||
36 | }; | ||
37 | |||
38 | function convertToId(search) | ||
39 | { | ||
40 | var result = ''; | ||
41 | for (i=0;i<search.length;i++) | ||
42 | { | ||
43 | var c = search.charAt(i); | ||
44 | var cn = c.charCodeAt(0); | ||
45 | if (c.match(/[a-z0-9]/)) | ||
46 | { | ||
47 | result+=c; | ||
48 | } | ||
49 | else if (cn<16) | ||
50 | { | ||
51 | result+="_0"+cn.toString(16); | ||
52 | } | ||
53 | else | ||
54 | { | ||
55 | result+="_"+cn.toString(16); | ||
56 | } | ||
57 | } | ||
58 | return result; | ||
59 | } | ||
60 | |||
61 | function getXPos(item) | ||
62 | { | ||
63 | var x = 0; | ||
64 | if (item.offsetWidth) | ||
65 | { | ||
66 | while (item && item!=document.body) | ||
67 | { | ||
68 | x += item.offsetLeft; | ||
69 | item = item.offsetParent; | ||
70 | } | ||
71 | } | ||
72 | return x; | ||
73 | } | ||
74 | |||
75 | function getYPos(item) | ||
76 | { | ||
77 | var y = 0; | ||
78 | if (item.offsetWidth) | ||
79 | { | ||
80 | while (item && item!=document.body) | ||
81 | { | ||
82 | y += item.offsetTop; | ||
83 | item = item.offsetParent; | ||
84 | } | ||
85 | } | ||
86 | return y; | ||
87 | } | ||
88 | |||
89 | /* A class handling everything associated with the search panel. | ||
90 | |||
91 | Parameters: | ||
92 | name - The name of the global variable that will be | ||
93 | storing this instance. Is needed to be able to set timeouts. | ||
94 | resultPath - path to use for external files | ||
95 | */ | ||
96 | function SearchBox(name, resultsPath, inFrame, label) | ||
97 | { | ||
98 | if (!name || !resultsPath) { alert("Missing parameters to SearchBox."); } | ||
99 | |||
100 | // ---------- Instance variables | ||
101 | this.name = name; | ||
102 | this.resultsPath = resultsPath; | ||
103 | this.keyTimeout = 0; | ||
104 | this.keyTimeoutLength = 500; | ||
105 | this.closeSelectionTimeout = 300; | ||
106 | this.lastSearchValue = ""; | ||
107 | this.lastResultsPage = ""; | ||
108 | this.hideTimeout = 0; | ||
109 | this.searchIndex = 0; | ||
110 | this.searchActive = false; | ||
111 | this.insideFrame = inFrame; | ||
112 | this.searchLabel = label; | ||
113 | |||
114 | // ----------- DOM Elements | ||
115 | |||
116 | this.DOMSearchField = function() | ||
117 | { return document.getElementById("MSearchField"); } | ||
118 | |||
119 | this.DOMSearchSelect = function() | ||
120 | { return document.getElementById("MSearchSelect"); } | ||
121 | |||
122 | this.DOMSearchSelectWindow = function() | ||
123 | { return document.getElementById("MSearchSelectWindow"); } | ||
124 | |||
125 | this.DOMPopupSearchResults = function() | ||
126 | { return document.getElementById("MSearchResults"); } | ||
127 | |||
128 | this.DOMPopupSearchResultsWindow = function() | ||
129 | { return document.getElementById("MSearchResultsWindow"); } | ||
130 | |||
131 | this.DOMSearchClose = function() | ||
132 | { return document.getElementById("MSearchClose"); } | ||
133 | |||
134 | this.DOMSearchBox = function() | ||
135 | { return document.getElementById("MSearchBox"); } | ||
136 | |||
137 | // ------------ Event Handlers | ||
138 | |||
139 | // Called when focus is added or removed from the search field. | ||
140 | this.OnSearchFieldFocus = function(isActive) | ||
141 | { | ||
142 | this.Activate(isActive); | ||
143 | } | ||
144 | |||
145 | this.OnSearchSelectShow = function() | ||
146 | { | ||
147 | var searchSelectWindow = this.DOMSearchSelectWindow(); | ||
148 | var searchField = this.DOMSearchSelect(); | ||
149 | |||
150 | if (this.insideFrame) | ||
151 | { | ||
152 | var left = getXPos(searchField); | ||
153 | var top = getYPos(searchField); | ||
154 | left += searchField.offsetWidth + 6; | ||
155 | top += searchField.offsetHeight; | ||
156 | |||
157 | // show search selection popup | ||
158 | searchSelectWindow.style.display='block'; | ||
159 | left -= searchSelectWindow.offsetWidth; | ||
160 | searchSelectWindow.style.left = left + 'px'; | ||
161 | searchSelectWindow.style.top = top + 'px'; | ||
162 | } | ||
163 | else | ||
164 | { | ||
165 | var left = getXPos(searchField); | ||
166 | var top = getYPos(searchField); | ||
167 | top += searchField.offsetHeight; | ||
168 | |||
169 | // show search selection popup | ||
170 | searchSelectWindow.style.display='block'; | ||
171 | searchSelectWindow.style.left = left + 'px'; | ||
172 | searchSelectWindow.style.top = top + 'px'; | ||
173 | } | ||
174 | |||
175 | // stop selection hide timer | ||
176 | if (this.hideTimeout) | ||
177 | { | ||
178 | clearTimeout(this.hideTimeout); | ||
179 | this.hideTimeout=0; | ||
180 | } | ||
181 | return false; // to avoid "image drag" default event | ||
182 | } | ||
183 | |||
184 | this.OnSearchSelectHide = function() | ||
185 | { | ||
186 | this.hideTimeout = setTimeout(this.name +".CloseSelectionWindow()", | ||
187 | this.closeSelectionTimeout); | ||
188 | } | ||
189 | |||
190 | // Called when the content of the search field is changed. | ||
191 | this.OnSearchFieldChange = function(evt) | ||
192 | { | ||
193 | if (this.keyTimeout) // kill running timer | ||
194 | { | ||
195 | clearTimeout(this.keyTimeout); | ||
196 | this.keyTimeout = 0; | ||
197 | } | ||
198 | |||
199 | var e = (evt) ? evt : window.event; // for IE | ||
200 | if (e.keyCode==40 || e.keyCode==13) | ||
201 | { | ||
202 | if (e.shiftKey==1) | ||
203 | { | ||
204 | this.OnSearchSelectShow(); | ||
205 | var win=this.DOMSearchSelectWindow(); | ||
206 | for (i=0;i<win.childNodes.length;i++) | ||
207 | { | ||
208 | var child = win.childNodes[i]; // get span within a | ||
209 | if (child.className=='SelectItem') | ||
210 | { | ||
211 | child.focus(); | ||
212 | return; | ||
213 | } | ||
214 | } | ||
215 | return; | ||
216 | } | ||
217 | else if (window.frames.MSearchResults.searchResults) | ||
218 | { | ||
219 | var elem = window.frames.MSearchResults.searchResults.NavNext(0); | ||
220 | if (elem) elem.focus(); | ||
221 | } | ||
222 | } | ||
223 | else if (e.keyCode==27) // Escape out of the search field | ||
224 | { | ||
225 | this.DOMSearchField().blur(); | ||
226 | this.DOMPopupSearchResultsWindow().style.display = 'none'; | ||
227 | this.DOMSearchClose().style.display = 'none'; | ||
228 | this.lastSearchValue = ''; | ||
229 | this.Activate(false); | ||
230 | return; | ||
231 | } | ||
232 | |||
233 | // strip whitespaces | ||
234 | var searchValue = this.DOMSearchField().value.replace(/ +/g, ""); | ||
235 | |||
236 | if (searchValue != this.lastSearchValue) // search value has changed | ||
237 | { | ||
238 | if (searchValue != "") // non-empty search | ||
239 | { | ||
240 | // set timer for search update | ||
241 | this.keyTimeout = setTimeout(this.name + '.Search()', | ||
242 | this.keyTimeoutLength); | ||
243 | } | ||
244 | else // empty search field | ||
245 | { | ||
246 | this.DOMPopupSearchResultsWindow().style.display = 'none'; | ||
247 | this.DOMSearchClose().style.display = 'none'; | ||
248 | this.lastSearchValue = ''; | ||
249 | } | ||
250 | } | ||
251 | } | ||
252 | |||
253 | this.SelectItemCount = function(id) | ||
254 | { | ||
255 | var count=0; | ||
256 | var win=this.DOMSearchSelectWindow(); | ||
257 | for (i=0;i<win.childNodes.length;i++) | ||
258 | { | ||
259 | var child = win.childNodes[i]; // get span within a | ||
260 | if (child.className=='SelectItem') | ||
261 | { | ||
262 | count++; | ||
263 | } | ||
264 | } | ||
265 | return count; | ||
266 | } | ||
267 | |||
268 | this.SelectItemSet = function(id) | ||
269 | { | ||
270 | var i,j=0; | ||
271 | var win=this.DOMSearchSelectWindow(); | ||
272 | for (i=0;i<win.childNodes.length;i++) | ||
273 | { | ||
274 | var child = win.childNodes[i]; // get span within a | ||
275 | if (child.className=='SelectItem') | ||
276 | { | ||
277 | var node = child.firstChild; | ||
278 | if (j==id) | ||
279 | { | ||
280 | node.innerHTML='•'; | ||
281 | } | ||
282 | else | ||
283 | { | ||
284 | node.innerHTML=' '; | ||
285 | } | ||
286 | j++; | ||
287 | } | ||
288 | } | ||
289 | } | ||
290 | |||
291 | // Called when an search filter selection is made. | ||
292 | // set item with index id as the active item | ||
293 | this.OnSelectItem = function(id) | ||
294 | { | ||
295 | this.searchIndex = id; | ||
296 | this.SelectItemSet(id); | ||
297 | var searchValue = this.DOMSearchField().value.replace(/ +/g, ""); | ||
298 | if (searchValue!="" && this.searchActive) // something was found -> do a search | ||
299 | { | ||
300 | this.Search(); | ||
301 | } | ||
302 | } | ||
303 | |||
304 | this.OnSearchSelectKey = function(evt) | ||
305 | { | ||
306 | var e = (evt) ? evt : window.event; // for IE | ||
307 | if (e.keyCode==40 && this.searchIndex<this.SelectItemCount()) // Down | ||
308 | { | ||
309 | this.searchIndex++; | ||
310 | this.OnSelectItem(this.searchIndex); | ||
311 | } | ||
312 | else if (e.keyCode==38 && this.searchIndex>0) // Up | ||
313 | { | ||
314 | this.searchIndex--; | ||
315 | this.OnSelectItem(this.searchIndex); | ||
316 | } | ||
317 | else if (e.keyCode==13 || e.keyCode==27) | ||
318 | { | ||
319 | this.OnSelectItem(this.searchIndex); | ||
320 | this.CloseSelectionWindow(); | ||
321 | this.DOMSearchField().focus(); | ||
322 | } | ||
323 | return false; | ||
324 | } | ||
325 | |||
326 | // --------- Actions | ||
327 | |||
328 | // Closes the results window. | ||
329 | this.CloseResultsWindow = function() | ||
330 | { | ||
331 | this.DOMPopupSearchResultsWindow().style.display = 'none'; | ||
332 | this.DOMSearchClose().style.display = 'none'; | ||
333 | this.Activate(false); | ||
334 | } | ||
335 | |||
336 | this.CloseSelectionWindow = function() | ||
337 | { | ||
338 | this.DOMSearchSelectWindow().style.display = 'none'; | ||
339 | } | ||
340 | |||
341 | // Performs a search. | ||
342 | this.Search = function() | ||
343 | { | ||
344 | this.keyTimeout = 0; | ||
345 | |||
346 | // strip leading whitespace | ||
347 | var searchValue = this.DOMSearchField().value.replace(/^ +/, ""); | ||
348 | |||
349 | var code = searchValue.toLowerCase().charCodeAt(0); | ||
350 | var hexCode; | ||
351 | if (code<16) | ||
352 | { | ||
353 | hexCode="0"+code.toString(16); | ||
354 | } | ||
355 | else | ||
356 | { | ||
357 | hexCode=code.toString(16); | ||
358 | } | ||
359 | |||
360 | var resultsPage; | ||
361 | var resultsPageWithSearch; | ||
362 | var hasResultsPage; | ||
363 | |||
364 | if (indexSectionsWithContent[this.searchIndex].charAt(code) == '1') | ||
365 | { | ||
366 | resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + '.html'; | ||
367 | resultsPageWithSearch = resultsPage+'?'+escape(searchValue); | ||
368 | hasResultsPage = true; | ||
369 | } | ||
370 | else // nothing available for this search term | ||
371 | { | ||
372 | resultsPage = this.resultsPath + '/nomatches.html'; | ||
373 | resultsPageWithSearch = resultsPage; | ||
374 | hasResultsPage = false; | ||
375 | } | ||
376 | |||
377 | window.frames.MSearchResults.location = resultsPageWithSearch; | ||
378 | var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow(); | ||
379 | |||
380 | if (domPopupSearchResultsWindow.style.display!='block') | ||
381 | { | ||
382 | var domSearchBox = this.DOMSearchBox(); | ||
383 | this.DOMSearchClose().style.display = 'inline'; | ||
384 | if (this.insideFrame) | ||
385 | { | ||
386 | var domPopupSearchResults = this.DOMPopupSearchResults(); | ||
387 | domPopupSearchResultsWindow.style.position = 'relative'; | ||
388 | domPopupSearchResultsWindow.style.display = 'block'; | ||
389 | var width = document.body.clientWidth - 8; // the -8 is for IE :-( | ||
390 | domPopupSearchResultsWindow.style.width = width + 'px'; | ||
391 | domPopupSearchResults.style.width = width + 'px'; | ||
392 | } | ||
393 | else | ||
394 | { | ||
395 | var domPopupSearchResults = this.DOMPopupSearchResults(); | ||
396 | var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth; | ||
397 | var top = getYPos(domSearchBox) + 20; // domSearchBox.offsetHeight + 1; | ||
398 | domPopupSearchResultsWindow.style.display = 'block'; | ||
399 | left -= domPopupSearchResults.offsetWidth; | ||
400 | domPopupSearchResultsWindow.style.top = top + 'px'; | ||
401 | domPopupSearchResultsWindow.style.left = left + 'px'; | ||
402 | } | ||
403 | } | ||
404 | |||
405 | this.lastSearchValue = searchValue; | ||
406 | this.lastResultsPage = resultsPage; | ||
407 | } | ||
408 | |||
409 | // -------- Activation Functions | ||
410 | |||
411 | // Activates or deactivates the search panel, resetting things to | ||
412 | // their default values if necessary. | ||
413 | this.Activate = function(isActive) | ||
414 | { | ||
415 | if (isActive || // open it | ||
416 | this.DOMPopupSearchResultsWindow().style.display == 'block' | ||
417 | ) | ||
418 | { | ||
419 | this.DOMSearchBox().className = 'MSearchBoxActive'; | ||
420 | |||
421 | var searchField = this.DOMSearchField(); | ||
422 | |||
423 | if (searchField.value == this.searchLabel) // clear "Search" term upon entry | ||
424 | { | ||
425 | searchField.value = ''; | ||
426 | this.searchActive = true; | ||
427 | } | ||
428 | } | ||
429 | else if (!isActive) // directly remove the panel | ||
430 | { | ||
431 | this.DOMSearchBox().className = 'MSearchBoxInactive'; | ||
432 | this.DOMSearchField().value = this.searchLabel; | ||
433 | this.searchActive = false; | ||
434 | this.lastSearchValue = '' | ||
435 | this.lastResultsPage = ''; | ||
436 | } | ||
437 | } | ||
438 | } | ||
439 | |||
440 | // ----------------------------------------------------------------------- | ||
441 | |||
442 | // The class that handles everything on the search results page. | ||
443 | function SearchResults(name) | ||
444 | { | ||
445 | // The number of matches from the last run of <Search()>. | ||
446 | this.lastMatchCount = 0; | ||
447 | this.lastKey = 0; | ||
448 | this.repeatOn = false; | ||
449 | |||
450 | // Toggles the visibility of the passed element ID. | ||
451 | this.FindChildElement = function(id) | ||
452 | { | ||
453 | var parentElement = document.getElementById(id); | ||
454 | var element = parentElement.firstChild; | ||
455 | |||
456 | while (element && element!=parentElement) | ||
457 | { | ||
458 | if (element.nodeName == 'DIV' && element.className == 'SRChildren') | ||
459 | { | ||
460 | return element; | ||
461 | } | ||
462 | |||
463 | if (element.nodeName == 'DIV' && element.hasChildNodes()) | ||
464 | { | ||
465 | element = element.firstChild; | ||
466 | } | ||
467 | else if (element.nextSibling) | ||
468 | { | ||
469 | element = element.nextSibling; | ||
470 | } | ||
471 | else | ||
472 | { | ||
473 | do | ||
474 | { | ||
475 | element = element.parentNode; | ||
476 | } | ||
477 | while (element && element!=parentElement && !element.nextSibling); | ||
478 | |||
479 | if (element && element!=parentElement) | ||
480 | { | ||
481 | element = element.nextSibling; | ||
482 | } | ||
483 | } | ||
484 | } | ||
485 | } | ||
486 | |||
487 | this.Toggle = function(id) | ||
488 | { | ||
489 | var element = this.FindChildElement(id); | ||
490 | if (element) | ||
491 | { | ||
492 | if (element.style.display == 'block') | ||
493 | { | ||
494 | element.style.display = 'none'; | ||
495 | } | ||
496 | else | ||
497 | { | ||
498 | element.style.display = 'block'; | ||
499 | } | ||
500 | } | ||
501 | } | ||
502 | |||
503 | // Searches for the passed string. If there is no parameter, | ||
504 | // it takes it from the URL query. | ||
505 | // | ||
506 | // Always returns true, since other documents may try to call it | ||
507 | // and that may or may not be possible. | ||
508 | this.Search = function(search) | ||
509 | { | ||
510 | if (!search) // get search word from URL | ||
511 | { | ||
512 | search = window.location.search; | ||
513 | search = search.substring(1); // Remove the leading '?' | ||
514 | search = unescape(search); | ||
515 | } | ||
516 | |||
517 | search = search.replace(/^ +/, ""); // strip leading spaces | ||
518 | search = search.replace(/ +$/, ""); // strip trailing spaces | ||
519 | search = search.toLowerCase(); | ||
520 | search = convertToId(search); | ||
521 | |||
522 | var resultRows = document.getElementsByTagName("div"); | ||
523 | var matches = 0; | ||
524 | |||
525 | var i = 0; | ||
526 | while (i < resultRows.length) | ||
527 | { | ||
528 | var row = resultRows.item(i); | ||
529 | if (row.className == "SRResult") | ||
530 | { | ||
531 | var rowMatchName = row.id.toLowerCase(); | ||
532 | rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_' | ||
533 | |||
534 | if (search.length<=rowMatchName.length && | ||
535 | rowMatchName.substr(0, search.length)==search) | ||
536 | { | ||
537 | row.style.display = 'block'; | ||
538 | matches++; | ||
539 | } | ||
540 | else | ||
541 | { | ||
542 | row.style.display = 'none'; | ||
543 | } | ||
544 | } | ||
545 | i++; | ||
546 | } | ||
547 | document.getElementById("Searching").style.display='none'; | ||
548 | if (matches == 0) // no results | ||
549 | { | ||
550 | document.getElementById("NoMatches").style.display='block'; | ||
551 | } | ||
552 | else // at least one result | ||
553 | { | ||
554 | document.getElementById("NoMatches").style.display='none'; | ||
555 | } | ||
556 | this.lastMatchCount = matches; | ||
557 | return true; | ||
558 | } | ||
559 | |||
560 | // return the first item with index index or higher that is visible | ||
561 | this.NavNext = function(index) | ||
562 | { | ||
563 | var focusItem; | ||
564 | while (1) | ||
565 | { | ||
566 | var focusName = 'Item'+index; | ||
567 | focusItem = document.getElementById(focusName); | ||
568 | if (focusItem && focusItem.parentNode.parentNode.style.display=='block') | ||
569 | { | ||
570 | break; | ||
571 | } | ||
572 | else if (!focusItem) // last element | ||
573 | { | ||
574 | break; | ||
575 | } | ||
576 | focusItem=null; | ||
577 | index++; | ||
578 | } | ||
579 | return focusItem; | ||
580 | } | ||
581 | |||
582 | this.NavPrev = function(index) | ||
583 | { | ||
584 | var focusItem; | ||
585 | while (1) | ||
586 | { | ||
587 | var focusName = 'Item'+index; | ||
588 | focusItem = document.getElementById(focusName); | ||
589 | if (focusItem && focusItem.parentNode.parentNode.style.display=='block') | ||
590 | { | ||
591 | break; | ||
592 | } | ||
593 | else if (!focusItem) // last element | ||
594 | { | ||
595 | break; | ||
596 | } | ||
597 | focusItem=null; | ||
598 | index--; | ||
599 | } | ||
600 | return focusItem; | ||
601 | } | ||
602 | |||
603 | this.ProcessKeys = function(e) | ||
604 | { | ||
605 | if (e.type == "keydown") | ||
606 | { | ||
607 | this.repeatOn = false; | ||
608 | this.lastKey = e.keyCode; | ||
609 | } | ||
610 | else if (e.type == "keypress") | ||
611 | { | ||
612 | if (!this.repeatOn) | ||
613 | { | ||
614 | if (this.lastKey) this.repeatOn = true; | ||
615 | return false; // ignore first keypress after keydown | ||
616 | } | ||
617 | } | ||
618 | else if (e.type == "keyup") | ||
619 | { | ||
620 | this.lastKey = 0; | ||
621 | this.repeatOn = false; | ||
622 | } | ||
623 | return this.lastKey!=0; | ||
624 | } | ||
625 | |||
626 | this.Nav = function(evt,itemIndex) | ||
627 | { | ||
628 | var e = (evt) ? evt : window.event; // for IE | ||
629 | if (e.keyCode==13) return true; | ||
630 | if (!this.ProcessKeys(e)) return false; | ||
631 | |||
632 | if (this.lastKey==38) // Up | ||
633 | { | ||
634 | var newIndex = itemIndex-1; | ||
635 | var focusItem = this.NavPrev(newIndex); | ||
636 | if (focusItem) | ||
637 | { | ||
638 | var child = this.FindChildElement(focusItem.parentNode.parentNode.id); | ||
639 | if (child && child.style.display == 'block') // children visible | ||
640 | { | ||
641 | var n=0; | ||
642 | var tmpElem; | ||
643 | while (1) // search for last child | ||
644 | { | ||
645 | tmpElem = document.getElementById('Item'+newIndex+'_c'+n); | ||
646 | if (tmpElem) | ||
647 | { | ||
648 | focusItem = tmpElem; | ||
649 | } | ||
650 | else // found it! | ||
651 | { | ||
652 | break; | ||
653 | } | ||
654 | n++; | ||
655 | } | ||
656 | } | ||
657 | } | ||
658 | if (focusItem) | ||
659 | { | ||
660 | focusItem.focus(); | ||
661 | } | ||
662 | else // return focus to search field | ||
663 | { | ||
664 | parent.document.getElementById("MSearchField").focus(); | ||
665 | } | ||
666 | } | ||
667 | else if (this.lastKey==40) // Down | ||
668 | { | ||
669 | var newIndex = itemIndex+1; | ||
670 | var focusItem; | ||
671 | var item = document.getElementById('Item'+itemIndex); | ||
672 | var elem = this.FindChildElement(item.parentNode.parentNode.id); | ||
673 | if (elem && elem.style.display == 'block') // children visible | ||
674 | { | ||
675 | focusItem = document.getElementById('Item'+itemIndex+'_c0'); | ||
676 | } | ||
677 | if (!focusItem) focusItem = this.NavNext(newIndex); | ||
678 | if (focusItem) focusItem.focus(); | ||
679 | } | ||
680 | else if (this.lastKey==39) // Right | ||
681 | { | ||
682 | var item = document.getElementById('Item'+itemIndex); | ||
683 | var elem = this.FindChildElement(item.parentNode.parentNode.id); | ||
684 | if (elem) elem.style.display = 'block'; | ||
685 | } | ||
686 | else if (this.lastKey==37) // Left | ||
687 | { | ||
688 | var item = document.getElementById('Item'+itemIndex); | ||
689 | var elem = this.FindChildElement(item.parentNode.parentNode.id); | ||
690 | if (elem) elem.style.display = 'none'; | ||
691 | } | ||
692 | else if (this.lastKey==27) // Escape | ||
693 | { | ||
694 | parent.searchBox.CloseResultsWindow(); | ||
695 | parent.document.getElementById("MSearchField").focus(); | ||
696 | } | ||
697 | else if (this.lastKey==13) // Enter | ||
698 | { | ||
699 | return true; | ||
700 | } | ||
701 | return false; | ||
702 | } | ||
703 | |||
704 | this.NavChild = function(evt,itemIndex,childIndex) | ||
705 | { | ||
706 | var e = (evt) ? evt : window.event; // for IE | ||
707 | if (e.keyCode==13) return true; | ||
708 | if (!this.ProcessKeys(e)) return false; | ||
709 | |||
710 | if (this.lastKey==38) // Up | ||
711 | { | ||
712 | if (childIndex>0) | ||
713 | { | ||
714 | var newIndex = childIndex-1; | ||
715 | document.getElementById('Item'+itemIndex+'_c'+newIndex).focus(); | ||
716 | } | ||
717 | else // already at first child, jump to parent | ||
718 | { | ||
719 | document.getElementById('Item'+itemIndex).focus(); | ||
720 | } | ||
721 | } | ||
722 | else if (this.lastKey==40) // Down | ||
723 | { | ||
724 | var newIndex = childIndex+1; | ||
725 | var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex); | ||
726 | if (!elem) // last child, jump to parent next parent | ||
727 | { | ||
728 | elem = this.NavNext(itemIndex+1); | ||
729 | } | ||
730 | if (elem) | ||
731 | { | ||
732 | elem.focus(); | ||
733 | } | ||
734 | } | ||
735 | else if (this.lastKey==27) // Escape | ||
736 | { | ||
737 | parent.searchBox.CloseResultsWindow(); | ||
738 | parent.document.getElementById("MSearchField").focus(); | ||
739 | } | ||
740 | else if (this.lastKey==13) // Enter | ||
741 | { | ||
742 | return true; | ||
743 | } | ||
744 | return false; | ||
745 | } | ||
746 | } | ||