mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-23 04:45:34 +00:00
Fix search autofocus
This commit is contained in:
parent
c25aa507d3
commit
06945f433b
|
@ -61,14 +61,16 @@ proc genCheckbox*(pref, label: string; state: bool): VNode =
|
|||
else: input(name=pref, `type`="checkbox")
|
||||
span(class="checkbox")
|
||||
|
||||
proc genInput*(pref, label, state, placeholder: string; class=""; autofocus=false): VNode =
|
||||
proc genInput*(pref, label, state, placeholder: string; class=""): VNode =
|
||||
let s = xmltree.escape(state)
|
||||
let p = xmltree.escape(placeholder)
|
||||
let a = if autofocus: "autofocus" else: ""
|
||||
buildHtml(tdiv(class=("pref-group pref-input " & class))):
|
||||
if label.len > 0:
|
||||
label(`for`=pref): text label
|
||||
input(name=pref, `type`="text", placeholder=p, value=s): text a
|
||||
if s.len == 0:
|
||||
input(name=pref, `type`="text", placeholder=p, value=s, autofocus="")
|
||||
else:
|
||||
input(name=pref, `type`="text", placeholder=p, value=s)
|
||||
|
||||
proc genSelect*(pref, label, state: string; options: seq[string]): VNode =
|
||||
buildHtml(tdiv(class="pref-group pref-input")):
|
||||
|
|
|
@ -58,8 +58,7 @@ proc renderSearchPanel*(query: Query): VNode =
|
|||
let action = if user.len > 0: &"/{user}/search" else: "/search"
|
||||
buildHtml(form(`method`="get", action=action, class="search-field")):
|
||||
hiddenField("f", "tweets")
|
||||
genInput("q", "", query.text, "Enter search...",
|
||||
class="pref-inline", autofocus=true)
|
||||
genInput("q", "", query.text, "Enter search...", class="pref-inline")
|
||||
button(`type`="submit"): icon "search"
|
||||
if isPanelOpen(query):
|
||||
input(id="search-panel-toggle", `type`="checkbox", checked="")
|
||||
|
@ -110,8 +109,7 @@ proc renderUserSearch*(results: Result[Profile]; prefs: Prefs): VNode =
|
|||
tdiv(class="timeline-header"):
|
||||
form(`method`="get", action="/search", class="search-field"):
|
||||
hiddenField("f", "users")
|
||||
genInput("q", "", results.query.text, "Enter username...",
|
||||
class="pref-inline", autofocus=true)
|
||||
genInput("q", "", results.query.text, "Enter username...", class="pref-inline")
|
||||
button(`type`="submit"): icon "search"
|
||||
|
||||
renderSearchTabs(results.query)
|
||||
|
|
Loading…
Reference in a new issue