From 04ff49c932fbc46b82cd1553ae6c3ab29ee5cbb5 Mon Sep 17 00:00:00 2001 From: swaggboi Date: Tue, 25 Jun 2024 17:37:57 -0400 Subject: [PATCH] Narrow the scoping, so to speak (??) --- public/js/background.js | 44 +++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/public/js/background.js b/public/js/background.js index 1ae8ca2..62db6d3 100644 --- a/public/js/background.js +++ b/public/js/background.js @@ -1,23 +1,25 @@ -const bodyStyle = document.body.style; +(function () { + const bodyStyle = document.body.style; -function setImage(url) { - bodyStyle.backgroundImage = "url('" + url + "')"; -} + 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; -} + 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; + } +})();