summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeather Miller <heather.miller@epfl.ch>2012-08-24 18:00:20 +0200
committerHeather Miller <heather.miller@epfl.ch>2012-08-24 18:00:20 +0200
commitfd55ee9cb9eac806e0eb2e02c4887e29a321ab3c (patch)
tree488f8fc680db7973ac7ab889dac31311de5401aa /src
parent2b4ae0e22d32136415cf09df640c47d2861fac08 (diff)
downloadscala-fd55ee9cb9eac806e0eb2e02c4887e29a321ab3c.tar.gz
scala-fd55ee9cb9eac806e0eb2e02c4887e29a321ab3c.tar.bz2
scala-fd55ee9cb9eac806e0eb2e02c4887e29a321ab3c.zip
Automatically highlight and scroll to linked-to members
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/doc/html/resource/lib/template.js16
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';