Web/scripts/banner.js

18 lines
997 B
JavaScript
Raw Normal View History

2021-03-21 20:20:15 +01:00
let date = new Date();
if (date.getMonth() + 1 === 6) {
setBanner("pride", "It's Pride Month! Consider donating to charities like The Trevor Project.", "https://www.thetrevorproject.org/");
} else if (date.getMonth() + 1 === 2) {
setBanner("blm", "It's Black History Month! Consider donating to charities like Black Lives Matter.", "https://blacklivesmatter.com/");
2021-04-10 20:13:37 +02:00
} else if (date.getMonth() + 1 === 3) {
setBanner("women", "It's Women's History Month! Consider donating to charities like the Global Fund for Women.", "https://www.globalfundforwomen.org/");
2021-03-24 19:36:31 +01:00
} else if (date.getMonth() + 1 === 4 && date.getDate() <= 4) {
2021-03-21 20:20:15 +01:00
setBanner("autism", "It's Autism Awareness Week! Consider donating to charities like the ASAN.", "https://autisticadvocacy.org/");
}
function setBanner(name, desc, link) {
let banner = $("#banner");
2021-03-24 19:36:12 +01:00
banner.html(desc);
2021-03-21 20:20:15 +01:00
banner.prop("href", link);
banner.css("background-image", `url(${loc}/res/${name}.png)`);
banner.removeAttr("hidden");
}