diff options
author | Heather Miller <heather.miller@epfl.ch> | 2012-08-24 18:00:20 +0200 |
---|---|---|
committer | Heather Miller <heather.miller@epfl.ch> | 2012-08-24 18:00:20 +0200 |
commit | fd55ee9cb9eac806e0eb2e02c4887e29a321ab3c (patch) | |
tree | 488f8fc680db7973ac7ab889dac31311de5401aa | |
parent | 2b4ae0e22d32136415cf09df640c47d2861fac08 (diff) | |
download | scala-fd55ee9cb9eac806e0eb2e02c4887e29a321ab3c.tar.gz scala-fd55ee9cb9eac806e0eb2e02c4887e29a321ab3c.tar.bz2 scala-fd55ee9cb9eac806e0eb2e02c4887e29a321ab3c.zip |
Automatically highlight and scroll to linked-to members
-rw-r--r-- | src/compiler/scala/tools/nsc/doc/html/resource/lib/template.js | 16 |
1 files changed, 16 insertions, 0 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 c81a8672d3..6d1caf6d50 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 @@ -2,6 +2,22 @@ // code by Gilles Dubochet with contributions by Pedro Furlanetto $(document).ready(function(){ + + // Escapes special characters and returns a valid jQuery selector + function escapeJquery(str){ + return str.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1'); + } + + // highlight and jump to selected member + if (window.location.hash) { + var temp = window.location.hash.replace('#', ''); + var elem = '#'+escapeJquery(temp); + + window.scrollTo(0, 0); + $(elem).parent().effect("highlight", {color: "#FFCC85"}, 3000); + $('html,body').animate({scrollTop:$(elem).parent().offset().top}, 1000); + } + var isHiddenClass = function (name) { return name == 'scala.Any' || name == 'scala.AnyRef'; |