forked from mirrors/treebird
Improve interactions
FossilOrigin-Name: d7dd250d57c7e4c505d46ae5003373ddba03fea24d0a65343e5f727024c163c8
This commit is contained in:
parent
57dbcc8ad8
commit
f66c2c1e4d
11 changed files with 103 additions and 65 deletions
32
dist/treebird20.css
vendored
32
dist/treebird20.css
vendored
|
@ -570,10 +570,25 @@ svg.in-reply-to-icon
|
|||
|
||||
.notification-compact .notification-stats
|
||||
{
|
||||
color: #500000;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.notification-compact .notification-stats .status-interact
|
||||
{
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.notification-compact .notification-stats svg
|
||||
{
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
}
|
||||
|
||||
.notification-compact .notification-stats .statbtn
|
||||
{
|
||||
padding: 2px 4px;
|
||||
}
|
||||
|
||||
.notification-info
|
||||
{
|
||||
margin-top: 7px;
|
||||
|
@ -763,7 +778,7 @@ svg.in-reply-to-icon
|
|||
|
||||
.status-interact
|
||||
{
|
||||
margin: 8px 0 0 0;
|
||||
margin: 6px 0 0 0;
|
||||
}
|
||||
|
||||
.status-interact table.ui-table
|
||||
|
@ -778,6 +793,11 @@ svg.in-reply-to-icon
|
|||
padding: 0;
|
||||
}
|
||||
|
||||
.status-interact table.ui-table td
|
||||
{
|
||||
vertical-align: middle; /* Exception in notifications sidebar */
|
||||
}
|
||||
|
||||
/***************************
|
||||
* Element Grouping *
|
||||
**************************/
|
||||
|
@ -1151,7 +1171,7 @@ p}
|
|||
}
|
||||
|
||||
|
||||
.status-interact label
|
||||
.status-interact .statbtn
|
||||
{
|
||||
display: block;
|
||||
padding: 3px 8px;
|
||||
|
@ -1351,6 +1371,12 @@ p}
|
|||
left: 0;
|
||||
}
|
||||
|
||||
.attachment-link
|
||||
{
|
||||
font-weight: bold;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.sensitive.attachment-link::after,
|
||||
.sensitive.attachment-audio::after
|
||||
{
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
struct attachments_args
|
||||
{
|
||||
struct session* ssn;
|
||||
struct mstdnt_attachment* atts;
|
||||
mstdnt_bool sensitive;
|
||||
};
|
||||
|
@ -118,32 +119,39 @@ void cleanup_media_ids(struct session* ssn, char** media_ids)
|
|||
free(media_ids);
|
||||
}
|
||||
|
||||
char* construct_attachment(mstdnt_bool sensitive, struct mstdnt_attachment* att, int* str_size)
|
||||
char* construct_attachment(struct session* ssn,
|
||||
mstdnt_bool sensitive,
|
||||
struct mstdnt_attachment* att,
|
||||
int* str_size)
|
||||
{
|
||||
char* att_html;
|
||||
size_t s;
|
||||
const char* attachment_str;
|
||||
if (!att) return NULL;
|
||||
|
||||
switch (att->type)
|
||||
{
|
||||
case MSTDNT_ATTACHMENT_IMAGE:
|
||||
attachment_str = data_attachment_image_html; break;
|
||||
case MSTDNT_ATTACHMENT_GIFV:
|
||||
attachment_str = data_attachment_gifv_html; break;
|
||||
case MSTDNT_ATTACHMENT_VIDEO:
|
||||
attachment_str = data_attachment_video_html; break;
|
||||
case MSTDNT_ATTACHMENT_AUDIO:
|
||||
attachment_str = data_attachment_audio_html; break;
|
||||
case MSTDNT_ATTACHMENT_UNKNOWN: // Fall through
|
||||
default:
|
||||
attachment_str = data_attachment_link_html; break;
|
||||
}
|
||||
if (ssn->config.stat_attachments)
|
||||
switch (att->type)
|
||||
{
|
||||
case MSTDNT_ATTACHMENT_IMAGE:
|
||||
attachment_str = data_attachment_image_html; break;
|
||||
case MSTDNT_ATTACHMENT_GIFV:
|
||||
attachment_str = data_attachment_gifv_html; break;
|
||||
case MSTDNT_ATTACHMENT_VIDEO:
|
||||
attachment_str = data_attachment_video_html; break;
|
||||
case MSTDNT_ATTACHMENT_AUDIO:
|
||||
attachment_str = data_attachment_audio_html; break;
|
||||
case MSTDNT_ATTACHMENT_UNKNOWN: // Fall through
|
||||
default:
|
||||
attachment_str = data_attachment_link_html; break;
|
||||
}
|
||||
else
|
||||
attachment_str = data_attachment_link_html;
|
||||
|
||||
// Images/visible content displays sensitive placeholder after
|
||||
if (att->type == MSTDNT_ATTACHMENT_IMAGE ||
|
||||
att->type == MSTDNT_ATTACHMENT_GIFV ||
|
||||
att->type == MSTDNT_ATTACHMENT_VIDEO)
|
||||
if ((att->type == MSTDNT_ATTACHMENT_IMAGE ||
|
||||
att->type == MSTDNT_ATTACHMENT_GIFV ||
|
||||
att->type == MSTDNT_ATTACHMENT_VIDEO) &&
|
||||
ssn->config.stat_attachments)
|
||||
{
|
||||
s = easprintf(&att_html, attachment_str,
|
||||
att->url,
|
||||
|
@ -162,13 +170,17 @@ char* construct_attachment(mstdnt_bool sensitive, struct mstdnt_attachment* att,
|
|||
static char* construct_attachments_voidwrap(void* passed, size_t index, int* res)
|
||||
{
|
||||
struct attachments_args* args = passed;
|
||||
return construct_attachment(args->sensitive, args->atts + index, res);
|
||||
return construct_attachment(args->ssn, args->sensitive, args->atts + index, res);
|
||||
}
|
||||
|
||||
char* construct_attachments(mstdnt_bool sensitive, struct mstdnt_attachment* atts, size_t atts_len, size_t* str_size)
|
||||
char* construct_attachments(struct session* ssn,
|
||||
mstdnt_bool sensitive,
|
||||
struct mstdnt_attachment* atts,
|
||||
size_t atts_len,
|
||||
size_t* str_size)
|
||||
{
|
||||
size_t elements_size;
|
||||
struct attachments_args args = { atts, sensitive };
|
||||
struct attachments_args args = { ssn, atts, sensitive };
|
||||
char* elements = construct_func_strings(construct_attachments_voidwrap, &args, atts_len, &elements_size);
|
||||
char* att_view;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ int try_upload_media(struct mstdnt_storage** storage,
|
|||
char*** media_ids);
|
||||
void cleanup_media_storages(struct session* ssn, struct mstdnt_storage* storage);
|
||||
void cleanup_media_ids(struct session* ssn, char** media_ids);
|
||||
char* construct_attachment(mstdnt_bool sensitive, struct mstdnt_attachment* att, int* str_size);
|
||||
char* construct_attachments(mstdnt_bool sensitive, struct mstdnt_attachment* atts, size_t atts_len, size_t* str_size);
|
||||
char* construct_attachment(struct session* ssn, mstdnt_bool sensitive, struct mstdnt_attachment* att, int* str_size);
|
||||
char* construct_attachments(struct session* ssn, mstdnt_bool sensitive, struct mstdnt_attachment* atts, size_t atts_len, size_t* str_size);
|
||||
|
||||
#endif // ATTACHMENTS_H
|
||||
|
|
|
@ -99,10 +99,9 @@ char* construct_notification_compact(struct session* ssn,
|
|||
|
||||
if (notif->status)
|
||||
{
|
||||
easprintf(¬if_stats, "%d - %d - %d",
|
||||
notif->status->replies_count,
|
||||
notif->status->reblogs_count,
|
||||
notif->status->favourites_count);
|
||||
if (notif->type == MSTDNT_NOTIFICATION_MENTION)
|
||||
notif_stats = construct_interaction_buttons(ssn, notif->status, NULL,
|
||||
STATUS_NO_LIKEBOOST | STATUS_NO_DOPAMEME);
|
||||
status_format = reformat_status(ssn,
|
||||
notif->status->content,
|
||||
notif->status->emojis,
|
||||
|
|
23
src/status.c
23
src/status.c
|
@ -188,6 +188,8 @@ char* construct_interaction_buttons(struct session* ssn,
|
|||
char* emoji_picker_html = NULL;
|
||||
char* reactions_btn_html = NULL;
|
||||
char* time_str;
|
||||
int show_nums = (flags & STATUS_NO_DOPAMEME) != STATUS_NO_DOPAMEME &&
|
||||
ssn->config.stat_dope;
|
||||
size_t s;
|
||||
|
||||
// Emojo picker
|
||||
|
@ -202,12 +204,15 @@ char* construct_interaction_buttons(struct session* ssn,
|
|||
status->id,
|
||||
emoji_picker_html ? emoji_picker_html : "");
|
||||
|
||||
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 (show_nums)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
easprintf(&likeboost_html, data_likeboost_html,
|
||||
config_url_prefix,
|
||||
|
@ -230,7 +235,9 @@ char* construct_interaction_buttons(struct session* ssn,
|
|||
status->favourited ? "un" : "",
|
||||
status->favourited ? "active" : "",
|
||||
favourites_count ? favourites_count : "",
|
||||
likeboost_html ? likeboost_html : "",
|
||||
(likeboost_html &&
|
||||
ssn->config.stat_oneclicksoftware &&
|
||||
(flags & STATUS_NO_LIKEBOOST) != STATUS_NO_LIKEBOOST ? likeboost_html : ""),
|
||||
reactions_btn_html ? reactions_btn_html : "",
|
||||
config_url_prefix,
|
||||
status->id,
|
||||
|
@ -550,7 +557,7 @@ char* construct_status(struct session* ssn,
|
|||
}
|
||||
|
||||
if (status->media_attachments_len)
|
||||
attachments = construct_attachments(status->sensitive, status->media_attachments, status->media_attachments_len, NULL);
|
||||
attachments = construct_attachments(ssn, status->sensitive, status->media_attachments, status->media_attachments_len, NULL);
|
||||
if (status->pleroma.emoji_reactions_len)
|
||||
emoji_reactions = construct_emoji_reactions(status->id, status->pleroma.emoji_reactions, status->pleroma.emoji_reactions_len, NULL);
|
||||
if (notif && notif->type != MSTDNT_NOTIFICATION_MENTION)
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#define STATUS_REPLY (1<<0)
|
||||
#define STATUS_FOCUSED (1<<1)
|
||||
#define STATUS_EMOJI_PICKER (1<<2)
|
||||
#define STATUS_NO_LIKEBOOST (1<<3)
|
||||
#define STATUS_NO_DOPAMEME (1<<4)
|
||||
|
||||
struct construct_statuses_args
|
||||
{
|
||||
|
|
|
@ -26,18 +26,18 @@
|
|||
|
||||
<h3>Statuses</h3>
|
||||
<ul>
|
||||
<!-- <li> -->
|
||||
<!-- <input type="checkbox" id="cfgstatattachments" name="statattachments" value="1" %s> -->
|
||||
<!-- <label for="cfgstatattachments">Show attachments - If disabled, attachments are links instead</label> -->
|
||||
<!-- </li> -->
|
||||
<li>
|
||||
<input type="checkbox" id="cfgstatattachments" name="statattachments" value="1" %s>
|
||||
<label for="cfgstatattachments">Show attachments - If disabled, attachments are links instead</label>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" id="cfgstatgreentexts" name="statgreentexts" value="1" %s>
|
||||
<label for="cfgstatgreentexts">Show greentexts</label>
|
||||
</li>
|
||||
<!-- <li> -->
|
||||
<!-- <input type="checkbox" id="cfgstatdope" name="statdope" value="1" %s> -->
|
||||
<!-- <label for="cfgstatdope">Show dopameme numbers - Likes, comments, and boost counts</label> -->
|
||||
<!-- </li> -->
|
||||
<li>
|
||||
<input type="checkbox" id="cfgstatdope" name="statdope" value="1" %s>
|
||||
<label for="cfgstatdope">Show dopameme numbers - Likes, comments, and boost counts</label>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" id="cfgstatoneclicksoftware" name="statoneclicksoftware" value="1" %s>
|
||||
<label for="cfgstatoneclicksoftware">Show Like-Boost button - Show a button in the status which likes and boosts a post</label>
|
||||
|
|
|
@ -2,18 +2,16 @@
|
|||
<table class="ui-table">
|
||||
<tr>
|
||||
<td>
|
||||
<form action="%s/status/%s/reply#id-%s" method="post">
|
||||
<label class="pointer">
|
||||
<svg class="reply" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 9l6 6-6 6"/><path d="M4 4v7a4 4 0 0 0 4 4h11"/></svg>
|
||||
<a target="_parent" href="%s/status/%s/reply#id-%s" class="pointer statbtn">
|
||||
<svg class="reply" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 9l6 6-6 6"/><path d="M4 4v7a4 4 0 0 0 4 4h11"/></svg>
|
||||
<span class="count">%s</span>
|
||||
<input class="hidden" type="submit" value="Reply">
|
||||
</label>
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<form action="%s/status/%s/interact" method="post">
|
||||
<input type="hidden" name="itype" value="%srepeat">
|
||||
<label class="pointer">
|
||||
<label class="pointer statbtn">
|
||||
<svg class="repeat %s" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17 2.1l4 4-4 4"/><path d="M3 12.2v-2a4 4 0 0 1 4-4h12.8M7 21.9l-4-4 4-4"/><path d="M21 11.8v2a4 4 0 0 1-4 4H4.2"/></svg>
|
||||
<span class="count">%s</span>
|
||||
<input class="hidden" type="submit" value="Repeat">
|
||||
|
@ -23,7 +21,7 @@
|
|||
<td>
|
||||
<form action="%s/status/%s/interact" method="post">
|
||||
<input type="hidden" name="itype" value="%slike">
|
||||
<label class="pointer">
|
||||
<label class="pointer statbtn">
|
||||
<svg class="like %s" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>
|
||||
<span class="count">%s</span>
|
||||
<input class="hidden" type="submit" value="Like">
|
||||
|
@ -33,12 +31,9 @@
|
|||
%s
|
||||
%s
|
||||
<td>
|
||||
<form action="%s/status/%s#id-%s" method="post">
|
||||
<label class="pointer">
|
||||
<svg class="expand" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h6v6M14 10l6.1-6.1M9 21H3v-6M10 14l-6.1 6.1"/></svg>
|
||||
<input class="hidden" type="submit" >
|
||||
</label>
|
||||
</form>
|
||||
<a target="_parent" href="%s/status/%s#id-%s" class="pointer statbtn">
|
||||
<svg class="expand" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h6v6M14 10l6.1-6.1M9 21H3v-6M10 14l-6.1 6.1"/></svg>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<span class="time">%s</span>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<td>
|
||||
<form action="%s/status/%s/interact" method="post">
|
||||
<input type="hidden" name="itype" value="likeboost">
|
||||
<label class="pointer">
|
||||
<label class="pointer statbtn">
|
||||
<svg class="one-click-software" width="20" height="20" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><g><g stroke-width="1.98"><path d="m19.15 8.5061 2.7598 2.7598-2.7598 2.7598"/><path d="m14.756 11.325s2.5484-0.05032 6.3258 0.01026m-15.639 10.807-2.7598-2.7598 2.7598-2.7598"/><path d="m22.4 15.327v1.2259c0 1.156-1.2356 2.7598-2.7598 2.7598h-16.664"/></g><polygon transform="matrix(.60736 0 0 .60736 .60106 .63577)" points="18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2 15.09 8.26 22 9.27 17 14.14" stroke-width="2.9656"/></g></svg>
|
||||
<input class="hidden" type="submit" value="L+R">
|
||||
</label>
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
<td>
|
||||
<form action="%s/status/%s/react#id-%s" method="post">
|
||||
<label class="pointer">
|
||||
<svg class="emoji-btn" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="8" y1="12" x2="16" y2="12"></line></svg>
|
||||
<input class="hidden" type="submit" value="Emoji">
|
||||
</label>
|
||||
<a target="_parent" href="%s/status/%s/react#id-%s" class="pointer statbtn">
|
||||
<svg class="emoji-btn" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="8" y1="12" x2="16" y2="12"></line></svg>
|
||||
%s
|
||||
</form>
|
||||
</td>
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
<span class="username">%s</span>
|
||||
<a class="instance-info" href="%s/@%s">%s</a>
|
||||
<span class="alignend status-visibility menu-container">
|
||||
%s
|
||||
<div class="menu">
|
||||
%s
|
||||
<ul>
|
||||
<li>
|
||||
<form action="%s/status/%s/interact" method="post">
|
||||
|
|
Loading…
Reference in a new issue