1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import { e } from "./helper.ts";
import { section_info_search, section_search } from "./search.ts";
import { section_engine_select, section_info_start, section_admin_btn } from "./start.ts";
import { section_submit } from "./submit.ts";
export function add_page_content(engine?: string) {
//@ts-ignore HTMLCollectionOf is an iterator
for (const e of [...document.getElementsByTagName("section")]) e.remove()
if (engine == "~submit") document.body.append(section_submit())
else if (engine) document.body.append(section_search(engine), section_info_search())
else document.body.append(section_info_start(), section_engine_select(), footer(), section_admin_btn())
}
let status_el: HTMLElement
export function status(level: "error" | "info" | "success" | "warn", text: string) {
if (!status_el) {
status_el = document.createElement("p")
document.body.append(status_el)
}
status_el.textContent = text
status_el.classList.value = ""
status_el.classList.add("status", `level-${level}`)
}
export function footer() {
return e("footer", {},
e("p", {}, "Fastbangs is free software (AGPL-3.0-only)! Find the source code on ",
e("a", { href: "https://codeberg.org/lialenck/fastbangs" }, "Codeberg"), ".")
)
}
|