Refactor Cassette Beasts shrine hero events

This commit is contained in:
Helen Chong 2024-04-29 11:36:34 +08:00
parent 9bb88594a6
commit 6c4d658f76
9 changed files with 97 additions and 201 deletions

View File

@ -4,7 +4,7 @@
<subtitle>Leilukin&#39;s personal website.</subtitle>
<link href="https://leilukin.neocities.org/feed.xml" rel="self"/>
<link href="https://leilukin.neocities.org"/>
<updated>2024-04-29T03:15:37Z</updated>
<updated>2024-04-29T03:36:24Z</updated>
<id>https://leilukin.neocities.org</id>
<author>
<name>Leilukin</name>

View File

@ -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 <cite>Cassette Beasts</cite>!
`;
break;
case "Pier Anniversary":
return `
Today is the ${pierAnniversary}-year anniversary of the release of <cite>Pier of the Unknown</cite>, the first DLC expansion of <cite>Cassette Beasts</cite>!
`;
break;
default:
return ``;
}
if (month === 4 && day === 26)
return `
Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>!
`;
else if (month === 10 && day === 4)
return `
Today is the ${pierAnniversary}-year anniversary of the release of <cite>Pier of the Unknown</cite>, the first DLC expansion of <cite>Cassette Beasts</cite>!
`;
else
return null;
}
</script>

View File

@ -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 <cite>Cassette Beasts</cite>!
`;
break;
case "Pier Anniversary":
return `
Today is the ${pierAnniversary}-year anniversary of the release of <cite>Pier of the Unknown</cite>, the first DLC expansion of <cite>Cassette Beasts</cite>!
`;
break;
default:
return ``;
}
if (month === 4 && day === 26)
return `
Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>!
`;
else if (month === 10 && day === 4)
return `
Today is the ${pierAnniversary}-year anniversary of the release of <cite>Pier of the Unknown</cite>, the first DLC expansion of <cite>Cassette Beasts</cite>!
`;
else
return null;
}
</script>

View File

@ -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 <cite>Cassette Beasts</cite>!
`;
break;
case "Pier Anniversary":
return `
Today is the ${pierAnniversary}-year anniversary of the release of <cite>Pier of the Unknown</cite>, the first DLC expansion of <cite>Cassette Beasts</cite>!
`;
break;
default:
return ``;
}
if (month === 4 && day === 26)
return `
Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>!
`;
else if (month === 10 && day === 4)
return `
Today is the ${pierAnniversary}-year anniversary of the release of <cite>Pier of the Unknown</cite>, the first DLC expansion of <cite>Cassette Beasts</cite>!
`;
else
return null;
}
</script>

View File

@ -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 <cite>Cassette Beasts</cite>!
`;
break;
case "Pier Anniversary":
return `
Today is the ${pierAnniversary}-year anniversary of the release of <cite>Pier of the Unknown</cite>, the first DLC expansion of <cite>Cassette Beasts</cite>!
`;
break;
default:
return ``;
}
if (month === 4 && day === 26)
return `
Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>!
`;
else if (month === 10 && day === 4)
return `
Today is the ${pierAnniversary}-year anniversary of the release of <cite>Pier of the Unknown</cite>, the first DLC expansion of <cite>Cassette Beasts</cite>!
`;
else
return null;
}
</script>

View File

@ -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 <cite>Cassette Beasts</cite>!
`;
break;
case "Pier Anniversary":
return `
Today is the ${pierAnniversary}-year anniversary of the release of <cite>Pier of the Unknown</cite>, the first DLC expansion of <cite>Cassette Beasts</cite>!
`;
break;
default:
return ``;
}
if (month === 4 && day === 26)
return `
Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>!
`;
else if (month === 10 && day === 4)
return `
Today is the ${pierAnniversary}-year anniversary of the release of <cite>Pier of the Unknown</cite>, the first DLC expansion of <cite>Cassette Beasts</cite>!
`;
else
return null;
}
</script>

View File

@ -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 <cite>Cassette Beasts</cite>!
`;
break;
case "Pier Anniversary":
return `
Today is the ${pierAnniversary}-year anniversary of the release of <cite>Pier of the Unknown</cite>, the first DLC expansion of <cite>Cassette Beasts</cite>!
`;
break;
default:
return ``;
}
if (month === 4 && day === 26)
return `
Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>!
`;
else if (month === 10 && day === 4)
return `
Today is the ${pierAnniversary}-year anniversary of the release of <cite>Pier of the Unknown</cite>, the first DLC expansion of <cite>Cassette Beasts</cite>!
`;
else
return null;
}
</script>

View File

@ -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 <cite>Cassette Beasts</cite>!
`;
break;
case "Pier Anniversary":
return `
Today is the ${pierAnniversary}-year anniversary of the release of <cite>Pier of the Unknown</cite>, the first DLC expansion of <cite>Cassette Beasts</cite>!
`;
break;
default:
return ``;
}
if (month === 4 && day === 26)
return `
Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>!
`;
else if (month === 10 && day === 4)
return `
Today is the ${pierAnniversary}-year anniversary of the release of <cite>Pier of the Unknown</cite>, the first DLC expansion of <cite>Cassette Beasts</cite>!
`;
else
return null;
}
</script>

View File

@ -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 <cite>Cassette Beasts</cite>!
`;
break;
case "Pier Anniversary":
return `
Today is the ${pierAnniversary}-year anniversary of the release of <cite>Pier of the Unknown</cite>, the first DLC expansion of <cite>Cassette Beasts</cite>!
`;
break;
default:
return ``;
}
if (month === 4 && day === 26)
return `
Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>!
`;
else if (month === 10 && day === 4)
return `
Today is the ${pierAnniversary}-year anniversary of the release of <cite>Pier of the Unknown</cite>, the first DLC expansion of <cite>Cassette Beasts</cite>!
`;
else
return null;
}
{% endblock %}