summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Dubochet <gilles.dubochet@epfl.ch>2010-01-19 10:52:43 +0000
committerGilles Dubochet <gilles.dubochet@epfl.ch>2010-01-19 10:52:43 +0000
commitefd68171b564ae4ee46149f9ca4329858c1c231e (patch)
tree602f08ace64f349c80a1984eaea6ea897f504baa
parent41e80159b37d8a07922fb90d516b9105f2f185b7 (diff)
downloadscala-efd68171b564ae4ee46149f9ca4329858c1c231e.tar.gz
scala-efd68171b564ae4ee46149f9ca4329858c1c231e.tar.bz2
scala-efd68171b564ae4ee46149f9ca4329858c1c231e.zip
[scaladoc] Search tool will ignore case for low...
[scaladoc] Search tool will ignore case for lowercase-only queries. Type return when search tool is active to immediately search and display the first result. Contributed by Johannes Rudolph. Also: removed useless `DocProvider` class. No review, checked by dubochet.
-rw-r--r--src/compiler/scala/tools/nsc/doc/DocProvider.scala3
-rw-r--r--src/compiler/scala/tools/nsc/doc/html/resource/lib/index.js32
2 files changed, 23 insertions, 12 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/DocProvider.scala b/src/compiler/scala/tools/nsc/doc/DocProvider.scala
deleted file mode 100644
index bcf227ebb9..0000000000
--- a/src/compiler/scala/tools/nsc/doc/DocProvider.scala
+++ /dev/null
@@ -1,3 +0,0 @@
-package scala.tools.nsc.doc
-
-class DocProvider \ No newline at end of file
diff --git a/src/compiler/scala/tools/nsc/doc/html/resource/lib/index.js b/src/compiler/scala/tools/nsc/doc/html/resource/lib/index.js
index ad8a53529b..b9a1408016 100644
--- a/src/compiler/scala/tools/nsc/doc/html/resource/lib/index.js
+++ b/src/compiler/scala/tools/nsc/doc/html/resource/lib/index.js
@@ -1,4 +1,4 @@
-// © 2009 EPFL/LAMP
+// © 2009 EPFL/LAMP
// written by Gilles Dubochet with contributions by Johannes Rudolph and "spiros"
$(document).ready(function(){
@@ -16,9 +16,15 @@ $(document).ready(function(){
});
function search() {
var query = $("#quickflt").attr("value");
- // Regexp that matches CamelCase subbits: "BiSe" is
- // "[a-z]*Bi[a-z]*Se" and matches "BitSet", "ABitSet", ...
- var queryRegExp = new RegExp(query.replace(/([A-Z])/g,"[a-z]*$1"));
+ var queryRegExp;
+ if (query.toLowerCase() != query)
+ // Regexp that matches CamelCase subbits: "BiSe" is
+ // "[a-z]*Bi[a-z]*Se" and matches "BitSet", "ABitSet", ...
+ queryRegExp = new RegExp(query.replace(/([A-Z])/g,"[a-z]*$1"));
+ else
+ // if query is all lower case make a normal case insensitive search
+ queryRegExp = new RegExp(query, "i");
+
$("#tpl ol.templates > li").each(function(){
var item = $(this).attr("title");
if (item == "" || queryRegExp.test(item)) {
@@ -34,14 +40,22 @@ $(document).ready(function(){
pendingTimeout = undefined;
};
var pendingTimeout = undefined;
- $("#quickflt").bind("keyup", function(event) {
- if (event.keyCode == 27) { // escape
- $("#quickflt").attr("value", "");
- }
+ $("#quickflt").bind("keyup", function(event) {
if (pendingTimeout != undefined) {
clearTimeout(pendingTimeout);
}
- pendingTimeout = setTimeout(search, 200); //delay 0.2 sec
+ if (event.keyCode == 27) { // escape
+ $("#quickflt").attr("value", "");
+ search();
+ }
+ else if (event.keyCode == 13) { // return key:
+ // search immediately and go into first entry
+ search();
+ $("#tpl ol.templates > li:not(.hide) a:first").click();
+ }
+ else {
+ pendingTimeout = setTimeout(search, 200); //delay 0.2 sec
+ }
});
$("#tpl .packages > li").prepend("<a class='packhide'>hide</a>");
$("#tpl .packages > li > a.packhide").click(function(event){