; (() => { var farallonHelper = class { getCookie(t) { if (0 < document.cookie.length) { var e = document.cookie.indexOf(t + "="); if (-1 != e) { e = e + t.length + 1; var n = document.cookie.indexOf(";", e); return -1 == n && (n = document.cookie.length), document.cookie.substring(e, n); } } return ""; } }; var farallonBase = class extends farallonHelper { is_single = false; post_id = 0; is_archive = false; VERSION = "0.5.0"; constructor() { super(); this.initCopyright(); this.initThemeSwitch(); this.initBack2Top(); this.initSearch(); } initSearch() { document.querySelector('[data-action="show-search"]').addEventListener("click", () => { document.querySelector(".site--header__center .inner").classList.toggle("search--active"); }); } initBack2Top() { if (document.querySelector(".backToTop")) { const backToTop = document.querySelector( ".backToTop" ); window.addEventListener("scroll", () => { const t = window.scrollY || window.pageYOffset; t > 200 ? backToTop.classList.add("is-active") : backToTop.classList.remove("is-active"); }); backToTop.addEventListener("click", () => { window.scrollTo({ top: 0, behavior: "smooth" }); }); } } initCopyright() { const copyright = ``; document.querySelector(".site--footer__content").insertAdjacentHTML("afterend", copyright); document.querySelector(".icon--copryrights").addEventListener("click", () => { document.querySelector(".site--footer__info").classList.toggle("active"); }); } initThemeSwitch() { const theme = localStorage.getItem("theme") ? localStorage.getItem("theme") : "auto"; const html = `
`; document.querySelector("body").insertAdjacentHTML("beforeend", html); document.querySelectorAll(".fixed--theme span").forEach((item) => { item.addEventListener("click", () => { if (item.classList.contains("is-active")) return; document.querySelectorAll(".fixed--theme span").forEach((item2) => { item2.classList.remove("is-active"); }); if (item.dataset.actionValue == "dark") { localStorage.setItem("theme", "dark"); document.querySelector("body").classList.remove("auto"); document.querySelector("body").classList.add("dark"); item.classList.add("is-active"); } else if (item.dataset.actionValue == "light") { localStorage.setItem("theme", "light"); document.querySelector("body").classList.remove("auto"); document.querySelector("body").classList.remove("dark"); item.classList.add("is-active"); } else if (item.dataset.actionValue == "auto") { localStorage.setItem("theme", "auto"); document.querySelector("body").classList.remove("dark"); document.querySelector("body").classList.add("auto"); item.classList.add("is-active"); } }); }); } }; new farallonBase(); })();