commit 1359a56
default
·
2023-11-25 09:10:38 +0000 UTC
parent 29010d6
Got rid of old html_button().
1 files changed,
+19,
-30
M
html.c
M
html.c
+19,
-30
1@@ -944,18 +944,7 @@ xs_str *html_top_controls(snac *snac, xs_str *s)
2 }
3
4
5-static xs_str *html_button(xs_str *s, const char *clss, const char *label, const char *hint)
6-{
7- xs *s1 = xs_fmt(
8- "<input type=\"submit\" name=\"action\" "
9- "class=\"snac-btn-%s\" value=\"%s\" title=\"%s\">\n",
10- clss, label, hint);
11-
12- return xs_str_cat(s, s1);
13-}
14-
15-
16-static xs_html *html_button_2(char *clss, char *label, char *hint)
17+static xs_html *html_button(char *clss, char *label, char *hint)
18 {
19 xs *c = xs_fmt("snac-btn-%s", clss);
20
21@@ -1058,23 +1047,23 @@ xs_html *html_entry_controls(snac *snac, const xs_dict *msg, const char *md5)
22 if (xs_list_in(likes, snac->md5) == -1) {
23 /* not already liked; add button */
24 xs_html_add(form,
25- html_button_2("like", L("Like"), L("Say you like this post")));
26+ html_button("like", L("Like"), L("Say you like this post")));
27 }
28 }
29 else {
30 if (is_pinned(snac, id))
31 xs_html_add(form,
32- html_button_2("unpin", L("Unpin"), L("Unpin this post from your timeline")));
33+ html_button("unpin", L("Unpin"), L("Unpin this post from your timeline")));
34 else
35 xs_html_add(form,
36- html_button_2("pin", L("Pin"), L("Pin this post to the top of your timeline")));
37+ html_button("pin", L("Pin"), L("Pin this post to the top of your timeline")));
38 }
39
40 if (is_msg_public(msg)) {
41 if (strcmp(actor, snac->actor) == 0 || xs_list_in(boosts, snac->md5) == -1) {
42 /* not already boosted or us; add button */
43 xs_html_add(form,
44- html_button_2("boost", L("Boost"), L("Announce this post to your followers")));
45+ html_button("boost", L("Boost"), L("Announce this post to your followers")));
46 }
47 }
48
49@@ -1082,34 +1071,34 @@ xs_html *html_entry_controls(snac *snac, const xs_dict *msg, const char *md5)
50 /* controls for other actors than this one */
51 if (following_check(snac, actor)) {
52 xs_html_add(form,
53- html_button_2("unfollow", L("Unfollow"), L("Stop following this user's activity")));
54+ html_button("unfollow", L("Unfollow"), L("Stop following this user's activity")));
55 }
56 else {
57 xs_html_add(form,
58- html_button_2("follow", L("Follow"), L("Start following this user's activity")));
59+ html_button("follow", L("Follow"), L("Start following this user's activity")));
60 }
61
62 if (!xs_is_null(group)) {
63 if (following_check(snac, group)) {
64 xs_html_add(form,
65- html_button_2("unfollow", L("Unfollow Group"),
66+ html_button("unfollow", L("Unfollow Group"),
67 L("Stop following this group or channel")));
68 }
69 else {
70 xs_html_add(form,
71- html_button_2("follow", L("Follow Group"),
72+ html_button("follow", L("Follow Group"),
73 L("Start following this group or channel")));
74 }
75 }
76
77 xs_html_add(form,
78- html_button_2("mute", L("MUTE"),
79+ html_button("mute", L("MUTE"),
80 L("Block any activity from this user forever")));
81 }
82
83 xs_html_add(form,
84- html_button_2("delete", L("Delete"), L("Delete this post")),
85- html_button_2("hide", L("Hide"), L("Hide this post and its children")));
86+ html_button("delete", L("Delete"), L("Delete this post")),
87+ html_button("hide", L("Hide"), L("Hide this post and its children")));
88
89 char *prev_src = xs_dict_get(msg, "sourceContent");
90
91@@ -1894,35 +1883,35 @@ xs_html *html_people_list(snac *snac, xs_list *list, char *header, char *t)
92
93 if (following_check(snac, actor_id)) {
94 xs_html_add(form,
95- html_button_2("unfollow", L("Unfollow"),
96+ html_button("unfollow", L("Unfollow"),
97 L("Stop following this user's activity")));
98
99 if (is_limited(snac, actor_id))
100 xs_html_add(form,
101- html_button_2("unlimit", L("Unlimit"),
102+ html_button("unlimit", L("Unlimit"),
103 L("Allow announces (boosts) from this user")));
104 else
105 xs_html_add(form,
106- html_button_2("limit", L("Limit"),
107+ html_button("limit", L("Limit"),
108 L("Block announces (boosts) from this user")));
109 }
110 else {
111 xs_html_add(form,
112- html_button_2("follow", L("Follow"),
113+ html_button("follow", L("Follow"),
114 L("Start following this user's activity")));
115
116 if (follower_check(snac, actor_id))
117 xs_html_add(form,
118- html_button_2("delete", L("Delete"), L("Delete this user")));
119+ html_button("delete", L("Delete"), L("Delete this user")));
120 }
121
122 if (is_muted(snac, actor_id))
123 xs_html_add(form,
124- html_button_2("unmute", L("Unmute"),
125+ html_button("unmute", L("Unmute"),
126 L("Stop blocking activities from this user")));
127 else
128 xs_html_add(form,
129- html_button_2("mute", L("MUTE"),
130+ html_button("mute", L("MUTE"),
131 L("Block any activity from this user")));
132
133 /* the post textarea */