1
0

move js from homepage to homepage-css

This commit is contained in:
dtb 2023-10-31 17:15:38 -06:00
parent 0d33afb7cf
commit 1c1ddfbc36
3 changed files with 65 additions and 73 deletions

41
homepage-css/cookies.js Executable file
View File

@ -0,0 +1,41 @@
/* cookies.js; Deven Blake 2021 */
/* @license magnet:?xt=urn:btih:5ac446d35272cc2e4e85e4325b146d0b7ca8f50c&dn=unlicense.txt Unlicense */
window.setCookie = function(name, value){
var d;
d = new Date();
/* seconds, minutes, hours, days, years */
d.setTime(d.getTime() + 1000 * 60 * 60 * 24 * 365);
/* ( == one year in milliseconds) */
document.cookie = name + "=" + value + ";" + d.toUTCString() + ";path=/"
}
window.getCookie = function(name){
var c;
var i;
try{
c = decodeURIComponent(document.cookie);
}catch(URIError){
console.log("Could not decode cookie URIComponent (cookies.js: getCookie: URIError)");
return '';
}
c = c.split(';');
for(i = 0; i < c.length; ++i){
while(c[i].charAt(0) == ' ')
c[i] = c[i].slice(1);
/* check if the first bit + '=' matches name + '=' */
/* the added '=' is so 'a' doesn't match 'ab=' */
if(c[i].slice(0, name.length + 1) == name + '=')
/* return the associated value */
return c[i].slice(name.length + 1, c[i].length);
}
return '';
}
/* @license-end */

24
homepage-css/sheets.js Executable file
View File

@ -0,0 +1,24 @@
/* Depends on cookies.js */
/* sheets.js; Deven Blake 2021 */
/* @license magnet:?xt=urn:btih:5ac446d35272cc2e4e85e4325b146d0b7ca8f50c&dn=unlicense.txt Unlicense */
/* sets the sheet to the sheet in the cookie, if the user saved their
* preferences */
window.initializesheets = function() {
var sheet;
if((sheet = window.getCookie('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;
};
/* @license-end */

View File

@ -4798,79 +4798,6 @@ buddy dear I love you and I'm hopelessly now due
for my seven years of bad luck month of hell condemned volume for my seven years of bad luck month of hell condemned volume
/js/sheets.js verbatim
/* Depends on cookies.js */
/* sheets.js; Deven Blake 2021 */
/* @license magnet:?xt=urn:btih:5ac446d35272cc2e4e85e4325b146d0b7ca8f50c&dn=unlicense.txt Unlicense */
/* sets the sheet to the sheet in the cookie, if the user saved their
* preferences */
window.initializesheets = function() {
var sheet;
if((sheet = window.getCookie('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;
};
/* @license-end */
/js/cookies.js verbatim
/* cookies.js; Deven Blake 2021 */
/* @license magnet:?xt=urn:btih:5ac446d35272cc2e4e85e4325b146d0b7ca8f50c&dn=unlicense.txt Unlicense */
window.setCookie = function(name, value){
var d;
d = new Date();
/* seconds, minutes, hours, days, years */
d.setTime(d.getTime() + 1000 * 60 * 60 * 24 * 365);
/* ( == one year in milliseconds) */
document.cookie = name + "=" + value + ";" + d.toUTCString() + ";path=/"
}
window.getCookie = function(name){
var c;
var i;
try{
c = decodeURIComponent(document.cookie);
}catch(URIError){
console.log("Could not decode cookie URIComponent (cookies.js: getCookie: URIError)");
return '';
}
c = c.split(';');
for(i = 0; i < c.length; ++i){
while(c[i].charAt(0) == ' ')
c[i] = c[i].slice(1);
/* check if the first bit + '=' matches name + '=' */
/* the added '=' is so 'a' doesn't match 'ab=' */
if(c[i].slice(0, name.length + 1) == name + '=')
/* return the associated value */
return c[i].slice(name.length + 1, c[i].length);
}
return '';
}
/* @license-end */
/blah/2023-08-03.html /blah/2023-08-03.html
The Ballad of Sean and Josh The Ballad of Sean and Josh