aboutsummaryrefslogtreecommitdiff
path: root/frontend/helper.ts
diff options
context:
space:
mode:
authorLia Lenckowski <lialenck@protonmail.com>2023-08-17 15:15:12 +0200
committerLia Lenckowski <lialenck@protonmail.com>2023-08-17 15:15:12 +0200
commit4fd80f9e24f561bd22f907621dd8901e653f1d25 (patch)
tree239c38b2f6d0c070d9c4735fdd53724ac62e8269 /frontend/helper.ts
parentd5ef112748f6b3c7999a6335da2026e4d60f3eb9 (diff)
downloadfastbangs-4fd80f9e24f561bd22f907621dd8901e653f1d25.tar
fastbangs-4fd80f9e24f561bd22f907621dd8901e653f1d25.tar.bz2
fastbangs-4fd80f9e24f561bd22f907621dd8901e653f1d25.tar.zst
add admin login modal
Diffstat (limited to 'frontend/helper.ts')
-rw-r--r--frontend/helper.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/frontend/helper.ts b/frontend/helper.ts
index 8453a18..879d322 100644
--- a/frontend/helper.ts
+++ b/frontend/helper.ts
@@ -9,6 +9,8 @@ interface Opts<E> {
for?: string,
type?: string,
href?: string,
+ method?: string,
+ placeholder?: string,
onclick?: (e: E) => void,
onchange?: (e: E) => void,
}
@@ -20,9 +22,11 @@ function apply_opts<E extends HTMLElement>(e: E, o: Opts<E>) {
// TODO can we do this properly?
if (o.for) (e as unknown as HTMLLabelElement).htmlFor = o.for
if (o.type && (e instanceof HTMLInputElement || e instanceof HTMLLinkElement)) e.type = o.type
+ if (o.placeholder && (e instanceof HTMLInputElement)) e.placeholder = o.placeholder
if (o.href && (e instanceof HTMLAnchorElement || e instanceof HTMLLinkElement)) e.href = o.href
if (o.rel && (e instanceof HTMLAnchorElement || e instanceof HTMLLinkElement)) e.rel = o.rel
if (o.title && (e instanceof HTMLAnchorElement || e instanceof HTMLLinkElement)) e.title = o.title
+ if (o.method && (e instanceof HTMLFormElement)) e.method = o.method
if (typeof o?.class == "string") e.classList.add(o.class)
if (typeof o?.class == "object") e.classList.add(...o.class)
}