1
0
This commit is contained in:
dtb 2021-09-23 22:08:30 -04:00
parent b25804d8a7
commit 7d794d1d7f

View File

@ -1,25 +1,20 @@
/* Depends on cookies.js (non-free) */ /* Depends on cookies.js (NON-FREE) */
/* sheets.js; Deven Blake 2021; Public Domain */
/*
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 <LINK HREF="" ID="styling" REL="stylesheet" /> 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;
};
/* sets the sheet to the sheet in the cookie, if the user saved their
* preferences */
window.initializesheets = function() { window.initializesheets = function() {
var sheet = window.getCookie('sheet'); var sheet = window.getCookie('sheet');
if(sheet != '') window.setStyling(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;
};