diff --git a/js/main-components.js b/js/main-components.js index 3833b11b..5d6a107a 100644 --- a/js/main-components.js +++ b/js/main-components.js @@ -19,20 +19,18 @@ function loadHeader() { }; } -document.addEventListener('DOMContentLoaded', () => { - const todayEvent = getTodayEvent(); - const headerTopBarEl = document.querySelector(".main-header__top-bar"); - const headerImgEl = document.querySelector(".main-header__img"); +const todayEvent = getTodayEvent(); +const headerTopBarEl = document.querySelector(".main-header__top-bar"); +const headerImgEl = document.querySelector(".main-header__img"); - if (todayEvent != "No event") { - if (todayEvent == "Leilukin's Birthday" || todayEvent == "Leilukin's Hub Anniversary") { - headerTopBarEl.innerHTML = getBlurbHtml(todayEvent); - } else { - headerImgEl.classList.add(getBanner(todayEvent)); - headerTopBarEl.innerHTML = getBlurbHtml(todayEvent); - } - }; -}); +if (todayEvent != "No event") { + if (todayEvent == "Leilukin's Birthday" || todayEvent == "Leilukin's Hub Anniversary") { + headerTopBarEl.innerHTML = getBlurbHtml(todayEvent); + } else { + headerImgEl.classList.add(getBanner(todayEvent)); + headerTopBarEl.innerHTML = getBlurbHtml(todayEvent); + } +}; function getTodayEvent() { const date = new Date(); @@ -192,7 +190,6 @@ function getBlurbHtml(day) { } - /* ------ MAIN NAVIGATION BAR COMPONENT ------ */ document.querySelector(".navbar").innerHTML = `