Modularize frontend app script

This commit is contained in:
2026-02-03 01:47:53 +01:00
parent e4402c08d5
commit 8db4670f11
6 changed files with 1044 additions and 1035 deletions

11
wwwroot/js/dom.js Normal file
View File

@@ -0,0 +1,11 @@
export const $ = (id) => document.getElementById(id);
const toastEl = typeof document !== "undefined" ? document.getElementById("toast") : null;
export function toast(msg, isError = false) {
if (!toastEl) return;
toastEl.textContent = msg;
toastEl.classList.remove("hidden");
toastEl.classList.toggle("error", isError);
setTimeout(() => toastEl.classList.add("hidden"), 2000);
}