diff options
author | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2010-02-12 18:43:49 +0000 |
---|---|---|
committer | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2010-02-12 18:43:49 +0000 |
commit | 30e65502ffa0463c79588f6a555346da4eb47423 (patch) | |
tree | 153bb41b4eb307fcf196e757238b0f44bd80c11c /src/compiler | |
parent | 2040ada34b3791a7da906a594d2641ac1e179c33 (diff) | |
download | scala-30e65502ffa0463c79588f6a555346da4eb47423.tar.gz scala-30e65502ffa0463c79588f6a555346da4eb47423.tar.bz2 scala-30e65502ffa0463c79588f6a555346da4eb47423.zip |
[scaladoc] Added "display packages only" filter...
[scaladoc] Added "display packages only" filter to entity index. No
review.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/doc/html/resource/lib/index.css | 7 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/doc/html/resource/lib/index.js | 57 |
2 files changed, 61 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/html/resource/lib/index.css b/src/compiler/scala/tools/nsc/doc/html/resource/lib/index.css index fc759867a4..63a2ffaa71 100644 --- a/src/compiler/scala/tools/nsc/doc/html/resource/lib/index.css +++ b/src/compiler/scala/tools/nsc/doc/html/resource/lib/index.css @@ -92,6 +92,13 @@ h1 { position: relative; } +#kindfilter { + position: relative; + display: block; + padding: 5px; + background-color: #F0F8FF; +} + #tpl { display: block; position: fixed; 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 1ae4a7d708..815a176390 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 @@ -7,6 +7,9 @@ var topLevelPackages = undefined; var scheduler = undefined; var domCache = undefined; +var kindFilterState = undefined; +var focusFilterState = undefined; + $(document).ready(function() { // workaround for IE's iframe sizing lack of smartness @@ -19,9 +22,10 @@ $(document).ready(function() { } scheduler = new Scheduler(); - scheduler.addLabel("init", 5); - scheduler.addLabel("focus", 7); - scheduler.addLabel("filter", 10); + scheduler.addLabel("init", 1); + scheduler.addLabel("focus", 2); + scheduler.addLabel("kind", 3); + scheduler.addLabel("filter", 4); scheduler.addForAll = function(labelName, elems, fn) { var idx = 0; @@ -39,11 +43,13 @@ $(document).ready(function() { prepareEntityList(); configureTextFilter(); + configureKindFilter(); configureEntityList(); }); function configureEntityList() { + kindFilterSync(); configureHideFilter(); configureFocusFilter(); textFilter(); @@ -176,6 +182,7 @@ function configureHideFilter() { link to all packages. */ function configureFocusFilter() { scheduler.add("init", function() { + focusFilterState = null; if ($("#focusfilter").length == 0) { $("#filter").append("<div id='focusfilter'>focused on <span class='focuscoll'></span> <a class='focusremove'><img class='icon' src='lib/remove.png'/></a></div>"); $("#focusfilter > .focusremove").click(function(event) { @@ -185,7 +192,9 @@ function configureFocusFilter() { $("#tpl > ol.packages").replaceWith(topLevelPackages.clone()); domCache.update(); $("#focusfilter").hide(); + $("#kindfilter").show(); resizeFilterBlock(); + focusFilterState = null; configureEntityList(); }); }); @@ -217,7 +226,49 @@ function focusFilter(package) { $("#tpl > ol.packages").replaceWith(packPackages); domCache.update(); $("#focusfilter").show(); + $("#kindfilter").hide(); resizeFilterBlock(); + focusFilterState = package; + kindFilterSync(); + }); +} + +function configureKindFilter() { + scheduler.add("init", function() { + kindFilterState = "all"; + $("#filter").append("<div id='kindfilter'><a>display packages only</a></div>"); + $("#kindfilter > a").click(function(event) { kindFilter("packs"); }); + resizeFilterBlock(); + }); +} + +function kindFilter(kind) { + if (kind == "packs") { + kindFilterState = "packs"; + kindFilterSync(); + $("#kindfilter > a").replaceWith("<a>display all entities</a>"); + $("#kindfilter > a").click(function(event) { kindFilter("all"); }); + } + else { + kindFilterState = "all"; + kindFilterSync(); + $("#kindfilter > a").replaceWith("<a>display packages only</a>"); + $("#kindfilter > a").click(function(event) { kindFilter("packs"); }); + } +} + +/* Applies the kind filter. */ +function kindFilterSync() { + scheduler.add("kind", function () { + if (kindFilterState == "all" || focusFilterState != null) + scheduler.addForAll("kind", domCache.packs, function(pack0) { + $("> ol.templates", pack0).show(); + }); + else + scheduler.addForAll("kind", domCache.packs, function(pack0) { + $("> ol.templates", pack0).hide(); + }); + textFilter(); }); } |