From 7d794d1d7f510f53a33af3faa6cee5b70e78ab6a Mon Sep 17 00:00:00 2001 From: Deven Blake Date: Thu, 23 Sep 2021 22:08:30 -0400 Subject: [PATCH] cleaned --- homepage/js/sheets.js | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/homepage/js/sheets.js b/homepage/js/sheets.js index 845c615..e37c10b 100644 --- a/homepage/js/sheets.js +++ b/homepage/js/sheets.js @@ -1,25 +1,20 @@ -/* Depends on cookies.js (non-free) */ - -/* - SHEETS.JS - PUBLIC DOMAIN CODE BY DEVEN BLAKE - - setStyling(sheet) sets the stylesheet to the file at sheet. - e.g. setStyling("sheet.css") will change the stylesheet to "sheet.css" - initializesheets() just sets the sheet to the sheet in the cookie, if - the user saved their preferences. - Needs a somewhere on the - page in order to work. - - You can use setStyling("") to reset it. -*/ - -window.setStyling = function(sheet) { - document.getElementById('styling').setAttribute('href', sheet); - return sheet; -}; +/* Depends on cookies.js (NON-FREE) */ +/* sheets.js; Deven Blake 2021; Public Domain */ +/* sets the sheet to the sheet in the cookie, if the user saved their + * preferences */ window.initializesheets = function() { var sheet = window.getCookie('sheet'); if(sheet != '') window.setStyling(sheet); }; + +/* fetches the current styling value */ +window.getStyling = function(){ + return document.getElementById('styling').getAttribute('href'); +}; + +/* sets the stylesheet to the file at `sheet` */ +window.setStyling = function(sheet){ + document.getElementById('styling').setAttribute('href', sheet); + return sheet; +};