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; +};