diff options
Diffstat (limited to 'frontend/search.ts')
-rw-r--r-- | frontend/search.ts | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/frontend/search.ts b/frontend/search.ts index 374cccf..1d28f58 100644 --- a/frontend/search.ts +++ b/frontend/search.ts @@ -19,18 +19,15 @@ export function section_search(engine: string) { } }) - const heading = document.createElement("h1") - heading.textContent = engine + const heading = e("h1", {}, engine) bangs.then(bangs => heading.textContent = bangs[engine]?.name ?? engine) - const input = document.createElement("input") - input.type = "input" + const input = e("input", {type: "text"}) input.addEventListener("keydown", ev => { if (ev.code == "Enter") process_query(engine, input.value ?? "") }) - const submit = document.createElement("button") - submit.textContent = "Search" + const submit = e("button", {}, "Search") submit.addEventListener("click", () => { process_query(engine, input.value ?? "") }) @@ -49,11 +46,11 @@ function link_engine(engine: string) { // <link /> is already present, we need reload because browser wont notice otherwise window.location.reload() } - const link = document.createElement("link") - link.rel = "search" - link.id = "search-link" - link.type = "application/opensearchdescription+xml" - link.href = `/search.xml?default=${encodeURIComponent(engine)}` - link.title = `Fastbangs (default engine: ${engine})` + const link = e("link", { + rel: "search", + id: "search-link", + type: "application/opensearchdescription+xml", + href: `/search.xml?default=${encodeURIComponent(engine)}`, + title: `Fastbangs (default engine: ${engine})`}) document.head.append(link) -}
\ No newline at end of file +} |