/* site.js
 * Eryn Wells <eryn@erynwells.me>
 */

window.addEventListener("DOMContentLoaded", () => {
  const siteHeader = document.querySelector("header.site");
  if (!siteHeader) {
    return;
  }
  siteHeader.classList.add("visible");

  siteHeader.addEventListener("animationend", () => {
    console.log("Animation ended");
    siteHeader.classList.add("sticky");
  }, false);

  try {
    const documentReferrer = new URL(document.referrer);
    if (documentReferrer.pathname === "/") {
      siteHeader.classList.add("animated");
    } else {
      siteHeader.classList.add("sticky");
    }
  } catch { }
});
