]> Cypherpunks repositories - gostls13.git/commitdiff
godoc: enable visibility of element linked from URL hash
authorKamil Kisiel <kamil@kamilkisiel.net>
Thu, 4 Apr 2013 21:04:02 +0000 (08:04 +1100)
committerAndrew Gerrand <adg@golang.org>
Thu, 4 Apr 2013 21:04:02 +0000 (08:04 +1100)
Expands the example when visiting a URL such as
http://golang.org/pkg/net/http/#example_Hijacker

Fixes #5212.

R=golang-dev, bradfitz, adg
CC=golang-dev
https://golang.org/cl/8378043

doc/godocs.js

index 5d12da131f8037938a244a7ef111b0d912ac27a0..6875f74d8ca52a532951b5f77e148f6ad7238654 100644 (file)
@@ -179,6 +179,13 @@ function fixFocus() {
   }).resize();
 }
 
+function toggleHash() {
+    var hash = $(window.location.hash);
+    if (hash.is('.toggle')) {
+      hash.addClass('toggleVisible').removeClass('toggle');
+    }
+}
+
 $(document).ready(function() {
   bindSearchEvents();
   generateTOC();
@@ -190,6 +197,7 @@ $(document).ready(function() {
   bindToggleLinks(".indexLink", "");
   setupDropdownPlayground();
   fixFocus();
+  toggleHash();
 });
 
 })();