From 6c4d658f766a61c66e360e32689e4ab7e550ae6e Mon Sep 17 00:00:00 2001 From: Helen Chong <119173961+helenclx@users.noreply.github.com> Date: Mon, 29 Apr 2024 11:36:34 +0800 Subject: [PATCH] Refactor Cassette Beasts shrine hero events --- _site/feed.xml | 2 +- .../index.html | 37 ++++++------------- .../cassettebeasts/articles/index.html | 37 ++++++------------- .../cassettebeasts/featured/index.html | 37 ++++++------------- .../shrines/cassettebeasts/gamelog/index.html | 37 ++++++------------- _site/shrines/cassettebeasts/index.html | 37 ++++++------------- .../cassettebeasts/resources/index.html | 37 ++++++------------- .../shrines/cassettebeasts/trivia/index.html | 37 ++++++------------- src/_includes/cassettebeasts/hero.njk | 37 ++++++------------- 9 files changed, 97 insertions(+), 201 deletions(-) diff --git a/_site/feed.xml b/_site/feed.xml index 58ef904e..e0e71009 100644 --- a/_site/feed.xml +++ b/_site/feed.xml @@ -4,7 +4,7 @@ Leilukin's personal website. - 2024-04-29T03:15:37Z + 2024-04-29T03:36:24Z https://leilukin.neocities.org Leilukin diff --git a/_site/shrines/cassettebeasts/articles/cassette-beasts-more-than-a-pokemon-clone/index.html b/_site/shrines/cassettebeasts/articles/cassette-beasts-more-than-a-pokemon-clone/index.html index a6f7e560..1c2061e5 100644 --- a/_site/shrines/cassettebeasts/articles/cassette-beasts-more-than-a-pokemon-clone/index.html +++ b/_site/shrines/cassettebeasts/articles/cassette-beasts-more-than-a-pokemon-clone/index.html @@ -103,9 +103,9 @@ const todayEvent = getTodayEvent(); - if (todayEvent != "No event") { + if (todayEvent) { heroTopBarEl.classList.remove('hidden'); - heroTopBarEl.innerHTML = getBlurbHtml(todayEvent); + heroTopBarEl.innerHTML = todayEvent; } function getTodayEvent() { @@ -113,35 +113,22 @@ const month = date.getMonth() + 1; const day = date.getDate(); - if (month == 4 && day == 26) - return "CB Anniversary"; - else if (month == 10 && day == 4) - return "Pier Anniversary"; - else - return "No event"; - } - - function getBlurbHtml(day) { const currentYear = new Date().getFullYear(); const cbReleaseDate = new Date("2023-04-26").getFullYear(); const pierReleaseDate = new Date("2023-10-04").getFullYear(); const cbAnniversary = currentYear - cbReleaseDate; const pierAnniversary = currentYear - pierReleaseDate; - switch (day) { - case "CB Anniversary": - return ` - Today is the ${cbAnniversary}-year anniversary of the release of Cassette Beasts! - `; - break; - case "Pier Anniversary": - return ` - Today is the ${pierAnniversary}-year anniversary of the release of Pier of the Unknown, the first DLC expansion of Cassette Beasts! - `; - break; - default: - return ``; - } + if (month === 4 && day === 26) + return ` + Today is the ${cbAnniversary}-year anniversary of the release of Cassette Beasts! + `; + else if (month === 10 && day === 4) + return ` + Today is the ${pierAnniversary}-year anniversary of the release of Pier of the Unknown, the first DLC expansion of Cassette Beasts! + `; + else + return null; } diff --git a/_site/shrines/cassettebeasts/articles/index.html b/_site/shrines/cassettebeasts/articles/index.html index f8dff441..68da255e 100644 --- a/_site/shrines/cassettebeasts/articles/index.html +++ b/_site/shrines/cassettebeasts/articles/index.html @@ -103,9 +103,9 @@ const todayEvent = getTodayEvent(); - if (todayEvent != "No event") { + if (todayEvent) { heroTopBarEl.classList.remove('hidden'); - heroTopBarEl.innerHTML = getBlurbHtml(todayEvent); + heroTopBarEl.innerHTML = todayEvent; } function getTodayEvent() { @@ -113,35 +113,22 @@ const month = date.getMonth() + 1; const day = date.getDate(); - if (month == 4 && day == 26) - return "CB Anniversary"; - else if (month == 10 && day == 4) - return "Pier Anniversary"; - else - return "No event"; - } - - function getBlurbHtml(day) { const currentYear = new Date().getFullYear(); const cbReleaseDate = new Date("2023-04-26").getFullYear(); const pierReleaseDate = new Date("2023-10-04").getFullYear(); const cbAnniversary = currentYear - cbReleaseDate; const pierAnniversary = currentYear - pierReleaseDate; - switch (day) { - case "CB Anniversary": - return ` - Today is the ${cbAnniversary}-year anniversary of the release of Cassette Beasts! - `; - break; - case "Pier Anniversary": - return ` - Today is the ${pierAnniversary}-year anniversary of the release of Pier of the Unknown, the first DLC expansion of Cassette Beasts! - `; - break; - default: - return ``; - } + if (month === 4 && day === 26) + return ` + Today is the ${cbAnniversary}-year anniversary of the release of Cassette Beasts! + `; + else if (month === 10 && day === 4) + return ` + Today is the ${pierAnniversary}-year anniversary of the release of Pier of the Unknown, the first DLC expansion of Cassette Beasts! + `; + else + return null; } diff --git a/_site/shrines/cassettebeasts/featured/index.html b/_site/shrines/cassettebeasts/featured/index.html index ce48d9d3..87c8d290 100644 --- a/_site/shrines/cassettebeasts/featured/index.html +++ b/_site/shrines/cassettebeasts/featured/index.html @@ -103,9 +103,9 @@ const todayEvent = getTodayEvent(); - if (todayEvent != "No event") { + if (todayEvent) { heroTopBarEl.classList.remove('hidden'); - heroTopBarEl.innerHTML = getBlurbHtml(todayEvent); + heroTopBarEl.innerHTML = todayEvent; } function getTodayEvent() { @@ -113,35 +113,22 @@ const month = date.getMonth() + 1; const day = date.getDate(); - if (month == 4 && day == 26) - return "CB Anniversary"; - else if (month == 10 && day == 4) - return "Pier Anniversary"; - else - return "No event"; - } - - function getBlurbHtml(day) { const currentYear = new Date().getFullYear(); const cbReleaseDate = new Date("2023-04-26").getFullYear(); const pierReleaseDate = new Date("2023-10-04").getFullYear(); const cbAnniversary = currentYear - cbReleaseDate; const pierAnniversary = currentYear - pierReleaseDate; - switch (day) { - case "CB Anniversary": - return ` - Today is the ${cbAnniversary}-year anniversary of the release of Cassette Beasts! - `; - break; - case "Pier Anniversary": - return ` - Today is the ${pierAnniversary}-year anniversary of the release of Pier of the Unknown, the first DLC expansion of Cassette Beasts! - `; - break; - default: - return ``; - } + if (month === 4 && day === 26) + return ` + Today is the ${cbAnniversary}-year anniversary of the release of Cassette Beasts! + `; + else if (month === 10 && day === 4) + return ` + Today is the ${pierAnniversary}-year anniversary of the release of Pier of the Unknown, the first DLC expansion of Cassette Beasts! + `; + else + return null; } diff --git a/_site/shrines/cassettebeasts/gamelog/index.html b/_site/shrines/cassettebeasts/gamelog/index.html index 2622a289..c4043161 100644 --- a/_site/shrines/cassettebeasts/gamelog/index.html +++ b/_site/shrines/cassettebeasts/gamelog/index.html @@ -103,9 +103,9 @@ const todayEvent = getTodayEvent(); - if (todayEvent != "No event") { + if (todayEvent) { heroTopBarEl.classList.remove('hidden'); - heroTopBarEl.innerHTML = getBlurbHtml(todayEvent); + heroTopBarEl.innerHTML = todayEvent; } function getTodayEvent() { @@ -113,35 +113,22 @@ const month = date.getMonth() + 1; const day = date.getDate(); - if (month == 4 && day == 26) - return "CB Anniversary"; - else if (month == 10 && day == 4) - return "Pier Anniversary"; - else - return "No event"; - } - - function getBlurbHtml(day) { const currentYear = new Date().getFullYear(); const cbReleaseDate = new Date("2023-04-26").getFullYear(); const pierReleaseDate = new Date("2023-10-04").getFullYear(); const cbAnniversary = currentYear - cbReleaseDate; const pierAnniversary = currentYear - pierReleaseDate; - switch (day) { - case "CB Anniversary": - return ` - Today is the ${cbAnniversary}-year anniversary of the release of Cassette Beasts! - `; - break; - case "Pier Anniversary": - return ` - Today is the ${pierAnniversary}-year anniversary of the release of Pier of the Unknown, the first DLC expansion of Cassette Beasts! - `; - break; - default: - return ``; - } + if (month === 4 && day === 26) + return ` + Today is the ${cbAnniversary}-year anniversary of the release of Cassette Beasts! + `; + else if (month === 10 && day === 4) + return ` + Today is the ${pierAnniversary}-year anniversary of the release of Pier of the Unknown, the first DLC expansion of Cassette Beasts! + `; + else + return null; } diff --git a/_site/shrines/cassettebeasts/index.html b/_site/shrines/cassettebeasts/index.html index 00d4a2e5..cd0bf7dc 100644 --- a/_site/shrines/cassettebeasts/index.html +++ b/_site/shrines/cassettebeasts/index.html @@ -103,9 +103,9 @@ const todayEvent = getTodayEvent(); - if (todayEvent != "No event") { + if (todayEvent) { heroTopBarEl.classList.remove('hidden'); - heroTopBarEl.innerHTML = getBlurbHtml(todayEvent); + heroTopBarEl.innerHTML = todayEvent; } function getTodayEvent() { @@ -113,35 +113,22 @@ const month = date.getMonth() + 1; const day = date.getDate(); - if (month == 4 && day == 26) - return "CB Anniversary"; - else if (month == 10 && day == 4) - return "Pier Anniversary"; - else - return "No event"; - } - - function getBlurbHtml(day) { const currentYear = new Date().getFullYear(); const cbReleaseDate = new Date("2023-04-26").getFullYear(); const pierReleaseDate = new Date("2023-10-04").getFullYear(); const cbAnniversary = currentYear - cbReleaseDate; const pierAnniversary = currentYear - pierReleaseDate; - switch (day) { - case "CB Anniversary": - return ` - Today is the ${cbAnniversary}-year anniversary of the release of Cassette Beasts! - `; - break; - case "Pier Anniversary": - return ` - Today is the ${pierAnniversary}-year anniversary of the release of Pier of the Unknown, the first DLC expansion of Cassette Beasts! - `; - break; - default: - return ``; - } + if (month === 4 && day === 26) + return ` + Today is the ${cbAnniversary}-year anniversary of the release of Cassette Beasts! + `; + else if (month === 10 && day === 4) + return ` + Today is the ${pierAnniversary}-year anniversary of the release of Pier of the Unknown, the first DLC expansion of Cassette Beasts! + `; + else + return null; } diff --git a/_site/shrines/cassettebeasts/resources/index.html b/_site/shrines/cassettebeasts/resources/index.html index 49584e82..35620dbc 100644 --- a/_site/shrines/cassettebeasts/resources/index.html +++ b/_site/shrines/cassettebeasts/resources/index.html @@ -103,9 +103,9 @@ const todayEvent = getTodayEvent(); - if (todayEvent != "No event") { + if (todayEvent) { heroTopBarEl.classList.remove('hidden'); - heroTopBarEl.innerHTML = getBlurbHtml(todayEvent); + heroTopBarEl.innerHTML = todayEvent; } function getTodayEvent() { @@ -113,35 +113,22 @@ const month = date.getMonth() + 1; const day = date.getDate(); - if (month == 4 && day == 26) - return "CB Anniversary"; - else if (month == 10 && day == 4) - return "Pier Anniversary"; - else - return "No event"; - } - - function getBlurbHtml(day) { const currentYear = new Date().getFullYear(); const cbReleaseDate = new Date("2023-04-26").getFullYear(); const pierReleaseDate = new Date("2023-10-04").getFullYear(); const cbAnniversary = currentYear - cbReleaseDate; const pierAnniversary = currentYear - pierReleaseDate; - switch (day) { - case "CB Anniversary": - return ` - Today is the ${cbAnniversary}-year anniversary of the release of Cassette Beasts! - `; - break; - case "Pier Anniversary": - return ` - Today is the ${pierAnniversary}-year anniversary of the release of Pier of the Unknown, the first DLC expansion of Cassette Beasts! - `; - break; - default: - return ``; - } + if (month === 4 && day === 26) + return ` + Today is the ${cbAnniversary}-year anniversary of the release of Cassette Beasts! + `; + else if (month === 10 && day === 4) + return ` + Today is the ${pierAnniversary}-year anniversary of the release of Pier of the Unknown, the first DLC expansion of Cassette Beasts! + `; + else + return null; } diff --git a/_site/shrines/cassettebeasts/trivia/index.html b/_site/shrines/cassettebeasts/trivia/index.html index a9639828..13e70ed5 100644 --- a/_site/shrines/cassettebeasts/trivia/index.html +++ b/_site/shrines/cassettebeasts/trivia/index.html @@ -103,9 +103,9 @@ const todayEvent = getTodayEvent(); - if (todayEvent != "No event") { + if (todayEvent) { heroTopBarEl.classList.remove('hidden'); - heroTopBarEl.innerHTML = getBlurbHtml(todayEvent); + heroTopBarEl.innerHTML = todayEvent; } function getTodayEvent() { @@ -113,35 +113,22 @@ const month = date.getMonth() + 1; const day = date.getDate(); - if (month == 4 && day == 26) - return "CB Anniversary"; - else if (month == 10 && day == 4) - return "Pier Anniversary"; - else - return "No event"; - } - - function getBlurbHtml(day) { const currentYear = new Date().getFullYear(); const cbReleaseDate = new Date("2023-04-26").getFullYear(); const pierReleaseDate = new Date("2023-10-04").getFullYear(); const cbAnniversary = currentYear - cbReleaseDate; const pierAnniversary = currentYear - pierReleaseDate; - switch (day) { - case "CB Anniversary": - return ` - Today is the ${cbAnniversary}-year anniversary of the release of Cassette Beasts! - `; - break; - case "Pier Anniversary": - return ` - Today is the ${pierAnniversary}-year anniversary of the release of Pier of the Unknown, the first DLC expansion of Cassette Beasts! - `; - break; - default: - return ``; - } + if (month === 4 && day === 26) + return ` + Today is the ${cbAnniversary}-year anniversary of the release of Cassette Beasts! + `; + else if (month === 10 && day === 4) + return ` + Today is the ${pierAnniversary}-year anniversary of the release of Pier of the Unknown, the first DLC expansion of Cassette Beasts! + `; + else + return null; } diff --git a/src/_includes/cassettebeasts/hero.njk b/src/_includes/cassettebeasts/hero.njk index fe4355da..249aa5a7 100644 --- a/src/_includes/cassettebeasts/hero.njk +++ b/src/_includes/cassettebeasts/hero.njk @@ -10,9 +10,9 @@ {% block eventScript %} const todayEvent = getTodayEvent(); - if (todayEvent != "No event") { + if (todayEvent) { heroTopBarEl.classList.remove('hidden'); - heroTopBarEl.innerHTML = getBlurbHtml(todayEvent); + heroTopBarEl.innerHTML = todayEvent; } function getTodayEvent() { @@ -20,34 +20,21 @@ const month = date.getMonth() + 1; const day = date.getDate(); - if (month == 4 && day == 26) - return "CB Anniversary"; - else if (month == 10 && day == 4) - return "Pier Anniversary"; - else - return "No event"; - } - - function getBlurbHtml(day) { const currentYear = new Date().getFullYear(); const cbReleaseDate = new Date("2023-04-26").getFullYear(); const pierReleaseDate = new Date("2023-10-04").getFullYear(); const cbAnniversary = currentYear - cbReleaseDate; const pierAnniversary = currentYear - pierReleaseDate; - switch (day) { - case "CB Anniversary": - return ` - Today is the ${cbAnniversary}-year anniversary of the release of Cassette Beasts! - `; - break; - case "Pier Anniversary": - return ` - Today is the ${pierAnniversary}-year anniversary of the release of Pier of the Unknown, the first DLC expansion of Cassette Beasts! - `; - break; - default: - return ``; - } + if (month === 4 && day === 26) + return ` + Today is the ${cbAnniversary}-year anniversary of the release of Cassette Beasts! + `; + else if (month === 10 && day === 4) + return ` + Today is the ${pierAnniversary}-year anniversary of the release of Pier of the Unknown, the first DLC expansion of Cassette Beasts! + `; + else + return null; } {% endblock %} \ No newline at end of file