diff --git a/Makefile b/Makefile
index b44a214..f756809 100644
--- a/Makefile
+++ b/Makefile
@@ -122,6 +122,12 @@ $(PAGES_DIR)/emoji_picker.chtml: $(PAGES_DIR)/emoji_picker.html
./filec $< data_emoji_picker_html > $@
$(PAGES_DIR)/emoji.chtml: $(PAGES_DIR)/emoji.html
./filec $< data_emoji_html > $@
+$(PAGES_DIR)/likeboost.chtml: $(PAGES_DIR)/likeboost.html
+ ./filec $< data_likeboost_html > $@
+$(PAGES_DIR)/reactions_btn.chtml: $(PAGES_DIR)/reactions_btn.html
+ ./filec $< data_reactions_btn_html > $@
+$(PAGES_DIR)/interaction_buttons.chtml: $(PAGES_DIR)/interaction_buttons.html
+ ./filec $< data_interaction_buttons_html > $@
# Login panel
$(PAGES_DIR)/quick_login.chtml: $(PAGES_DIR)/quick_login.html
./filec $< data_quick_login_html > $@
diff --git a/src/status.c b/src/status.c
index 1efe2e5..0ddcf2c 100644
--- a/src/status.c
+++ b/src/status.c
@@ -42,6 +42,9 @@
#include "../static/status_interactions_label.chtml"
#include "../static/status_interactions.chtml"
#include "../static/status_interaction_profile.chtml"
+#include "../static/likeboost.chtml"
+#include "../static/reactions_btn.chtml"
+#include "../static/interaction_buttons.chtml"
#define ACCOUNT_INTERACTIONS_LIMIT 11
#define NUM_STR "%u"
@@ -172,6 +175,65 @@ char* construct_status_interactions_label(char* header, int val, size_t* size)
return html;
}
+char* construct_interaction_buttons(struct session* ssn,
+ struct mstdnt_status* status,
+ size_t* size,
+ uint8_t flags)
+{
+ char* interaction_html;
+ char* reply_count = NULL;
+ char* repeat_count = NULL;
+ char* favourites_count = NULL;
+ char* emoji_picker_html = NULL;
+ size_t s;
+
+ // Emojo picker
+ if ((flags & STATUS_EMOJI_PICKER) == STATUS_EMOJI_PICKER)
+ {
+ emoji_picker_html = construct_emoji_picker(status->id, keyint(ssn->post.emojoindex), NULL);
+ }
+
+ if (status->replies_count)
+ easprintf(&reply_count, NUM_STR, status->replies_count);
+ if (status->reblogs_count)
+ easprintf(&repeat_count, NUM_STR, status->reblogs_count);
+ if (status->favourites_count)
+ easprintf(&favourites_count, NUM_STR, status->favourites_count);
+
+ s = easprintf(&interaction_html, data_interaction_buttons_html,
+ config_url_prefix,
+ status->id,
+ status->id,
+ reply_count ? reply_count : "",
+ config_url_prefix,
+ status->id,
+ status->reblogged ? "un" : "",
+ status->reblogged ? "active" : "",
+ repeat_count ? repeat_count : "",
+ config_url_prefix,
+ status->id,
+ status->favourited ? "un" : "",
+ status->favourited ? "active" : "",
+ favourites_count ? favourites_count : "",
+ config_url_prefix,
+ status->id,
+ config_url_prefix,
+ status->id,
+ status->id,
+ emoji_picker_html ? emoji_picker_html : "",
+ config_url_prefix,
+ status->id,
+ status->id);
+ if (size) *size = s;
+
+ // Cleanup
+ if (emoji_picker_html) free(emoji_picker_html);
+ if (reply_count) free(reply_count);
+ if (repeat_count) free(repeat_count);
+ if (favourites_count) free(favourites_count);
+ return interaction_html;
+}
+
char* construct_status_interactions(int fav_count,
int reblog_count,
struct mstdnt_account* fav_accounts,
@@ -385,16 +447,13 @@ char* construct_status(struct session* ssn,
char* stat_html;
// Counts
- char* reply_count = NULL;
- char* repeat_count = NULL;
- char* favourites_count = NULL;
char* formatted_display_name = NULL;
char* attachments = NULL;
char* emoji_reactions = NULL;
+ char* interaction_btns = NULL;
char* notif_info = NULL;
char* in_reply_to_str = NULL;
char* interactions_html = NULL;
- char* emoji_picker_html = NULL;
struct mstdnt_status* status = local_status;
// Create a "fake" notification header which contains information for
// the reblogged status
@@ -409,12 +468,6 @@ char* construct_status(struct session* ssn,
if (!status) return NULL;
- // Emojo picker
- if ((flags & STATUS_EMOJI_PICKER) == STATUS_EMOJI_PICKER)
- {
- emoji_picker_html = construct_emoji_picker(status->id, keyint(ssn->post.emojoindex), NULL);
- }
-
// If focused, show status interactions
if ((flags & STATUS_FOCUSED) == STATUS_FOCUSED &&
(status->reblogs_count || status->favourites_count))
@@ -457,6 +510,8 @@ char* construct_status(struct session* ssn,
// Format status
char* parse_content = reformat_status(ssn, status->content, status->emojis, status->emojis_len);
+
+ interaction_btns = construct_interaction_buttons(ssn, status, NULL, flags);
// Find and replace
if (args && args->highlight_word)
@@ -474,12 +529,6 @@ char* construct_status(struct session* ssn,
free(repl_str);
}
- if (status->replies_count)
- easprintf(&reply_count, NUM_STR, status->replies_count);
- if (status->reblogs_count)
- easprintf(&repeat_count, NUM_STR, status->reblogs_count);
- if (status->favourites_count)
- easprintf(&favourites_count, NUM_STR, status->favourites_count);
if (status->media_attachments_len)
attachments = construct_attachments(status->sensitive, status->media_attachments, status->media_attachments_len, NULL);
if (status->pleroma.emoji_reactions_len)
@@ -524,42 +573,17 @@ char* construct_status(struct session* ssn,
attachments ? attachments : "",
interactions_html ? interactions_html : "",
emoji_reactions ? emoji_reactions : "",
- config_url_prefix,
- status->id,
- status->id,
- reply_count ? reply_count : "",
- config_url_prefix,
- status->id,
- status->reblogged ? "un" : "",
- status->reblogged ? "active" : "",
- repeat_count ? repeat_count : "",
- config_url_prefix,
- status->id,
- status->favourited ? "un" : "",
- status->favourited ? "active" : "",
- favourites_count ? favourites_count : "",
- config_url_prefix,
- status->id,
- config_url_prefix,
- status->id,
- status->id,
- emoji_picker_html ? emoji_picker_html : "",
- config_url_prefix,
- status->id,
- status->id);
+ interaction_btns);
if (size) *size = s;
// Cleanup
- if (reply_count) free(reply_count);
- if (repeat_count) free(repeat_count);
- if (favourites_count) free(favourites_count);
+ if (interaction_btns) free(interaction_btns);
if (in_reply_to_str) free(in_reply_to_str);
if (attachments) free(attachments);
if (emoji_reactions) free(emoji_reactions);
if (notif) free(notif_info);
if (interactions_html) free(interactions_html);
//if (formatted_display_name != status->account.display_name) free(formatted_display_name);
- if (emoji_picker_html) free(emoji_picker_html);
if (parse_content != status->content) free(parse_content);
return stat_html;
}
diff --git a/static/interaction_buttons.html b/static/interaction_buttons.html
new file mode 100644
index 0000000..492533f
--- /dev/null
+++ b/static/interaction_buttons.html
@@ -0,0 +1,45 @@
+
+
+
+
+
+ |
+
+
+ |
+
+
+ |
+ %s
+ %s
+
+
+ |
+
+
+
diff --git a/static/likeboost.html b/static/likeboost.html
new file mode 100644
index 0000000..b34e213
--- /dev/null
+++ b/static/likeboost.html
@@ -0,0 +1,9 @@
+
+
+ |
diff --git a/static/reactions_btn.html b/static/reactions_btn.html
new file mode 100644
index 0000000..d5a2a41
--- /dev/null
+++ b/static/reactions_btn.html
@@ -0,0 +1,9 @@
+
+
+ %s
+ |
diff --git a/static/status.html b/static/status.html
index 6b604f5..bd18e68 100644
--- a/static/status.html
+++ b/static/status.html
@@ -44,67 +44,7 @@
%s
%s
%s
-
-
-
-
-
- |
-
-
- |
-
-
- |
-
-
- |
-
-
- %s
- |
-
-
- |
-
-
-
+ %s