summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/doc/html/resource/lib/template.js
diff options
context:
space:
mode:
authorGilles Dubochet <gilles.dubochet@epfl.ch>2010-06-18 15:34:35 +0000
committerGilles Dubochet <gilles.dubochet@epfl.ch>2010-06-18 15:34:35 +0000
commitcb367e28eed815419d29fb73acb2d66c7d3ecb3f (patch)
treebdd823ad2269749cd59d3fb0ae91a1f2cd118c7c /src/compiler/scala/tools/nsc/doc/html/resource/lib/template.js
parent9923b97157725ae1f7853a4834ef5e31283a1b98 (diff)
downloadscala-cb367e28eed815419d29fb73acb2d66c7d3ecb3f.tar.gz
scala-cb367e28eed815419d29fb73acb2d66c7d3ecb3f.tar.bz2
scala-cb367e28eed815419d29fb73acb2d66c7d3ecb3f.zip
[scaladoc] There is a text filter tool for memb...
[scaladoc] There is a text filter tool for members (searching on member name and comment body). Adds button to reset text filter tool. No review. Known limitation: filtering of members is blocking on keystroke leading to sluggish performance on large classes. Scheduler from index needs to be used for member filtering.
Diffstat (limited to 'src/compiler/scala/tools/nsc/doc/html/resource/lib/template.js')
-rw-r--r--src/compiler/scala/tools/nsc/doc/html/resource/lib/template.js25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/html/resource/lib/template.js b/src/compiler/scala/tools/nsc/doc/html/resource/lib/template.js
index 5e24f3f5a8..034ad666c0 100644
--- a/src/compiler/scala/tools/nsc/doc/html/resource/lib/template.js
+++ b/src/compiler/scala/tools/nsc/doc/html/resource/lib/template.js
@@ -9,6 +9,20 @@ $(document).ready(function(){
prefilters.removeClass("in");
prefilters.addClass("out");
filter();
+
+ var input = $("#textfilter > input");
+ input.bind("keyup", function(event) {
+ if (event.keyCode == 27) { // escape
+ input.attr("value", "");
+ }
+ filter();
+ });
+ input.focus(function(event) { input.select(); });
+ $("#textfilter > .post").click(function(){
+ $("#textfilter > input").attr("value", "");
+ filter();
+ });
+
$("#ancestors > ol > li").click(function(){
if ($(this).hasClass("in")) {
$(this).removeClass("in");
@@ -174,6 +188,8 @@ function initInherit() {
};
function filter() {
+ var query = $("#textfilter > input").attr("value").toLowerCase();
+ var queryRegExp = new RegExp(query, "i");
var inheritHides = null
if ($("#order > ol > li.inherit").hasClass("in")) {
inheritHides = $("#linearization > li:gt(0)");
@@ -201,11 +217,16 @@ function filter() {
};
};
};
- var showByVis = true
+ var showByVis = true;
if (vis1 == "prt") {
showByVis = prtVisbl;
};
- if (showByOwned && showByVis) {
+ var showByName = true;
+ if (query != "") {
+ var content = $(this).attr("name") + $("> .fullcomment .cmt", this).text();
+ showByName = queryRegExp.test(content);
+ };
+ if (showByOwned && showByVis && showByName) {
$(this).show();
}
else {