This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function observeMutation( | |
target: Element, | |
callback: (muts: MutationRecord[]) => void, | |
options?: MutationObserverInit | |
) { | |
const obs = new window.MutationObserver(callback); | |
obs.observe(target, options); | |
return () => obs.disconnect(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addTooltip(noteref) { | |
const note = document.querySelector(noteref.getAttribute("href")); | |
const noteText = note.firstElementChild.innerText.slice(0, -3); | |
noteref.setAttribute("title", noteText); | |
} | |
const noterefs = [...document.querySelectorAll(".footnote-ref > a")]; | |
noterefs.map((ref) => addTooltip(ref)); |