Re-enable "anchorlink" script

This allows for easier sharing of links to specific sections
on a page.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2020-02-13 12:48:12 +01:00
parent b633d3c21c
commit 5276ea1d9f
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
3 changed files with 11 additions and 3 deletions

View File

@ -295,7 +295,7 @@
hljs.initHighlightingOnLoad(); hljs.initHighlightingOnLoad();
</script> </script>
{% endif %} {% endif %}
<!-- <script src="/js/anchorlinks.js"></script> --> <script defer src="/js/anchorlinks.js"></script>
<script defer src="/js/menu.js"></script> <script defer src="/js/menu.js"></script>
<script src="/js/jquery.js"></script> <script src="/js/jquery.js"></script>
<script src="/js/bootstrap.min.js"></script> <script src="/js/bootstrap.min.js"></script>

View File

@ -116,10 +116,18 @@ pre code {
} }
a.anchorLink { a.anchorLink {
font-size: 0.5em;
margin-left: 5px; margin-left: 5px;
visibility: hidden; visibility: hidden;
} }
h1:hover > a.anchorLink,
h2:hover > a.anchorLink,
h3:hover > a.anchorLink
{
visibility: visible;
}
a.glossary { a.glossary {
color: $body-text-color; color: $body-text-color;
text-decoration: none; text-decoration: none;

View File

@ -1,11 +1,11 @@
(function(d) { (function(d) {
"use strict"; "use strict";
var hs = d.getElementById("DocumentationText").querySelectorAll("H1, H2, H3"), h; var hs = d.querySelectorAll("H1, H2, H3"), h;
for (var i = 0; i < hs.length; i++) { for (var i = 0; i < hs.length; i++) {
h = hs[i]; h = hs[i];
if (h.id != null && h.id.length > 0) { if (h.id != null && h.id.length > 0) {
h.insertAdjacentHTML('beforeend', '<a href="' + window.location.href + '#' + h.id + '" class="anchorLink"></a>') h.insertAdjacentHTML('beforeend', '<a href="' + window.location.href + '#' + h.id + '" class="anchorLink">🔗</a>')
} }
} }