aboutsummaryrefslogtreecommitdiff
path: root/frontend/start.ts
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/start.ts')
-rw-r--r--frontend/start.ts25
1 files changed, 8 insertions, 17 deletions
diff --git a/frontend/start.ts b/frontend/start.ts
index 5e006de..c7d50d2 100644
--- a/frontend/start.ts
+++ b/frontend/start.ts
@@ -7,43 +7,35 @@ export function section_info_start() {
e("h1", {}, "Fastbangs"),
e("p", {}, `
This application provides a way to (mostly) locally handle search bangs. To use it:
- `),
- e("ul", {},
- e("li", {}, "Select a fallback search engine, used when a search doesn't contain a bang"),
- e("li", {}, "Add this search engine to your browser, or bookmark this page"),
+ `),
+ e("ul", {},
+ e("li", {}, "Select a fallback search engine, used when a search doesn't contain a bang"),
+ e("li", {}, "Add this search engine to your browser, or bookmark this page"),
),
- e("a", { href: "#~submit" }, "Propose or change a bang"),
+ e("span", {}, "Can't find a search engine? "), e("a", { href: "#~submit" }, "Propose or change a bang."),
)
}
export function section_engine_select() {
- const section = document.createElement("section")
- section.classList.add("engine-select")
-
const select = async (e: string) => {
const engine = e.toLowerCase();
if (!(await bangs)[engine]) return status("error", `Engine ${JSON.stringify(e)} does not exist.`)
window.location.hash = `#${e}`
}
- const heading = document.createElement("h2")
- heading.textContent = "Select a search engine"
-
- const listing = document.createElement("ul")
+ const listing = e("ul", {})
bangs.then(bangs => {
for (const key in bangs) if (bangs[key]!.pinned) {
listing.prepend(e("li", { class: "pinned", onclick: () => select(key) }, bangs[key]!.name ?? key))
}
})
- const input = document.createElement("input")
- input.type = "input"
+ const input = e("input", {type: "text"})
input.addEventListener("keydown", ev => {
if (ev.code == "Enter") select(input.value)
})
- const submit = document.createElement("button")
- submit.textContent = "Select"
+ const submit = e("button", {}, "Select")
submit.addEventListener("click", () => select(input.value))
listing.append(e("li", {},
@@ -52,7 +44,6 @@ export function section_engine_select() {
submit
))
- section.append(heading, listing)
return e("section", { class: "engine-select" },
e("h2", {}, "Select a search engine"),
listing