Skip to content
This repository
Browse code

Actually fixes SI-5055. Scaladoc now a zillion times less annoying

  • Loading branch information...
commit 6296e324485f1d457e561824a3a8ddcafc3a08d8 1 parent 234390f
Heather Miller authored May 19, 2012
52  src/compiler/scala/tools/nsc/doc/html/resource/lib/template.js
@@ -25,9 +25,37 @@ $(document).ready(function(){
25 25
     // Member filter box
26 26
     var input = $("#textfilter input");
27 27
     input.bind("keyup", function(event) {
28  
-        if (event.keyCode == 27)
29  
-            input.val(""); // escape key
30  
-        filter(true);
  28
+
  29
+        switch ( event.keyCode ) {
  30
+
  31
+        case 27: // escape key
  32
+            input.val("");
  33
+            filter(true);
  34
+            break;
  35
+
  36
+        case 38: // up
  37
+            input.val("");
  38
+            filter(false);
  39
+            window.scrollTo(0, $("body").offset().top);
  40
+            input.focus();
  41
+            break;
  42
+
  43
+        case 33: //page up
  44
+            input.val("");
  45
+            filter(false);            
  46
+            break;
  47
+
  48
+        case 34: //page down
  49
+            input.val("");
  50
+            filter(false);            
  51
+            break;            
  52
+
  53
+        default: 
  54
+            window.scrollTo(0, $("#mbrsel").offset().top);
  55
+            filter(true);        
  56
+            break;
  57
+
  58
+        }        
31 59
     });
32 60
     input.focus(function(event) {
33 61
         input.select();
@@ -37,18 +65,13 @@ $(document).ready(function(){
37 65
         filter();
38 66
     });
39 67
     $(document).keydown(function(event) {
40  
-        if(!event.altKey && !event.ctrlKey &&
41  
-           (event.keyCode == 27 || (event.keyCode >= 48 && event.keyCode <= 90)) &&
42  
-           document.activeElement != $("#textfilter input")[0]) {
43  
-               $("#textfilter input").focus();
44  
-        }
45  
-        if(event.keyCode == 9) {
  68
+
  69
+        if (event.keyCode == 9) { // tab
46 70
             $("#index-input", window.parent.document).focus();
47 71
             input.attr("value", "");
48 72
             return false;            
49  
-        }        
  73
+        }
50 74
     });
51  
-    $("#textfilter input").focus();
52 75
 
53 76
     $("#linearization li").click(function(){
54 77
         if ($(this).hasClass("in")) {
@@ -256,7 +279,8 @@ function initInherit() {
256 279
     });
257 280
 };
258 281
 
259  
-function filter(scrollToMember) {
  282
+/* filter used to take boolean scrollToMember */
  283
+function filter() {
260 284
     var query = $.trim($("#textfilter input").val()).toLowerCase();
261 285
     query = query.replace(/[-[\]{}()*+?.,\\^$|#]/g, "\\$&").replace(/\s+/g, "|");
262 286
     var queryRegExp = new RegExp(query, "i");
@@ -332,10 +356,6 @@ function filter(scrollToMember) {
332 356
         members.hide();
333 357
     };
334 358
 
335  
-    if (scrollToMember) {
336  
-      window.scrollTo(0, $("#mbrsel").offset().top);
337  
-    }
338  
-
339 359
     return false;
340 360
 };
341 361
 

0 notes on commit 6296e32

Please sign in to comment.
Something went wrong with that request. Please try again.