diff --git a/index.php b/index.html similarity index 76% rename from index.php rename to index.html index 2c8615f..96329a1 100644 --- a/index.php +++ b/index.html @@ -1,10 +1,3 @@ -format('Y'); -$startDate = new DateTime("$currentYear-11-10"); -$endDate = new DateTime(($currentYear + 1) . '-03-01'); -$christmas = ($currentDate > $startDate && $currentDate < $endDate); -?> @@ -13,9 +6,6 @@ $christmas = ($currentDate > $startDate && $currentDate < $endDate); ~floppy - - - @@ -30,11 +20,7 @@ $christmas = ($currentDate > $startDate && $currentDate < $endDate); "My life is a living nightmare!"

- -
-
-
+ diff --git a/res/js/dynamic-content.js b/res/js/dynamic-content.js new file mode 100644 index 0000000..a6b12ca --- /dev/null +++ b/res/js/dynamic-content.js @@ -0,0 +1,20 @@ +const christmas = isItChristmas(); + +if (christmas) { + var head = document.getElementsByTagName('head')[0]; + var snowJS = document.createElement("script"); + snowJS.type = "text/javascript"; + snowJS.src = "/res/js/snowstorm.js"; + head.appendChild(snowJS); + + const profileImage = document.querySelector("img.profile-image"); + profileImage.src = "/res/images/profile-christmas.jpg"; +} + +function isItChristmas() { + const currentDate = new Date(); + const currentYear = currentDate.getFullYear(); + const startDate = new Date(`${currentYear}-11-10`); + const endDate = new Date(`${currentYear + 1}-03-01`); + return currentDate > startDate && currentDate < endDate; +}