Automate the background

This commit is contained in:
swaggboi 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

@ -29,9 +29,10 @@
content="<%= url_for('/images/logo.png')->to_abs %>"> content="<%= url_for('/images/logo.png')->to_abs %>">
<meta name="twitter:image:alt" <meta name="twitter:image:alt"
content="Post::Text logo; a small nerdy anime girl giving a V sign"> content="Post::Text logo; a small nerdy anime girl giving a V sign">
<%= 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">