From f797bb14f7413df2abac6326c6df769004e50aa1 Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado Date: Mon, 1 May 2023 09:35:25 -0600 Subject: small bugfix, add toc settings, update example site and delete unnecessary static assets --- pyssg.xyz/live/static/scripts/theme.js | 35 ---------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 pyssg.xyz/live/static/scripts/theme.js (limited to 'pyssg.xyz/live/static/scripts') diff --git a/pyssg.xyz/live/static/scripts/theme.js b/pyssg.xyz/live/static/scripts/theme.js deleted file mode 100644 index a107101..0000000 --- a/pyssg.xyz/live/static/scripts/theme.js +++ /dev/null @@ -1,35 +0,0 @@ -// refactored code for a better solution found in: -// https://medium.com/@haxzie/dark-and-light-theme-switcher-using-css-variables-and-pure-javascript-zocada-dd0059d72fa2 -var local_storage = window.localStorage; - -// changed window.onload to document.addEventListener, as suggested here: -// https://stackoverflow.com/a/800010 -document.addEventListener("DOMContentLoaded", function(event) { - let theme = local_storage.getItem('theme'); - - if(theme == null){ - local_storage.setItem('theme', 'theme-dark'); - } - else{ - if(theme == 'theme-dark'){ - setTheme('theme-dark'); - } - else{ - setTheme('theme-light'); - } - } -}) - -function setTheme(themeName){ - local_storage.setItem('theme', themeName) - document.documentElement.className = themeName; -} - -function toggleTheme(){ - if (local_storage.getItem('theme') == 'theme-dark') { - setTheme('theme-light'); - } - else{ - setTheme('theme-dark'); - } -} -- cgit v1.2.3-70-g09d2