From 81f9a4b5928b58450c756b83f74524fa3da105b0 Mon Sep 17 00:00:00 2001 From: limepotato Date: Sat, 24 Aug 2024 02:00:50 -0600 Subject: [PATCH] okay i got it fucks sake --- astro/public/scripts/sga.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/astro/public/scripts/sga.js b/astro/public/scripts/sga.js index 7a6604c..ccb326f 100644 --- a/astro/public/scripts/sga.js +++ b/astro/public/scripts/sga.js @@ -1,17 +1,22 @@ 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', true ); + localStorage.setItem( 'sgaEnabled', 1); console.debug(localStorage.getItem('sgaEnabled')) } function disableSGA() { - document.getElementById("body").style.fontFamily = " terminess-nf, system-ui"; - localStorage.setItem( 'sgaEnabled', false ); + document.getElementById("body").style.fontFamily = "terminess-nf, system-ui"; + localStorage.removeItem( 'sgaEnabled'); console.debug(localStorage.getItem('sgaEnabled')) } @@ -19,10 +24,10 @@ function toggleTheme() { // Obtains an array of all // elements. // Select your element using indexing. - if (document.getElementById("body").style.fontFamily !== "standardGalactic, system-ui") { + if (!localStorage.getItem('sgaEnabled')) { enableSGA() } - else { + else { disableSGA() } }