repos
/ finance-rust master

finance-rust

mirror archived upstream

Single-binary self-hosted market watcher for stocks, ETFs, indexes, and futures: live charts, key stats, fundamentals, SEC filings, and SSE streaming.

axumdockerfinancerustself-hostedsqlitestocksvite

702 B · 22 lines · JavaScript Raw History
 1// Annual / quarterly toggle for the financials table. Both tables are
 2// server-rendered; this just shows one and hides the other.
 3export function initFundamentals() {
 4  const tabs = document.querySelectorAll(".fin__tab");
 5  const panels = document.querySelectorAll(".fin__panel");
 6  if (!tabs.length) return;
 7
 8  tabs.forEach((tab) => {
 9    tab.addEventListener("click", () => {
10      const period = tab.dataset.period;
11      tabs.forEach((t) => {
12        const on = t === tab;
13        t.classList.toggle("is-active", on);
14        t.setAttribute("aria-selected", on ? "true" : "false");
15      });
16      panels.forEach((p) => {
17        p.hidden = p.dataset.period !== period;
18      });
19    });
20  });
21}