diff --git a/_layouts/default.html b/_layouts/default.html index f1fc5cbd..1f28492d 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -167,6 +167,18 @@ } })(); + (function () { + var headers = document.getElementsByTagName('h2'); + + for (var i = 0, len = headers.length; i < len; i++) { + if (headers[i].id) { + headers[i].onclick = function() { + window.location.hash = '#' + this.id; + }; + } + } + })(); + hljs.initHighlighting(); diff --git a/docs/css/screen.css b/docs/css/screen.css index 50b6f280..4dc277ae 100644 --- a/docs/css/screen.css +++ b/docs/css/screen.css @@ -76,7 +76,28 @@ h2 { -webkit-border-radius: 5px; text-shadow: 0 -1px 1px rgba(0,0,0,0.35); + + cursor: pointer; } + +h2[id]:before { + content:'Permalink'; + display:inline-block; + margin:0px 5px 0px -35px; + width:30px; + height:20px; + line-height:20px; + vertical-align:baseline; + background:url(../images/sprite.png) -0px -0px no-repeat; + opacity:0.2; + border-radius:50%; + text-indent:-9999px; + border-radius:50%; + overflow:hidden; + } + +h2[id]:hover:before { opacity:1; } + .api-page h2 { margin-top: 2.5em; } diff --git a/docs/images/sprite.png b/docs/images/sprite.png new file mode 100644 index 00000000..bcbb751a Binary files /dev/null and b/docs/images/sprite.png differ diff --git a/docs/images/sprite.svg b/docs/images/sprite.svg new file mode 100644 index 00000000..847976e6 --- /dev/null +++ b/docs/images/sprite.svg @@ -0,0 +1,75 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + +