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> <subtitle>Leilukin&#39;s personal website.</subtitle>
<link href="https://leilukin.neocities.org/feed.xml" rel="self"/> <link href="https://leilukin.neocities.org/feed.xml" rel="self"/>
<link href="https://leilukin.neocities.org"/> <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> <id>https://leilukin.neocities.org</id>
<author> <author>
<name>Leilukin</name> <name>Leilukin</name>

View File

@ -103,9 +103,9 @@
const todayEvent = getTodayEvent(); const todayEvent = getTodayEvent();
if (todayEvent != "No event") { if (todayEvent) {
heroTopBarEl.classList.remove('hidden'); heroTopBarEl.classList.remove('hidden');
heroTopBarEl.innerHTML = getBlurbHtml(todayEvent); heroTopBarEl.innerHTML = todayEvent;
} }
function getTodayEvent() { function getTodayEvent() {
@ -113,35 +113,22 @@
const month = date.getMonth() + 1; const month = date.getMonth() + 1;
const day = date.getDate(); 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 currentYear = new Date().getFullYear();
const cbReleaseDate = new Date("2023-04-26").getFullYear(); const cbReleaseDate = new Date("2023-04-26").getFullYear();
const pierReleaseDate = new Date("2023-10-04").getFullYear(); const pierReleaseDate = new Date("2023-10-04").getFullYear();
const cbAnniversary = currentYear - cbReleaseDate; const cbAnniversary = currentYear - cbReleaseDate;
const pierAnniversary = currentYear - pierReleaseDate; const pierAnniversary = currentYear - pierReleaseDate;
switch (day) { if (month === 4 && day === 26)
case "CB Anniversary": return `
return ` Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>!
Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>! `;
`; else if (month === 10 && day === 4)
break; return `
case "Pier Anniversary": 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>!
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;
break;
default:
return ``;
}
} }
</script> </script>

View File

@ -103,9 +103,9 @@
const todayEvent = getTodayEvent(); const todayEvent = getTodayEvent();
if (todayEvent != "No event") { if (todayEvent) {
heroTopBarEl.classList.remove('hidden'); heroTopBarEl.classList.remove('hidden');
heroTopBarEl.innerHTML = getBlurbHtml(todayEvent); heroTopBarEl.innerHTML = todayEvent;
} }
function getTodayEvent() { function getTodayEvent() {
@ -113,35 +113,22 @@
const month = date.getMonth() + 1; const month = date.getMonth() + 1;
const day = date.getDate(); 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 currentYear = new Date().getFullYear();
const cbReleaseDate = new Date("2023-04-26").getFullYear(); const cbReleaseDate = new Date("2023-04-26").getFullYear();
const pierReleaseDate = new Date("2023-10-04").getFullYear(); const pierReleaseDate = new Date("2023-10-04").getFullYear();
const cbAnniversary = currentYear - cbReleaseDate; const cbAnniversary = currentYear - cbReleaseDate;
const pierAnniversary = currentYear - pierReleaseDate; const pierAnniversary = currentYear - pierReleaseDate;
switch (day) { if (month === 4 && day === 26)
case "CB Anniversary": return `
return ` Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>!
Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>! `;
`; else if (month === 10 && day === 4)
break; return `
case "Pier Anniversary": 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>!
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;
break;
default:
return ``;
}
} }
</script> </script>

View File

@ -103,9 +103,9 @@
const todayEvent = getTodayEvent(); const todayEvent = getTodayEvent();
if (todayEvent != "No event") { if (todayEvent) {
heroTopBarEl.classList.remove('hidden'); heroTopBarEl.classList.remove('hidden');
heroTopBarEl.innerHTML = getBlurbHtml(todayEvent); heroTopBarEl.innerHTML = todayEvent;
} }
function getTodayEvent() { function getTodayEvent() {
@ -113,35 +113,22 @@
const month = date.getMonth() + 1; const month = date.getMonth() + 1;
const day = date.getDate(); 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 currentYear = new Date().getFullYear();
const cbReleaseDate = new Date("2023-04-26").getFullYear(); const cbReleaseDate = new Date("2023-04-26").getFullYear();
const pierReleaseDate = new Date("2023-10-04").getFullYear(); const pierReleaseDate = new Date("2023-10-04").getFullYear();
const cbAnniversary = currentYear - cbReleaseDate; const cbAnniversary = currentYear - cbReleaseDate;
const pierAnniversary = currentYear - pierReleaseDate; const pierAnniversary = currentYear - pierReleaseDate;
switch (day) { if (month === 4 && day === 26)
case "CB Anniversary": return `
return ` Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>!
Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>! `;
`; else if (month === 10 && day === 4)
break; return `
case "Pier Anniversary": 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>!
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;
break;
default:
return ``;
}
} }
</script> </script>

View File

@ -103,9 +103,9 @@
const todayEvent = getTodayEvent(); const todayEvent = getTodayEvent();
if (todayEvent != "No event") { if (todayEvent) {
heroTopBarEl.classList.remove('hidden'); heroTopBarEl.classList.remove('hidden');
heroTopBarEl.innerHTML = getBlurbHtml(todayEvent); heroTopBarEl.innerHTML = todayEvent;
} }
function getTodayEvent() { function getTodayEvent() {
@ -113,35 +113,22 @@
const month = date.getMonth() + 1; const month = date.getMonth() + 1;
const day = date.getDate(); 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 currentYear = new Date().getFullYear();
const cbReleaseDate = new Date("2023-04-26").getFullYear(); const cbReleaseDate = new Date("2023-04-26").getFullYear();
const pierReleaseDate = new Date("2023-10-04").getFullYear(); const pierReleaseDate = new Date("2023-10-04").getFullYear();
const cbAnniversary = currentYear - cbReleaseDate; const cbAnniversary = currentYear - cbReleaseDate;
const pierAnniversary = currentYear - pierReleaseDate; const pierAnniversary = currentYear - pierReleaseDate;
switch (day) { if (month === 4 && day === 26)
case "CB Anniversary": return `
return ` Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>!
Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>! `;
`; else if (month === 10 && day === 4)
break; return `
case "Pier Anniversary": 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>!
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;
break;
default:
return ``;
}
} }
</script> </script>

View File

@ -103,9 +103,9 @@
const todayEvent = getTodayEvent(); const todayEvent = getTodayEvent();
if (todayEvent != "No event") { if (todayEvent) {
heroTopBarEl.classList.remove('hidden'); heroTopBarEl.classList.remove('hidden');
heroTopBarEl.innerHTML = getBlurbHtml(todayEvent); heroTopBarEl.innerHTML = todayEvent;
} }
function getTodayEvent() { function getTodayEvent() {
@ -113,35 +113,22 @@
const month = date.getMonth() + 1; const month = date.getMonth() + 1;
const day = date.getDate(); 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 currentYear = new Date().getFullYear();
const cbReleaseDate = new Date("2023-04-26").getFullYear(); const cbReleaseDate = new Date("2023-04-26").getFullYear();
const pierReleaseDate = new Date("2023-10-04").getFullYear(); const pierReleaseDate = new Date("2023-10-04").getFullYear();
const cbAnniversary = currentYear - cbReleaseDate; const cbAnniversary = currentYear - cbReleaseDate;
const pierAnniversary = currentYear - pierReleaseDate; const pierAnniversary = currentYear - pierReleaseDate;
switch (day) { if (month === 4 && day === 26)
case "CB Anniversary": return `
return ` Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>!
Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>! `;
`; else if (month === 10 && day === 4)
break; return `
case "Pier Anniversary": 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>!
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;
break;
default:
return ``;
}
} }
</script> </script>

View File

@ -103,9 +103,9 @@
const todayEvent = getTodayEvent(); const todayEvent = getTodayEvent();
if (todayEvent != "No event") { if (todayEvent) {
heroTopBarEl.classList.remove('hidden'); heroTopBarEl.classList.remove('hidden');
heroTopBarEl.innerHTML = getBlurbHtml(todayEvent); heroTopBarEl.innerHTML = todayEvent;
} }
function getTodayEvent() { function getTodayEvent() {
@ -113,35 +113,22 @@
const month = date.getMonth() + 1; const month = date.getMonth() + 1;
const day = date.getDate(); 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 currentYear = new Date().getFullYear();
const cbReleaseDate = new Date("2023-04-26").getFullYear(); const cbReleaseDate = new Date("2023-04-26").getFullYear();
const pierReleaseDate = new Date("2023-10-04").getFullYear(); const pierReleaseDate = new Date("2023-10-04").getFullYear();
const cbAnniversary = currentYear - cbReleaseDate; const cbAnniversary = currentYear - cbReleaseDate;
const pierAnniversary = currentYear - pierReleaseDate; const pierAnniversary = currentYear - pierReleaseDate;
switch (day) { if (month === 4 && day === 26)
case "CB Anniversary": return `
return ` Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>!
Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>! `;
`; else if (month === 10 && day === 4)
break; return `
case "Pier Anniversary": 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>!
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;
break;
default:
return ``;
}
} }
</script> </script>

View File

@ -103,9 +103,9 @@
const todayEvent = getTodayEvent(); const todayEvent = getTodayEvent();
if (todayEvent != "No event") { if (todayEvent) {
heroTopBarEl.classList.remove('hidden'); heroTopBarEl.classList.remove('hidden');
heroTopBarEl.innerHTML = getBlurbHtml(todayEvent); heroTopBarEl.innerHTML = todayEvent;
} }
function getTodayEvent() { function getTodayEvent() {
@ -113,35 +113,22 @@
const month = date.getMonth() + 1; const month = date.getMonth() + 1;
const day = date.getDate(); 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 currentYear = new Date().getFullYear();
const cbReleaseDate = new Date("2023-04-26").getFullYear(); const cbReleaseDate = new Date("2023-04-26").getFullYear();
const pierReleaseDate = new Date("2023-10-04").getFullYear(); const pierReleaseDate = new Date("2023-10-04").getFullYear();
const cbAnniversary = currentYear - cbReleaseDate; const cbAnniversary = currentYear - cbReleaseDate;
const pierAnniversary = currentYear - pierReleaseDate; const pierAnniversary = currentYear - pierReleaseDate;
switch (day) { if (month === 4 && day === 26)
case "CB Anniversary": return `
return ` Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>!
Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>! `;
`; else if (month === 10 && day === 4)
break; return `
case "Pier Anniversary": 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>!
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;
break;
default:
return ``;
}
} }
</script> </script>

View File

@ -10,9 +10,9 @@
{% block eventScript %} {% block eventScript %}
const todayEvent = getTodayEvent(); const todayEvent = getTodayEvent();
if (todayEvent != "No event") { if (todayEvent) {
heroTopBarEl.classList.remove('hidden'); heroTopBarEl.classList.remove('hidden');
heroTopBarEl.innerHTML = getBlurbHtml(todayEvent); heroTopBarEl.innerHTML = todayEvent;
} }
function getTodayEvent() { function getTodayEvent() {
@ -20,34 +20,21 @@
const month = date.getMonth() + 1; const month = date.getMonth() + 1;
const day = date.getDate(); 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 currentYear = new Date().getFullYear();
const cbReleaseDate = new Date("2023-04-26").getFullYear(); const cbReleaseDate = new Date("2023-04-26").getFullYear();
const pierReleaseDate = new Date("2023-10-04").getFullYear(); const pierReleaseDate = new Date("2023-10-04").getFullYear();
const cbAnniversary = currentYear - cbReleaseDate; const cbAnniversary = currentYear - cbReleaseDate;
const pierAnniversary = currentYear - pierReleaseDate; const pierAnniversary = currentYear - pierReleaseDate;
switch (day) { if (month === 4 && day === 26)
case "CB Anniversary": return `
return ` Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>!
Today is the ${cbAnniversary}-year anniversary of the release of <cite>Cassette Beasts</cite>! `;
`; else if (month === 10 && day === 4)
break; return `
case "Pier Anniversary": 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>!
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;
break;
default:
return ``;
}
} }
{% endblock %} {% endblock %}