diff options
author | June McEnroe <june@causal.agency> | 2020-07-10 10:22:54 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-07-10 10:22:54 -0400 |
commit | 046ec8d7e528dbef753e7b19ab4b38756c81cdca (patch) | |
tree | 04ed66c6e16d01f7bfa5f3f2deaebeff7871de03 /html.c | |
parent | Serve stylesheet separately, with caching (diff) | |
download | scooper-046ec8d7e528dbef753e7b19ab4b38756c81cdca.tar.gz scooper-046ec8d7e528dbef753e7b19ab4b38756c81cdca.zip |
Fold search form into nav
CSS is kind of almost working for me here. I await its inevitable betrayal.
Diffstat (limited to '')
-rw-r--r-- | html.c | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/html.c b/html.c index dbc6631..af1ffb2 100644 --- a/html.c +++ b/html.c @@ -40,6 +40,13 @@ enum kcgi_err htmlHead(struct khtmlreq *html, const char *title) { || khtml_closeelem(html, 1); } +static const char *SyntaxURL = { + "https://www.sqlite.org/fts5.html#full_text_query_syntax" +}; +static const char *Columns = { + "network, channel, query, nick, user, target, message" +}; + enum kcgi_err htmlNav(struct khtmlreq *html, const char *network, const char *context) { enum kcgi_err error = 0 @@ -82,40 +89,20 @@ htmlNav(struct khtmlreq *html, const char *network, const char *context) { if (error) return error; } - return khtml_closeelem(html, 2); -} - -static const char *SyntaxURL = { - "https://www.sqlite.org/fts5.html#full_text_query_syntax" -}; - -static const char *Columns = { - "network, channel, query, nick, user, target, message" -}; - -enum kcgi_err -htmlSearch(struct khtmlreq *html, const char *network, const char *context) { char label[256]; snprintf( label, sizeof(label), "Search%s%s", (network ? " " : ""), (context ? context : network ? network : "") ); - enum kcgi_err error = 0 + error = 0 + || khtml_closeelem(html, 1) || khtml_attr( html, KELEM_FORM, KATTR_METHOD, "get", KATTR_ACTION, Pages[Search], KATTR__MAX ) - || khtml_attr(html, KELEM_A, KATTR_HREF, SyntaxURL, KATTR__MAX) - || khtml_puts(html, "Syntax") - || khtml_closeelem(html, 1) - || khtml_putc(html, ' ') - || khtml_attr(html, KELEM_SPAN, KATTR_TITLE, Columns, KATTR__MAX) - || khtml_puts(html, "Columns") - || khtml_closeelem(html, 1) - || khtml_putc(html, ' ') || khtml_attr( html, KELEM_INPUT, KATTR_TYPE, "search", @@ -127,7 +114,15 @@ htmlSearch(struct khtmlreq *html, const char *network, const char *context) { KATTR_TYPE, "submit", KATTR_VALUE, label, KATTR__MAX - ); + ) + || khtml_putc(html, ' ') + || khtml_attr(html, KELEM_A, KATTR_HREF, SyntaxURL, KATTR__MAX) + || khtml_puts(html, "Syntax") + || khtml_closeelem(html, 1) + || khtml_putc(html, ' ') + || khtml_attr(html, KELEM_SPAN, KATTR_TITLE, Columns, KATTR__MAX) + || khtml_puts(html, "Columns") + || khtml_closeelem(html, 1); if (error) return error; if (network) { @@ -152,5 +147,5 @@ htmlSearch(struct khtmlreq *html, const char *network, const char *context) { if (error) return error; } - return khtml_closeelem(html, 1); + return khtml_closeelem(html, 2); } |