/// import { load_bangs, process_query } from "./query.ts"; import { add_page_content } from "./ui.ts" globalThis.addEventListener("hashchange", () => process_url()) globalThis.addEventListener("load", () => { load_bangs() // not awaiting so we can continue loading process_url() }) function process_url() { if (document.location.hash.length != 0) { const input = document.location.hash.substring(1) const [default_engine, query_encoded] = input.split("#") if (query_encoded) { const query = decodeURIComponent(query_encoded.replaceAll("+", " ")) process_query(default_engine, query) } else { return add_page_content(default_engine) } } else { add_page_content() } }