let headerText, mainText;
let fancyFonts = true;
const toggleFancyFonts = () => {
if (fancyFonts) {
$("header").innerHTML = headerText
.replace(/ſ/g, "s")
.replace(/[ÞÐ]/g, "Th")
.replace(/[þð]/g, "th")
.replace(/ꝛ/g, "r");
$("div#main").innerHTML = mainText
.replace(/ſ/g, "s")
.replace(/[ÞÐ]/g, "Th")
.replace(/[þð]/g, "th")
.replace(/ꝛ/g, "r");
$("html").style.setProperty("--fraktur", "var(--serif)");
fancyFonts = false;
} else {
$("header").innerHTML = headerText;
$("div#main").innerHTML = mainText;
$("html").style.setProperty(
"--fraktur",
"UnifrakturMaguntia, UnifrakturCook, var(--serif)"
);
fancyFonts = true;
}
};
document.on("DOMContentLoaded", () => {
headerText = $("header").innerHTML;
mainText = $("div#main").innerHTML;
});