mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-22 05:15:04 +00:00
Simplified HTML.
This commit is contained in:
parent
86c27db435
commit
6317c9678d
1 changed files with 18 additions and 40 deletions
58
html.c
58
html.c
|
@ -371,6 +371,17 @@ d_char *html_top_controls(snac *snac, d_char *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
d_char *html_button(d_char *s, char *clss, char *label)
|
||||||
|
{
|
||||||
|
xs *s1 = xs_fmt(
|
||||||
|
"<input type=\"submit\" name=\"action\" "
|
||||||
|
"class=\"snac-btn-%s\" value=\"%s\">\n",
|
||||||
|
clss, label);
|
||||||
|
|
||||||
|
return xs_str_cat(s, s1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
d_char *html_entry_controls(snac *snac, d_char *os, char *msg)
|
d_char *html_entry_controls(snac *snac, d_char *os, char *msg)
|
||||||
{
|
{
|
||||||
char *id = xs_dict_get(msg, "id");
|
char *id = xs_dict_get(msg, "id");
|
||||||
|
@ -410,63 +421,30 @@ d_char *html_entry_controls(snac *snac, d_char *os, char *msg)
|
||||||
l = xs_dict_get(meta, "liked_by");
|
l = xs_dict_get(meta, "liked_by");
|
||||||
if (xs_list_in(l, snac->actor) == -1) {
|
if (xs_list_in(l, snac->actor) == -1) {
|
||||||
/* not already liked; add button */
|
/* not already liked; add button */
|
||||||
xs *s1 = xs_fmt(
|
s = html_button(s, "like", L("Like"));
|
||||||
"<input type=\"submit\" name=\"action\" "
|
|
||||||
"class=\"snac-btn-like\" value=\"%s\">\n",
|
|
||||||
L("Like")
|
|
||||||
);
|
|
||||||
|
|
||||||
s = xs_str_cat(s, s1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
l = xs_dict_get(meta, "announced_by");
|
l = xs_dict_get(meta, "announced_by");
|
||||||
if (xs_list_in(l, snac->actor) == -1) {
|
if (xs_list_in(l, snac->actor) == -1) {
|
||||||
/* not already boosted; add button */
|
/* not already boosted; add button */
|
||||||
xs *s1 = xs_fmt(
|
s = html_button(s, "boost", L("Boost"));
|
||||||
"<input type=\"submit\" name=\"action\" "
|
|
||||||
"class=\"snac-btn-boost\" value=\"%s\">\n",
|
|
||||||
L("Boost")
|
|
||||||
);
|
|
||||||
|
|
||||||
s = xs_str_cat(s, s1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (following_check(snac, actor)) {
|
if (following_check(snac, actor)) {
|
||||||
xs *s1 = xs_fmt(
|
s = html_button(s, "unfollow", L("Unfollow"));
|
||||||
"<input type=\"submit\" name=\"action\" "
|
|
||||||
"class=\"snac-btn-unfollow\" value=\"%s\">\n",
|
|
||||||
L("Unfollow")
|
|
||||||
);
|
|
||||||
|
|
||||||
s = xs_str_cat(s, s1);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
xs *s1 = xs_fmt(
|
s = html_button(s, "follow", L("Follow"));
|
||||||
"<input type=\"submit\" name=\"action\" "
|
s = html_button(s, "mute", L("MUTE"));
|
||||||
"class=\"snac-btn-follow\" value=\"%s\">\n"
|
|
||||||
"<input type=\"submit\" name=\"action\" "
|
|
||||||
"class=\"snac-btn-mute\" value=\"%s\">\n",
|
|
||||||
L("Follow"),
|
|
||||||
L("MUTE")
|
|
||||||
);
|
|
||||||
|
|
||||||
s = xs_str_cat(s, s1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
s = html_button(s, "delete", L("Delete"));
|
||||||
xs *s1 = xs_fmt(
|
|
||||||
"<input type=\"submit\" name=\"action\" "
|
|
||||||
"class=\"snac-btn-delete\" value=\"%s\">\n",
|
|
||||||
L("Delete")
|
|
||||||
);
|
|
||||||
|
|
||||||
s = xs_str_cat(s, s1);
|
|
||||||
}
|
|
||||||
|
|
||||||
s = xs_str_cat(s, "</form>\n");
|
s = xs_str_cat(s, "</form>\n");
|
||||||
|
|
||||||
{
|
{
|
||||||
|
/* the post textarea */
|
||||||
xs *ct = xs_str_new("");
|
xs *ct = xs_str_new("");
|
||||||
|
|
||||||
xs *s1 = xs_fmt(
|
xs *s1 = xs_fmt(
|
||||||
|
|
Loading…
Reference in a new issue