bavbavhaus.net/js/footnotes.js

14 lines
567 B
JavaScript

addEventListener("DOMContentLoaded", (event) => {
document.body.querySelectorAll("article.post").forEach((postEl, i) => {
postEl.querySelectorAll("a.footnote").forEach((fmEl, j) => {
const fnItemEl = document.querySelector(`div.footnotes>ol>li#${CSS.escape(fmEl.getAttribute("href").substring(1))}`);
const fnAnchorEl = fnItemEl.querySelector("a.reversefootnote");
fmEl.href = `${fmEl.href}:${i}`;
fmEl.id = `${fmEl.id}:${i}`;
fnItemEl.id = `${fnItemEl.id}:${i}`;
fnAnchorEl.href = `${fnAnchorEl.href}:${i}`;
})
})
})