Refactor KotOR hero header events

This commit is contained in:
Helen Chong 2024-04-29 11:40:43 +08:00
parent db7dc4cd23
commit cbb5b8d8ac
21 changed files with 241 additions and 501 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:38:43Z</updated> <updated>2024-04-29T03:40:18Z</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 == 7 && day == 15)
return "KotOR 1 Anniversary";
else if (month == 12 && day == 6)
return "KotOR 2 Anniversary";
else
return "No event";
}
function getBlurbHtml(day) {
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const kotor1ReleaseDate = new Date("2003-07-15").getFullYear(); const kotor1ReleaseDate = new Date("2003-07-15").getFullYear();
const kotor2ReleaseDate = new Date("2004-12-06").getFullYear(); const kotor2ReleaseDate = new Date("2004-12-06").getFullYear();
const kotor1Anniversary = currentYear - kotor1ReleaseDate; const kotor1Anniversary = currentYear - kotor1ReleaseDate;
const kotor2Anniversary = currentYear - kotor2ReleaseDate; const kotor2Anniversary = currentYear - kotor2ReleaseDate;
switch (day) { if (month === 7 && day === 15)
case "KotOR 1 Anniversary": return `
return ` Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite>
Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite> `;
`; else if (month === 12 && day === 6)
break; return `
case "KotOR 2 Anniversary": Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</cite>
return ` `;
Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</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 == 7 && day == 15)
return "KotOR 1 Anniversary";
else if (month == 12 && day == 6)
return "KotOR 2 Anniversary";
else
return "No event";
}
function getBlurbHtml(day) {
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const kotor1ReleaseDate = new Date("2003-07-15").getFullYear(); const kotor1ReleaseDate = new Date("2003-07-15").getFullYear();
const kotor2ReleaseDate = new Date("2004-12-06").getFullYear(); const kotor2ReleaseDate = new Date("2004-12-06").getFullYear();
const kotor1Anniversary = currentYear - kotor1ReleaseDate; const kotor1Anniversary = currentYear - kotor1ReleaseDate;
const kotor2Anniversary = currentYear - kotor2ReleaseDate; const kotor2Anniversary = currentYear - kotor2ReleaseDate;
switch (day) { if (month === 7 && day === 15)
case "KotOR 1 Anniversary": return `
return ` Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite>
Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite> `;
`; else if (month === 12 && day === 6)
break; return `
case "KotOR 2 Anniversary": Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</cite>
return ` `;
Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</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 == 7 && day == 15)
return "KotOR 1 Anniversary";
else if (month == 12 && day == 6)
return "KotOR 2 Anniversary";
else
return "No event";
}
function getBlurbHtml(day) {
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const kotor1ReleaseDate = new Date("2003-07-15").getFullYear(); const kotor1ReleaseDate = new Date("2003-07-15").getFullYear();
const kotor2ReleaseDate = new Date("2004-12-06").getFullYear(); const kotor2ReleaseDate = new Date("2004-12-06").getFullYear();
const kotor1Anniversary = currentYear - kotor1ReleaseDate; const kotor1Anniversary = currentYear - kotor1ReleaseDate;
const kotor2Anniversary = currentYear - kotor2ReleaseDate; const kotor2Anniversary = currentYear - kotor2ReleaseDate;
switch (day) { if (month === 7 && day === 15)
case "KotOR 1 Anniversary": return `
return ` Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite>
Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite> `;
`; else if (month === 12 && day === 6)
break; return `
case "KotOR 2 Anniversary": Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</cite>
return ` `;
Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</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 == 7 && day == 15)
return "KotOR 1 Anniversary";
else if (month == 12 && day == 6)
return "KotOR 2 Anniversary";
else
return "No event";
}
function getBlurbHtml(day) {
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const kotor1ReleaseDate = new Date("2003-07-15").getFullYear(); const kotor1ReleaseDate = new Date("2003-07-15").getFullYear();
const kotor2ReleaseDate = new Date("2004-12-06").getFullYear(); const kotor2ReleaseDate = new Date("2004-12-06").getFullYear();
const kotor1Anniversary = currentYear - kotor1ReleaseDate; const kotor1Anniversary = currentYear - kotor1ReleaseDate;
const kotor2Anniversary = currentYear - kotor2ReleaseDate; const kotor2Anniversary = currentYear - kotor2ReleaseDate;
switch (day) { if (month === 7 && day === 15)
case "KotOR 1 Anniversary": return `
return ` Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite>
Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite> `;
`; else if (month === 12 && day === 6)
break; return `
case "KotOR 2 Anniversary": Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</cite>
return ` `;
Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</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 == 7 && day == 15)
return "KotOR 1 Anniversary";
else if (month == 12 && day == 6)
return "KotOR 2 Anniversary";
else
return "No event";
}
function getBlurbHtml(day) {
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const kotor1ReleaseDate = new Date("2003-07-15").getFullYear(); const kotor1ReleaseDate = new Date("2003-07-15").getFullYear();
const kotor2ReleaseDate = new Date("2004-12-06").getFullYear(); const kotor2ReleaseDate = new Date("2004-12-06").getFullYear();
const kotor1Anniversary = currentYear - kotor1ReleaseDate; const kotor1Anniversary = currentYear - kotor1ReleaseDate;
const kotor2Anniversary = currentYear - kotor2ReleaseDate; const kotor2Anniversary = currentYear - kotor2ReleaseDate;
switch (day) { if (month === 7 && day === 15)
case "KotOR 1 Anniversary": return `
return ` Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite>
Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite> `;
`; else if (month === 12 && day === 6)
break; return `
case "KotOR 2 Anniversary": Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</cite>
return ` `;
Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</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 == 7 && day == 15)
return "KotOR 1 Anniversary";
else if (month == 12 && day == 6)
return "KotOR 2 Anniversary";
else
return "No event";
}
function getBlurbHtml(day) {
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const kotor1ReleaseDate = new Date("2003-07-15").getFullYear(); const kotor1ReleaseDate = new Date("2003-07-15").getFullYear();
const kotor2ReleaseDate = new Date("2004-12-06").getFullYear(); const kotor2ReleaseDate = new Date("2004-12-06").getFullYear();
const kotor1Anniversary = currentYear - kotor1ReleaseDate; const kotor1Anniversary = currentYear - kotor1ReleaseDate;
const kotor2Anniversary = currentYear - kotor2ReleaseDate; const kotor2Anniversary = currentYear - kotor2ReleaseDate;
switch (day) { if (month === 7 && day === 15)
case "KotOR 1 Anniversary": return `
return ` Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite>
Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite> `;
`; else if (month === 12 && day === 6)
break; return `
case "KotOR 2 Anniversary": Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</cite>
return ` `;
Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</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 == 7 && day == 15)
return "KotOR 1 Anniversary";
else if (month == 12 && day == 6)
return "KotOR 2 Anniversary";
else
return "No event";
}
function getBlurbHtml(day) {
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const kotor1ReleaseDate = new Date("2003-07-15").getFullYear(); const kotor1ReleaseDate = new Date("2003-07-15").getFullYear();
const kotor2ReleaseDate = new Date("2004-12-06").getFullYear(); const kotor2ReleaseDate = new Date("2004-12-06").getFullYear();
const kotor1Anniversary = currentYear - kotor1ReleaseDate; const kotor1Anniversary = currentYear - kotor1ReleaseDate;
const kotor2Anniversary = currentYear - kotor2ReleaseDate; const kotor2Anniversary = currentYear - kotor2ReleaseDate;
switch (day) { if (month === 7 && day === 15)
case "KotOR 1 Anniversary": return `
return ` Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite>
Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite> `;
`; else if (month === 12 && day === 6)
break; return `
case "KotOR 2 Anniversary": Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</cite>
return ` `;
Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</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 == 7 && day == 15)
return "KotOR 1 Anniversary";
else if (month == 12 && day == 6)
return "KotOR 2 Anniversary";
else
return "No event";
}
function getBlurbHtml(day) {
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const kotor1ReleaseDate = new Date("2003-07-15").getFullYear(); const kotor1ReleaseDate = new Date("2003-07-15").getFullYear();
const kotor2ReleaseDate = new Date("2004-12-06").getFullYear(); const kotor2ReleaseDate = new Date("2004-12-06").getFullYear();
const kotor1Anniversary = currentYear - kotor1ReleaseDate; const kotor1Anniversary = currentYear - kotor1ReleaseDate;
const kotor2Anniversary = currentYear - kotor2ReleaseDate; const kotor2Anniversary = currentYear - kotor2ReleaseDate;
switch (day) { if (month === 7 && day === 15)
case "KotOR 1 Anniversary": return `
return ` Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite>
Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite> `;
`; else if (month === 12 && day === 6)
break; return `
case "KotOR 2 Anniversary": Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</cite>
return ` `;
Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</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 == 7 && day == 15)
return "KotOR 1 Anniversary";
else if (month == 12 && day == 6)
return "KotOR 2 Anniversary";
else
return "No event";
}
function getBlurbHtml(day) {
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const kotor1ReleaseDate = new Date("2003-07-15").getFullYear(); const kotor1ReleaseDate = new Date("2003-07-15").getFullYear();
const kotor2ReleaseDate = new Date("2004-12-06").getFullYear(); const kotor2ReleaseDate = new Date("2004-12-06").getFullYear();
const kotor1Anniversary = currentYear - kotor1ReleaseDate; const kotor1Anniversary = currentYear - kotor1ReleaseDate;
const kotor2Anniversary = currentYear - kotor2ReleaseDate; const kotor2Anniversary = currentYear - kotor2ReleaseDate;
switch (day) { if (month === 7 && day === 15)
case "KotOR 1 Anniversary": return `
return ` Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite>
Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite> `;
`; else if (month === 12 && day === 6)
break; return `
case "KotOR 2 Anniversary": Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</cite>
return ` `;
Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</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 == 7 && day == 15)
return "KotOR 1 Anniversary";
else if (month == 12 && day == 6)
return "KotOR 2 Anniversary";
else
return "No event";
}
function getBlurbHtml(day) {
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const kotor1ReleaseDate = new Date("2003-07-15").getFullYear(); const kotor1ReleaseDate = new Date("2003-07-15").getFullYear();
const kotor2ReleaseDate = new Date("2004-12-06").getFullYear(); const kotor2ReleaseDate = new Date("2004-12-06").getFullYear();
const kotor1Anniversary = currentYear - kotor1ReleaseDate; const kotor1Anniversary = currentYear - kotor1ReleaseDate;
const kotor2Anniversary = currentYear - kotor2ReleaseDate; const kotor2Anniversary = currentYear - kotor2ReleaseDate;
switch (day) { if (month === 7 && day === 15)
case "KotOR 1 Anniversary": return `
return ` Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite>
Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite> `;
`; else if (month === 12 && day === 6)
break; return `
case "KotOR 2 Anniversary": Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</cite>
return ` `;
Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</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 == 7 && day == 15)
return "KotOR 1 Anniversary";
else if (month == 12 && day == 6)
return "KotOR 2 Anniversary";
else
return "No event";
}
function getBlurbHtml(day) {
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const kotor1ReleaseDate = new Date("2003-07-15").getFullYear(); const kotor1ReleaseDate = new Date("2003-07-15").getFullYear();
const kotor2ReleaseDate = new Date("2004-12-06").getFullYear(); const kotor2ReleaseDate = new Date("2004-12-06").getFullYear();
const kotor1Anniversary = currentYear - kotor1ReleaseDate; const kotor1Anniversary = currentYear - kotor1ReleaseDate;
const kotor2Anniversary = currentYear - kotor2ReleaseDate; const kotor2Anniversary = currentYear - kotor2ReleaseDate;
switch (day) { if (month === 7 && day === 15)
case "KotOR 1 Anniversary": return `
return ` Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite>
Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite> `;
`; else if (month === 12 && day === 6)
break; return `
case "KotOR 2 Anniversary": Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</cite>
return ` `;
Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</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 == 7 && day == 15)
return "KotOR 1 Anniversary";
else if (month == 12 && day == 6)
return "KotOR 2 Anniversary";
else
return "No event";
}
function getBlurbHtml(day) {
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const kotor1ReleaseDate = new Date("2003-07-15").getFullYear(); const kotor1ReleaseDate = new Date("2003-07-15").getFullYear();
const kotor2ReleaseDate = new Date("2004-12-06").getFullYear(); const kotor2ReleaseDate = new Date("2004-12-06").getFullYear();
const kotor1Anniversary = currentYear - kotor1ReleaseDate; const kotor1Anniversary = currentYear - kotor1ReleaseDate;
const kotor2Anniversary = currentYear - kotor2ReleaseDate; const kotor2Anniversary = currentYear - kotor2ReleaseDate;
switch (day) { if (month === 7 && day === 15)
case "KotOR 1 Anniversary": return `
return ` Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite>
Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite> `;
`; else if (month === 12 && day === 6)
break; return `
case "KotOR 2 Anniversary": Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</cite>
return ` `;
Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</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 == 7 && day == 15)
return "KotOR 1 Anniversary";
else if (month == 12 && day == 6)
return "KotOR 2 Anniversary";
else
return "No event";
}
function getBlurbHtml(day) {
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const kotor1ReleaseDate = new Date("2003-07-15").getFullYear(); const kotor1ReleaseDate = new Date("2003-07-15").getFullYear();
const kotor2ReleaseDate = new Date("2004-12-06").getFullYear(); const kotor2ReleaseDate = new Date("2004-12-06").getFullYear();
const kotor1Anniversary = currentYear - kotor1ReleaseDate; const kotor1Anniversary = currentYear - kotor1ReleaseDate;
const kotor2Anniversary = currentYear - kotor2ReleaseDate; const kotor2Anniversary = currentYear - kotor2ReleaseDate;
switch (day) { if (month === 7 && day === 15)
case "KotOR 1 Anniversary": return `
return ` Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite>
Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite> `;
`; else if (month === 12 && day === 6)
break; return `
case "KotOR 2 Anniversary": Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</cite>
return ` `;
Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</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 == 7 && day == 15)
return "KotOR 1 Anniversary";
else if (month == 12 && day == 6)
return "KotOR 2 Anniversary";
else
return "No event";
}
function getBlurbHtml(day) {
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const kotor1ReleaseDate = new Date("2003-07-15").getFullYear(); const kotor1ReleaseDate = new Date("2003-07-15").getFullYear();
const kotor2ReleaseDate = new Date("2004-12-06").getFullYear(); const kotor2ReleaseDate = new Date("2004-12-06").getFullYear();
const kotor1Anniversary = currentYear - kotor1ReleaseDate; const kotor1Anniversary = currentYear - kotor1ReleaseDate;
const kotor2Anniversary = currentYear - kotor2ReleaseDate; const kotor2Anniversary = currentYear - kotor2ReleaseDate;
switch (day) { if (month === 7 && day === 15)
case "KotOR 1 Anniversary": return `
return ` Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite>
Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite> `;
`; else if (month === 12 && day === 6)
break; return `
case "KotOR 2 Anniversary": Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</cite>
return ` `;
Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</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 == 7 && day == 15)
return "KotOR 1 Anniversary";
else if (month == 12 && day == 6)
return "KotOR 2 Anniversary";
else
return "No event";
}
function getBlurbHtml(day) {
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const kotor1ReleaseDate = new Date("2003-07-15").getFullYear(); const kotor1ReleaseDate = new Date("2003-07-15").getFullYear();
const kotor2ReleaseDate = new Date("2004-12-06").getFullYear(); const kotor2ReleaseDate = new Date("2004-12-06").getFullYear();
const kotor1Anniversary = currentYear - kotor1ReleaseDate; const kotor1Anniversary = currentYear - kotor1ReleaseDate;
const kotor2Anniversary = currentYear - kotor2ReleaseDate; const kotor2Anniversary = currentYear - kotor2ReleaseDate;
switch (day) { if (month === 7 && day === 15)
case "KotOR 1 Anniversary": return `
return ` Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite>
Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite> `;
`; else if (month === 12 && day === 6)
break; return `
case "KotOR 2 Anniversary": Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</cite>
return ` `;
Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</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 == 7 && day == 15)
return "KotOR 1 Anniversary";
else if (month == 12 && day == 6)
return "KotOR 2 Anniversary";
else
return "No event";
}
function getBlurbHtml(day) {
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const kotor1ReleaseDate = new Date("2003-07-15").getFullYear(); const kotor1ReleaseDate = new Date("2003-07-15").getFullYear();
const kotor2ReleaseDate = new Date("2004-12-06").getFullYear(); const kotor2ReleaseDate = new Date("2004-12-06").getFullYear();
const kotor1Anniversary = currentYear - kotor1ReleaseDate; const kotor1Anniversary = currentYear - kotor1ReleaseDate;
const kotor2Anniversary = currentYear - kotor2ReleaseDate; const kotor2Anniversary = currentYear - kotor2ReleaseDate;
switch (day) { if (month === 7 && day === 15)
case "KotOR 1 Anniversary": return `
return ` Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite>
Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite> `;
`; else if (month === 12 && day === 6)
break; return `
case "KotOR 2 Anniversary": Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</cite>
return ` `;
Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</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 == 7 && day == 15)
return "KotOR 1 Anniversary";
else if (month == 12 && day == 6)
return "KotOR 2 Anniversary";
else
return "No event";
}
function getBlurbHtml(day) {
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const kotor1ReleaseDate = new Date("2003-07-15").getFullYear(); const kotor1ReleaseDate = new Date("2003-07-15").getFullYear();
const kotor2ReleaseDate = new Date("2004-12-06").getFullYear(); const kotor2ReleaseDate = new Date("2004-12-06").getFullYear();
const kotor1Anniversary = currentYear - kotor1ReleaseDate; const kotor1Anniversary = currentYear - kotor1ReleaseDate;
const kotor2Anniversary = currentYear - kotor2ReleaseDate; const kotor2Anniversary = currentYear - kotor2ReleaseDate;
switch (day) { if (month === 7 && day === 15)
case "KotOR 1 Anniversary": return `
return ` Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite>
Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite> `;
`; else if (month === 12 && day === 6)
break; return `
case "KotOR 2 Anniversary": Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</cite>
return ` `;
Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</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 == 7 && day == 15)
return "KotOR 1 Anniversary";
else if (month == 12 && day == 6)
return "KotOR 2 Anniversary";
else
return "No event";
}
function getBlurbHtml(day) {
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const kotor1ReleaseDate = new Date("2003-07-15").getFullYear(); const kotor1ReleaseDate = new Date("2003-07-15").getFullYear();
const kotor2ReleaseDate = new Date("2004-12-06").getFullYear(); const kotor2ReleaseDate = new Date("2004-12-06").getFullYear();
const kotor1Anniversary = currentYear - kotor1ReleaseDate; const kotor1Anniversary = currentYear - kotor1ReleaseDate;
const kotor2Anniversary = currentYear - kotor2ReleaseDate; const kotor2Anniversary = currentYear - kotor2ReleaseDate;
switch (day) { if (month === 7 && day === 15)
case "KotOR 1 Anniversary": return `
return ` Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite>
Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite> `;
`; else if (month === 12 && day === 6)
break; return `
case "KotOR 2 Anniversary": Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</cite>
return ` `;
Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</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 == 7 && day == 15)
return "KotOR 1 Anniversary";
else if (month == 12 && day == 6)
return "KotOR 2 Anniversary";
else
return "No event";
}
function getBlurbHtml(day) {
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const kotor1ReleaseDate = new Date("2003-07-15").getFullYear(); const kotor1ReleaseDate = new Date("2003-07-15").getFullYear();
const kotor2ReleaseDate = new Date("2004-12-06").getFullYear(); const kotor2ReleaseDate = new Date("2004-12-06").getFullYear();
const kotor1Anniversary = currentYear - kotor1ReleaseDate; const kotor1Anniversary = currentYear - kotor1ReleaseDate;
const kotor2Anniversary = currentYear - kotor2ReleaseDate; const kotor2Anniversary = currentYear - kotor2ReleaseDate;
switch (day) { if (month === 7 && day === 15)
case "KotOR 1 Anniversary": return `
return ` Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite>
Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite> `;
`; else if (month === 12 && day === 6)
break; return `
case "KotOR 2 Anniversary": Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</cite>
return ` `;
Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</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 == 7 && day == 15)
return "KotOR 1 Anniversary";
else if (month == 12 && day == 6)
return "KotOR 2 Anniversary";
else
return "No event";
}
function getBlurbHtml(day) {
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const kotor1ReleaseDate = new Date("2003-07-15").getFullYear(); const kotor1ReleaseDate = new Date("2003-07-15").getFullYear();
const kotor2ReleaseDate = new Date("2004-12-06").getFullYear(); const kotor2ReleaseDate = new Date("2004-12-06").getFullYear();
const kotor1Anniversary = currentYear - kotor1ReleaseDate; const kotor1Anniversary = currentYear - kotor1ReleaseDate;
const kotor2Anniversary = currentYear - kotor2ReleaseDate; const kotor2Anniversary = currentYear - kotor2ReleaseDate;
switch (day) { if (month === 7 && day === 15)
case "KotOR 1 Anniversary": return `
return ` Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite>
Today is the ${kotor1Anniversary}-year anniversary of the release of <cite>Star Wars: Knihgts of the Old Republic</cite> `;
`; else if (month === 12 && day === 6)
break; return `
case "KotOR 2 Anniversary": Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</cite>
return ` `;
Today is the ${kotor2Anniversary}-year anniversary of the release of <cite>Star Wars: Knights of the Old Republic II — The Sith Lords</cite> else
`; return null;
break;
default:
return ``;
}
} }
{% endblock %} {% endblock %}