Index

joshstock.in / db8cde9

Source for serving and static templating/compiling of https://joshstock.in.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
15814 Jan 2023 23:375aaa26aWebsite rewriteJosh Stockin1180G

Blob @ joshstock.in / site / static / js / anchors.js

application/javascript720 bytesdownload raw
1function createAnchors() {
2 let headers = document.querySelectorAll("#links, #comments, .blog-content h1, .content-body h2, .content-body h3, .content-body h4, .content-body h5, .content-body h6");
3 for (header of headers) {
4 let id = header.id;
5 if (id == "") continue;
6 header.classList.add("header")
7 let anchor = document.createElement("a")
8 anchor.classList.value = "anchor"
9 anchor.href = "#" + id
10 let svg = document.createElement("img")
11 svg.src = "/static/svg/link.svg"
12 svg.classList.value = "svg icon"
13 anchor.appendChild(svg)
14 header.appendChild(anchor)
15 }
16}
17
18document.addEventListener('DOMContentLoaded', createAnchors);
19