leilukin-site/assets/js/Jn9ER2813k.js

155 lines
6.6 KiB
JavaScript
Raw Permalink Normal View History

const statusCafeContent = document.getElementById("statuscafe-content");
statusCafeContent.innerHTML = `
<p>Fetching data from status.cafe...</p>
`;
const fetchStatusCafe = async () => {
try {
const res = await fetch('https://status.cafe/users/leilukin/status.json');
const data = await res.json();
if (!data.content.length) {
document.getElementById("statuscafe-content").innerHTML = "No status yet."
return;
}
document.getElementById("statuscafe-userinfo").innerHTML = data.face + ' ' + data.timeAgo;
statusCafeContent.innerHTML = data.content;
} catch (error) {
console.error(error);
document.getElementById("statuscafe-content").textContent = `[ERROR] ${error}`;
}
};
fetchStatusCafe();
const hero = document.querySelector(".hero");
const heroTopBarEl = document.querySelector(".hero__top-bar");
const headerImgEl = document.querySelector(".hero__img");
const todayEvent = getTodayEvent();
if (todayEvent) {
heroTopBarEl.classList.remove('hidden');
heroTopBarEl.innerHTML = todayEvent.blurb;
if (todayEvent.class) {
headerImgEl.classList.add(todayEvent.class);
}
}
function getTodayEvent() {
const date = new Date();
const month = date.getMonth() + 1;
const day = date.getDate();
const year = date.getFullYear();
const weekOfMonth = Math.ceil(day / 7);
const leilukinsHubLaunchDate = new Date("2022-09-11").getFullYear();
const siteAnniversary = year - leilukinsHubLaunchDate;
if (month === 3 && day === 1)
return {
blurb: `Today is <a href="https://www.unaids.org/en/zero-discrimination-day">Zero Discrimination Day</a>`,
class: "flag-progress-intersex",
};
else if (month === 3 && day === 8)
return {
blurb: `Today is <a href="https://www.internationalwomensday.com/">International Women's Day}</a>`,
class: "symbol-venus",
};
else if (month === 3 && day === 31)
return {
blurb: `Today is <a href="https://www.manygendersonevoice.org/tdov.html">Trans Day of Visibility</a>`,
class: "flag-trans",
};
else if (month === 4 && day === 6)
return {
blurb: `Today is <a href="https://internationalasexualityday.org/en">International Asexuality Day</a>`,
class: "flag-ace",
};
else if (month === 4 && day === 26)
return {
blurb: `Today is <a href="https://www.lesbianvisibilityweek.com">Lesbian Visibility Day</a>`,
class: "flag-lesbian",
};
else if (month === 4 && weekOfMonth === 4)
return {
blurb: `This week is <a href="https://www.lesbianvisibilityweek.com">Lesbian Visibility Week</a>`,
class: "flag-lesbian",
};
else if (month === 5 && day === 17)
return {
blurb: `Today is <a href="https://may17.org">International Day Against Homophobia, Biphobia and Transphobia</a>`,
class: "flag-progress",
};
else if (month === 5 && day === 19)
return {
blurb: `Today is <a href="https://www.believeoutloud.com/voices/article/agender-pride-day/">Agender Pride Day</a>`,
class: "flag-agender",
};
else if (month === 5 && day === 25)
return {
blurb: `Today is <a href="https://www.papyrus-uk.org/pan-visibility-day/">Pansexual and Panromantic Awareness and Visibility Day</a>`,
class: "flag-pan",
};
else if (month === 6)
return {
blurb: `Happy <a href="https://www.loc.gov/lgbt-pride-month/about/">Pride Month</a>!`,
class: "flag-progress-intersex",
};
else if (month === 7 && day === 14)
return {
blurb: `Today is <a href="https://www.manygendersonevoice.org/non-binary-peoples-day.html">Non-Binary People's Day</a>`,
class: "flag-non-binary",
};
else if (month === 7 && day === 28)
return {
blurb: `Today is Leilukin's Birthday`
};
else if (month === 7)
return{
blurb: `Happy <a href="https://www.weareincludability.co.uk/resources/what-is-disability-pride-month">Disability Pride Month</a>!`,
class: "flag-disability"
}
else if (month === 8 && day === 25)
return {
blurb: `Today is <a href="https://aromanticspectrumday.net/">Aromantic Spectrum Visibility Day</a>`,
class: "flag-aro",
};
else if (month === 9 && day === 11)
return {
blurb: `Today is the ${siteAnniversary}-year anniversary of the launch of Leilukin&#39;s Hub`
};
else if (month === 9 && day === 23)
return {
blurb: `Today is <a href="https://bivisibilityday.com/about">Bi Visibility Day</a>`,
class: "flag-bi",
};
else if (month === 10 && day === 8)
return {
blurb: `Today is <a href="https://www.lgbtiqhealth.org.au/international_lesbian_day2">International Lesbian Day</a>`,
class: "flag-lesbian",
};
else if (month === 10 && day === 11)
return {
blurb: `Today is <a href="https://www.hrc.org/resources/national-coming-out-day">National Coming Out Day</a>`,
class: "flag-rainbow",
};
else if (month === 10 && day === 17)
return {
blurb: `Today is the start of <a href="https://www.grlgbtqhealthcareconsortium.org/significantdates/genderfluid-visibility-week">Genderfluid Visibility Week</a>`,
class: "flag-genderfluid",
};
else if (month === 10 && day === 26)
return {
blurb: `Today is <a href="https://interactadvocates.org/intersex-awareness-day">Intersex Awareness Day</a>`,
class: "flag-intersex",
};
else if (month === 11 && day === 13)
return {
blurb: `Today is the start of <a href="https://glaad.org/transweek/">Transgender Awareness Week</a>`,
class: "flag-trans",
};
else
return null;
}