1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
var wlca_last_search;
var wlca_search_timeout;
var wlca_found_last;
function wlcat(id, set) { // Short for 'toggle'
tag=document.getElementById(id);
for (var i=1; i<tag.childNodes.length; i++) {
if (tag.childNodes[i].className && tag.childNodes[i].className.match(/wlcae/)) {
if (typeof(set) == 'undefined') {
set=tag.childNodes[i].style.display=="none"?"":"none";
}
tag.childNodes[i].style.display=set;
}
}
}
function wlca_expand(id) {
wlcat(id, "");
}
function wlca_collapse(id) {
wlcat(id, "none");
}
function wlca_search(q, el, depth, maxdepth, t) {
if (!t) {
clearTimeout(wlca_search_timeout);
wlca_search_timeout=setTimeout(function () {wlca_found_last=wlca_search(q, el, depth, maxdepth, true)}, 300);
return;
}
if (depth == 0) {
if (q == wlca_last_search) return wlca_found_last;
if (wlca_found_last == 0 && q.indexOf(wlca_last_search) != -1) {
debug('wlca', 'Already had no results, not searching "'+q+'"');
return 0;
}
wlca_last_search=q;
debug('wlca', 'Searching "'+q+'"');
}
var found=0;
for (var i=0; i<el.childNodes.length; i++) {
if (el.childNodes[i].nodeName == "LABEL" || (el.childNodes[i].className && el.childNodes[i].className.match(/wlcal/))) {
found+=(el.childNodes[i].innerHTML.indexOf(q) == -1?0:1);
break;
}
}
if (depth < maxdepth) {
for (var i=0; i<el.childNodes.length; i++) {
if (!(el.childNodes[i].className && el.childNodes[i].className.match(/wlcae/))) continue;
var lfound=wlca_search(q, el.childNodes[i], depth+1, maxdepth, true);
found+=lfound;
el.childNodes[i].style.display=(q.length == 0 || lfound > 0?"":"none");
}
if (q.length == 0 && el.className.match(/wlcac/)) {
wlca_collapse(el.id);
}
}
return found;
}
|