From 1f6eacb77c39a7e53acb43b032c4bf3f5de03505 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Fri, 10 Jul 2020 11:00:04 -0400 Subject: Move search help to footer --- contexts.c | 4 +++- default.css | 10 ++++++++-- events.c | 4 +++- html.c | 41 +++++++++++++++++++++++++++-------------- networks.c | 4 +++- server.h | 1 + 6 files changed, 45 insertions(+), 19 deletions(-) diff --git a/contexts.c b/contexts.c index b81c515..77774ae 100644 --- a/contexts.c +++ b/contexts.c @@ -107,5 +107,7 @@ enum kcgi_err pageContexts(struct kreq *req) { if (result != SQLITE_DONE) errx(EX_SOFTWARE, "%s", sqlite3_errmsg(db)); sqlite3_reset(stmt.contexts); - return error || khtml_close(&html); + return error + || htmlFooter(&html) + || khtml_close(&html); } diff --git a/default.css b/default.css index 5ed641e..449132f 100644 --- a/default.css +++ b/default.css @@ -21,7 +21,7 @@ nav { } nav ol { - margin: 1em 0 0; + margin: 1em 1ch 0 0; padding: 0; list-style-type: none; } @@ -35,7 +35,13 @@ nav ol li::before { nav form { margin-top: 1em; } -nav form span[title] { + +footer { + display: flex; + flex-wrap: wrap; + justify-content: space-between; +} +footer span[title] { text-decoration: underline; text-decoration-style: dotted; cursor: help; diff --git a/events.c b/events.c index deedc59..7962ab3 100644 --- a/events.c +++ b/events.c @@ -131,5 +131,7 @@ enum kcgi_err pageEvents(struct kreq *req) { if (result != SQLITE_DONE) errx(EX_SOFTWARE, "%s", sqlite3_errmsg(db)); sqlite3_reset(events); - return error || khtml_close(&html); + return error + || htmlFooter(&html) + || khtml_close(&html); } diff --git a/html.c b/html.c index 35b9d82..6141514 100644 --- a/html.c +++ b/html.c @@ -46,13 +46,6 @@ 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 @@ -121,13 +114,6 @@ htmlNav(struct khtmlreq *html, const char *network, const char *context) { 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; @@ -155,3 +141,30 @@ htmlNav(struct khtmlreq *html, const char *network, const char *context) { return khtml_closeelem(html, 2); } + +static const char *SourceURL = "https://git.causal.agency/scooper"; +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 htmlFooter(struct khtmlreq *html) { + return 0 + || khtml_closeto(html, 0) + || khtml_elem(html, KELEM_FOOTER) + || khtml_elem(html, KELEM_SPAN) + || khtml_attr(html, KELEM_A, KATTR_HREF, SourceURL, KATTR__MAX) + || khtml_puts(html, "scooper is AGPLv3+") + || khtml_closeelem(html, 2) + || khtml_putc(html, ' ') + || khtml_elem(html, KELEM_SPAN) + || khtml_attr(html, KELEM_A, KATTR_HREF, SyntaxURL, KATTR__MAX) + || khtml_puts(html, "Search syntax") + || khtml_closeelem(html, 1) + || khtml_putc(html, ' ') + || khtml_attr(html, KELEM_SPAN, KATTR_TITLE, Columns, KATTR__MAX) + || khtml_puts(html, "Columns") + || khtml_closeto(html, 0); +} diff --git a/networks.c b/networks.c index d1e292d..f397bab 100644 --- a/networks.c +++ b/networks.c @@ -96,5 +96,7 @@ enum kcgi_err pageNetworks(struct kreq *req) { if (result != SQLITE_DONE) errx(EX_SOFTWARE, "%s", sqlite3_errmsg(db)); sqlite3_reset(stmt.networks); - return error || khtml_close(&html); + return error + || htmlFooter(&html) + || khtml_close(&html); } diff --git a/server.h b/server.h index d07631e..5d37176 100644 --- a/server.h +++ b/server.h @@ -141,3 +141,4 @@ enum kcgi_err htmlHead(struct khtmlreq *html, const char *title); enum kcgi_err htmlNav( struct khtmlreq *html, const char *network, const char *context ); +enum kcgi_err htmlFooter(struct khtmlreq *html); -- cgit 1.4.1