Automate the background

This commit is contained in:
swagg boi 2024-06-25 17:23:54 -04:00
parent b9769de240
commit 8c4d2dfb03
4 changed files with 27 additions and 15 deletions

View file

@ -60,13 +60,9 @@ tests locally:
## TODOs ## TODOs
1. Re-visit this TODO list because it doesn't seem like I'm gunna
bother with all new posts flagged mode lmao. There's a CAPTCHA now
so it's not as painfully open...
1. Automate the holiday backgrounds with JS 1. Automate the holiday backgrounds with JS
1. Test JS with LibreJS or something like that (I don't like RMS I 1. Test JS with LibreJS or something like that (I don't like RMS I
just want free JS!!) just want free JS!!)
1. "All new posts flagged" mode (require approval for new posts)
1. Tests for mod-only user? 1. Tests for mod-only user?
## Crazy future ideas ## Crazy future ideas

View file

@ -28,14 +28,6 @@
body { body {
background-image: url('/images/background_stars_anm.gif'); background-image: url('/images/background_stars_anm.gif');
/* Was feelin this for September idk */
/* background-image: url('/images/topwwbackground.gif'); */
/* Spooky time! */
/* background-image: url('/images/halloween_background_1.gif'); */
/* Winter/snow */
/* background-image: url('/images/jwsfp1.gif'); */
/* Christmas */
/* background-image: url('/images/christmas.gif'); */
width: 95vmin; width: 95vmin;
margin: 0 auto; margin: 0 auto;
font-family: 'w95fa', sans-serif; font-family: 'w95fa', sans-serif;

23
public/js/background.js Normal file
View file

@ -0,0 +1,23 @@
const bodyStyle = document.body.style;
function setImage(url) {
bodyStyle.backgroundImage = "url('" + url + "')";
}
switch (new Date().getMonth()) {
case 0:
setImage('/images/jwsfp1.gif');
break;
case 3:
setImage('/images/background2.gif');
break;
case 9:
setImage('/images/halloween_background_1.gif');
break;
case 10:
setImage('/images/topwwbackground.gif');
break;
case 11:
setImage('/images/christmas.gif');
break;
}

View file

@ -32,6 +32,7 @@
<%= stylesheet '/css/elements.css' %> <%= stylesheet '/css/elements.css' %>
<%= stylesheet '/css/simple.css' %> <%= stylesheet '/css/simple.css' %>
<%= stylesheet '/css/nested.css' %> <%= stylesheet '/css/nested.css' %>
<%= javascript '/js/background.js', defer => undef %>
</head> </head>
<body> <body>
<header class="header"> <header class="header">