/* ------ STAR WARS KOTOR SHRINE HEADER COMPONENT ------ */ const header = document.querySelector(".main-header"); header.innerHTML = loadHeader(); function loadHeader() { const headerTopBar = `
`; const headerImg = ``; const todayEvent = getTodayEvent(); if (todayEvent == "No event") { return headerImg; } else { return headerTopBar + headerImg; }; } const todayEvent = getTodayEvent(); const headerTopBarEl = document.querySelector(".main-header__top-bar"); if (todayEvent != "No event") { headerTopBarEl.innerHTML = getBlurbHtml(todayEvent); }; function getTodayEvent() { const date = new Date(); const month = date.getMonth() + 1; const day = date.getDate(); if (month == 7 && day == 16) return "KotOR 1 Anniversary"; else if (month == 12 && day == 6) return "KotOR 2 Anniversary"; else return "No event"; } function getBlurbHtml(day) { switch (day) { case "KotOR 1 Anniversary": return ` Today is the anniversary of the release of Star Wars: Knihgts of the Old Republic `; break; case "KotOR 2 Anniversary": return ` Today is the anniversary of the release of Star Wars: Knights of the Old Republic II — The Sith Lords `; break; default: return ``; } } /* Navigation component content */ document.querySelector(".navbar").innerHTML = ` `; // Make the navigation bar sticky const navbar = document.querySelector(".navbar"); window.addEventListener("scroll", e => { const scrollPos = window.scrollY || document.documentElement.scrollTop; const stickyLine = header.scrollHeight - navbar.scrollHeight; if (scrollPos > stickyLine) { navbar.classList.add("sticky-nav"); } else { navbar.classList.remove("sticky-nav"); } }); /* ------ STAR WARS KOTOR SHRINE SIDEBAR COMPONENT ------ */ // document.querySelector(".right-sidebar").innerHTML = ` // `; /* ------ STAR WARS KOTOR SHRINE FOOTER COMPONENT ------ */ document.querySelector(".main-footer").innerHTML = `Made with ♥ and the Force by Leilukin | Shrine Launched: 17 February 2023
`;