nelle-observer/astro/public/scripts/sga.js

33 lines
800 B
JavaScript

function onload() {
if (localStorage.getItem('sgaEnabled')) {
enableSGA()
}
else {
disableSGA()
}
}
function enableSGA() {
document.getElementById("body").style.fontFamily = "standardGalactic, system-ui";
document.getElementById("body").style.fontWeight = "lighter";
localStorage.setItem( 'sgaEnabled', 1);
console.debug(localStorage.getItem('sgaEnabled'))
}
function disableSGA() {
document.getElementById("body").style.fontFamily = "terminess-nf, system-ui";
localStorage.removeItem( 'sgaEnabled');
console.debug(localStorage.getItem('sgaEnabled'))
}
function toggleTheme() {
// Obtains an array of all <link>
// elements.
// Select your element using indexing.
if (!localStorage.getItem('sgaEnabled')) {
enableSGA()
}
else {
disableSGA()
}
}