summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--html.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/html.c b/html.c
index 536879c..bd3179d 100644
--- a/html.c
+++ b/html.c
@@ -509,7 +509,7 @@ xs_html *html_instance_head(void)
509} 509}
510 510
511 511
512static xs_html *html_instance_body(char *tag) 512static xs_html *html_instance_body(char *title)
513{ 513{
514 char *host = xs_dict_get(srv_config, "host"); 514 char *host = xs_dict_get(srv_config, "host");
515 char *sdesc = xs_dict_get(srv_config, "short_description"); 515 char *sdesc = xs_dict_get(srv_config, "short_description");
@@ -560,14 +560,11 @@ static xs_html *html_instance_body(char *tag)
560 xs_html_text(handle))))); 560 xs_html_text(handle)))));
561 } 561 }
562 562
563 { 563 if (title != NULL) {
564 xs *l = tag ? xs_fmt(L("Search results for #%s"), tag) :
565 xs_dup(L("Recent posts by users in this instance"));
566
567 xs_html_add(body, 564 xs_html_add(body,
568 xs_html_tag("h2", 565 xs_html_tag("h2",
569 xs_html_attr("class", "snac-header"), 566 xs_html_attr("class", "snac-header"),
570 xs_html_text(l))); 567 xs_html_text(title)));
571 } 568 }
572 569
573 return body; 570 return body;
@@ -1996,7 +1993,7 @@ xs_html *html_footer(void)
1996 1993
1997xs_str *html_timeline(snac *user, const xs_list *list, int read_only, 1994xs_str *html_timeline(snac *user, const xs_list *list, int read_only,
1998 int skip, int show, int show_more, 1995 int skip, int show, int show_more,
1999 char *tag, char *page, int utl) 1996 char *title, char *page, int utl)
2000/* returns the HTML for the timeline */ 1997/* returns the HTML for the timeline */
2001{ 1998{
2002 xs_list *p = (xs_list *)list; 1999 xs_list *p = (xs_list *)list;
@@ -2026,7 +2023,7 @@ xs_str *html_timeline(snac *user, const xs_list *list, int read_only,
2026 } 2023 }
2027 else { 2024 else {
2028 head = html_instance_head(); 2025 head = html_instance_head();
2029 body = html_instance_body(tag); 2026 body = html_instance_body(title);
2030 } 2027 }
2031 2028
2032 xs_html *html = xs_html_tag("html", 2029 xs_html *html = xs_html_tag("html",
@@ -2126,25 +2123,22 @@ xs_str *html_timeline(snac *user, const xs_list *list, int read_only,
2126 } 2123 }
2127 2124
2128 if (show_more) { 2125 if (show_more) {
2129 xs *t = NULL;
2130 xs *m = NULL; 2126 xs *m = NULL;
2131 xs *ss = xs_fmt("skip=%d&show=%d", skip + show, show); 2127 xs *ss = xs_fmt("skip=%d&show=%d", skip + show, show);
2132 2128
2133 xs *url = page == NULL || user == NULL ? 2129 xs *url = xs_dup(user == NULL ? srv_baseurl : user->actor);
2134 xs_dup(srv_baseurl) : xs_fmt("%s%s", user->actor, page);
2135 2130
2136 if (tag) { 2131 if (page != NULL)
2137 t = xs_fmt("%s?t=%s", url, tag); 2132 url = xs_str_cat(url, page);
2138 m = xs_fmt("%s&%s", t, ss); 2133
2139 } 2134 if (xs_str_in(url, "?") != -1)
2140 else { 2135 m = xs_fmt("%s&%s", url, ss);
2141 t = xs_dup(url); 2136 else
2142 m = xs_fmt("%s?%s", t, ss); 2137 m = xs_fmt("%s?%s", url, ss);
2143 }
2144 2138
2145 xs_html *more_links = xs_html_tag("p", 2139 xs_html *more_links = xs_html_tag("p",
2146 xs_html_tag("a", 2140 xs_html_tag("a",
2147 xs_html_attr("href", t), 2141 xs_html_attr("href", url),
2148 xs_html_attr("name", "snac-more"), 2142 xs_html_attr("name", "snac-more"),
2149 xs_html_text(L("Back to top"))), 2143 xs_html_text(L("Back to top"))),
2150 xs_html_text(" - "), 2144 xs_html_text(" - "),