diff options
Diffstat (limited to 'frontend/js/wlca.js')
-rw-r--r-- | frontend/js/wlca.js | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/frontend/js/wlca.js b/frontend/js/wlca.js index 942300c..d62994b 100644 --- a/frontend/js/wlca.js +++ b/frontend/js/wlca.js @@ -4,7 +4,7 @@ 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 (tag.childNodes[i].className && tag.childNodes[i].className.indexOf('wlcae') != -1) { if (typeof(set) == 'undefined') { set=tag.childNodes[i].style.display=="none"?"":"none"; } @@ -35,21 +35,39 @@ function wlca_search(q, el, depth, maxdepth, t) { } 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/))) { + if (el.childNodes[i].nodeName == "LABEL" || (el.childNodes[i].className && el.childNodes[i].className.indexOf('wlcal') != -1)) { 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; + if (!(el.childNodes[i].className && el.childNodes[i].className.indexOf('wlcae') != -1)) 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/)) { + if (q.length == 0 && el.className.indexOf('wlcac') != -1) { wlca_collapse(el.id); } } return found; } +function wlca_show_checked(el, depth, maxdepth) { + if (depth == 0) { + wlca_last_search=undefined; + } + var found=0; + for (var i=0; i<el.childNodes.length; i++) { + if (el.childNodes[i].nodeName == "INPUT" && el.childNodes[i].type == "checkbox" && el.childNodes[i].checked) { + found++; + } + if (depth < maxdepth) { + if (!(el.childNodes[i].className && el.childNodes[i].className.indexOf('wlcae') != -1)) continue; + var lfound=wlca_show_checked(el.childNodes[i], depth+1, maxdepth); + found+=lfound; + el.childNodes[i].style.display=(lfound > 0?"":"none"); + } + } + return found; +} |