mirror of
https://github.com/helenclx/leilukin-site.git
synced 2025-04-12 11:02:41 +00:00
40 lines
1.5 KiB
Plaintext
40 lines
1.5 KiB
Plaintext
{% extends "global/hero.njk" %}
|
|
|
|
{% block heroImg %}
|
|
<picture>
|
|
<source srcset="/assets/shrines/starwarskotor/images/swkotor-header-320.png" media="(orientation: landscape)" />
|
|
<img src="/assets/shrines/starwarskotor/images/swkotor-header.jpg" alt="anner of Star Wars: Knights of the Old Republic Shrine" />
|
|
</picture>
|
|
{% endblock %}
|
|
|
|
{% block eventScript %}
|
|
const todayEvent = getTodayEvent();
|
|
|
|
if (todayEvent) {
|
|
heroTopBarEl.classList.remove('hidden');
|
|
heroTopBarEl.innerHTML = todayEvent;
|
|
}
|
|
|
|
function getTodayEvent() {
|
|
const date = new Date();
|
|
const month = date.getMonth() + 1;
|
|
const day = date.getDate();
|
|
|
|
const currentYear = new Date().getFullYear();
|
|
const kotor1ReleaseDate = new Date("2003-07-15").getFullYear();
|
|
const kotor2ReleaseDate = new Date("2004-12-06").getFullYear();
|
|
const kotor1Anniversary = currentYear - kotor1ReleaseDate;
|
|
const kotor2Anniversary = currentYear - kotor2ReleaseDate;
|
|
|
|
if (month === 7 && day === 15)
|
|
return `
|
|
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)
|
|
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;
|
|
}
|
|
{% endblock %} |