diff options
Diffstat (limited to 'html/template.html')
| -rw-r--r-- | html/template.html | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/html/template.html b/html/template.html index bae64042..6d58af7d 100644 --- a/html/template.html +++ b/html/template.html @@ -250,6 +250,11 @@ $if(toc)$ padding-left: 10px; } $endif$ + +li.linkable-rule:active, li.linkable-rule:hover { + background-color: #d79921; + list-style-image: url(link.svg); +} </style> $for(css)$ @@ -265,6 +270,26 @@ $endif$ $for(header-includes)$ $header-includes$ $endfor$ +<script> +window.onload = function() { + for (let e of document.querySelectorAll(".rule")) { + // Add class via js to ensure there is no wrong + // sense of functionality in browsers without js + e.classList.add("linkable-rule"); + // TODO: support nested lists + e.onclick = function() { + if (e.matches(':hover') || e.matches(':active')) { + const origin = window.location.origin; + const path = window.location.pathname; + const anchor = e.id; + let url = origin + '/' + path + '#' + anchor; + navigator.clipboard.writeText(url); + // document.getElementsByTagName("body")[0].focus(); + } + } + } +} +</script> </head> <body> $for(include-before)$ |
