From ddaf8c3bd1a1e3fe8f37a4e5d2355225f879edfa Mon Sep 17 00:00:00 2001 From: Juicysteak117 <20595808+Juicysteak117@users.noreply.github.com> Date: Wed, 15 Oct 2025 22:51:14 -0700 Subject: [PATCH] init func --- export/pghrtjs.js | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/export/pghrtjs.js b/export/pghrtjs.js index 8d42106..73bd730 100644 --- a/export/pghrtjs.js +++ b/export/pghrtjs.js @@ -1,6 +1,6 @@ // this function adds the + and functionality to the toc so that it is less scary // it's still pretty scary ngl it's a giant toc but at least it starts hidden -function tocOnClick() { +function initTocOnClick() { var coll = document.querySelectorAll(".ltx_tocentry.ltx_tocentry_section > .ltx_ref"); var i; @@ -68,7 +68,7 @@ function detectColorScheme(){ // source: https://www.accessibilityfirst.at/posts/dark-and-light-mode-a-simple-guide-for-web-design-and-development // add onClick to toggle theme between light and dark -function themeToggle() { +function initThemeToggle() { document.getElementById('theme-toggle').addEventListener('click', () => { document.documentElement.setAttribute( 'data-theme', @@ -83,8 +83,24 @@ function themeToggle() { }); } - +// the same function except it's for font toggle +function initFontToggle() { + document.getElementById('font-toggle').addEventListener('click', () => { + document.documentElement.setAttribute( + 'data-font', + document.documentElement.getAttribute('data-font') === 'avec' + ? 'sans' + : 'avec' + ); + localStorage.setItem( + 'font', + document.documentElement.getAttribute('data-font') + ); + }); +} // run da functions -tocOnClick(); -detectColorScheme(); \ No newline at end of file +initTocOnClick(); +detectColorScheme(); +initThemeToggle(); +initFontToggle(); \ No newline at end of file