forked from mirrors/treebird
Fix Emoji CSS
FossilOrigin-Name: 14f012492f3cd0706d7610cc814fceeaa81458e5f7a454ff890bc57c6ca5e8dc
This commit is contained in:
parent
e10053155d
commit
22ce8eef02
6 changed files with 117 additions and 8 deletions
35
dist/treebird20-dark.css
vendored
35
dist/treebird20-dark.css
vendored
|
@ -413,6 +413,18 @@ ul li:first-child a.sidebarbtn
|
|||
min-width: 100%;
|
||||
}
|
||||
|
||||
.notification-compact .notification-content
|
||||
{
|
||||
max-height: 100px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.notification-compact:hover .notification-content
|
||||
{
|
||||
max-height: unset;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.notification-compact p
|
||||
{
|
||||
margin: 0;
|
||||
|
@ -965,7 +977,28 @@ svg.in-reply-to-icon
|
|||
color: #f4ffff;
|
||||
}
|
||||
|
||||
/* Emoji reacts */
|
||||
/* Emoji */
|
||||
.emoji
|
||||
{
|
||||
font-family: monospace;
|
||||
display: inline;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
vertical-align: middle;
|
||||
object-fit: contain;
|
||||
transition: transform .2s;
|
||||
}
|
||||
|
||||
.emoji:hover
|
||||
{
|
||||
transform: scale(1.5);
|
||||
}
|
||||
|
||||
.emoji:active
|
||||
{
|
||||
transform: scale(2.7);
|
||||
}
|
||||
|
||||
.emoji-react-box
|
||||
{
|
||||
border-radius: 4px;
|
||||
|
|
37
dist/treebird20.css
vendored
37
dist/treebird20.css
vendored
|
@ -89,7 +89,7 @@ a, a:visited, a:hover, a:active
|
|||
|
||||
.greentext
|
||||
{
|
||||
color: #008000;
|
||||
color: #00aa00;
|
||||
}
|
||||
|
||||
/* Cleans up most of the tables */
|
||||
|
@ -389,6 +389,19 @@ ul li:first-child a.sidebarbtn
|
|||
{
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.notification-compact .notification-content
|
||||
{
|
||||
max-height: 100px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.notification-compact:hover .notification-content
|
||||
{
|
||||
max-height: unset;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.notification-compact .notification-info
|
||||
{
|
||||
font-size: 12px;
|
||||
|
@ -932,7 +945,27 @@ svg.in-reply-to-icon
|
|||
padding-bottom: 3px;
|
||||
}
|
||||
|
||||
/* Emoji reacts */
|
||||
/* Emoji */
|
||||
.emoji
|
||||
{
|
||||
font-family: monospace;
|
||||
display: inline;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
vertical-align: middle;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.emoji:hover
|
||||
{
|
||||
transform: scale(1.5);
|
||||
}
|
||||
|
||||
.emoji:active
|
||||
{
|
||||
transform: scale(2.7);
|
||||
}
|
||||
|
||||
.emoji-react-box
|
||||
{
|
||||
border-radius: 4px;
|
||||
|
|
34
dist/treebird40.css
vendored
34
dist/treebird40.css
vendored
|
@ -90,7 +90,7 @@ a, a:visited, a:hover, a:active
|
|||
|
||||
.greentext
|
||||
{
|
||||
color: #008000;
|
||||
color: #00aa00;
|
||||
}
|
||||
|
||||
/* Cleans up most of the tables */
|
||||
|
@ -411,6 +411,18 @@ input[type=button], input[type=submit]
|
|||
min-width: 100%;
|
||||
}
|
||||
|
||||
.notification-compact .notification-content
|
||||
{
|
||||
max-height: 100px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.notification-compact:hover .notification-content
|
||||
{
|
||||
max-height: unset;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.notification-compact p
|
||||
{
|
||||
margin: 0;
|
||||
|
@ -961,6 +973,26 @@ svg.in-reply-to-icon
|
|||
}
|
||||
|
||||
/* Emoji reacts */
|
||||
.emoji
|
||||
{
|
||||
font-family: monospace;
|
||||
display: inline;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
vertical-align: middle;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.emoji:hover
|
||||
{
|
||||
transform: scale(1.5);
|
||||
}
|
||||
|
||||
.emoji:active
|
||||
{
|
||||
transform: scale(2.7);
|
||||
}
|
||||
|
||||
.emoji-react-box
|
||||
{
|
||||
border-radius: 4px;
|
||||
|
|
|
@ -35,11 +35,12 @@ char* emojify(char* content, struct mstdnt_emoji* emos, size_t emos_len)
|
|||
|
||||
// Add colons around string
|
||||
sc_len = strlen(emos[i].shortcode);
|
||||
// 3 = \0 and two :
|
||||
coloned = malloc(sc_len+3);
|
||||
coloned[0] = ':';
|
||||
strncpy(coloned + 1, emos[i].shortcode, sc_len);
|
||||
coloned[sc_len-1] = ':';
|
||||
coloned[sc_len] = '\0';
|
||||
coloned[sc_len+1] = ':';
|
||||
coloned[sc_len+2] = '\0';
|
||||
|
||||
easprintf(&emoji_url_str, "<img class=\"emoji\" src=\"%s\">", emos[i].url);
|
||||
|
||||
|
|
|
@ -86,16 +86,25 @@ char* construct_notification_compact(mastodont_t* api,
|
|||
int* size)
|
||||
{
|
||||
char* notif_html;
|
||||
char* status_format;
|
||||
char* notif_stats = NULL;
|
||||
|
||||
const char* type_str = notification_type_compact_str(notif->type);
|
||||
const char* type_svg = notification_type_svg(notif->type);
|
||||
|
||||
if (notif->status)
|
||||
{
|
||||
easprintf(¬if_stats, "%d - %d - %d",
|
||||
notif->status->replies_count,
|
||||
notif->status->reblogs_count,
|
||||
notif->status->favourites_count);
|
||||
status_format = reformat_status(notif->status->content,
|
||||
notif->status->emojis,
|
||||
notif->status->emojis_len);
|
||||
}
|
||||
else {
|
||||
status_format = NULL;
|
||||
}
|
||||
|
||||
size_t s = easprintf(¬if_html, data_notification_compact_html,
|
||||
notif->account->avatar,
|
||||
|
@ -108,12 +117,13 @@ char* construct_notification_compact(mastodont_t* api,
|
|||
/* Might show follower address */
|
||||
notif->type == MSTDNT_NOTIFICATION_FOLLOW ?
|
||||
notif->account->acct :
|
||||
notif->status ? notif->status->content : "",
|
||||
status_format ? status_format : "",
|
||||
/* end */
|
||||
notif_stats ? notif_stats : "");
|
||||
|
||||
if (size) *size = s;
|
||||
|
||||
if (status_format) free(status_format);
|
||||
if (notif_stats) free(notif_stats);
|
||||
return notif_html;
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ char* reformat_status(char* content, struct mstdnt_emoji* emos, size_t emos_len)
|
|||
if (emos)
|
||||
{
|
||||
emo_res = emojify(gt_res, emos, emos_len);
|
||||
free(gt_res);
|
||||
if (gt_res != content) free(gt_res);
|
||||
return emo_res;
|
||||
}
|
||||
return gt_res;
|
||||
|
|
Loading…
Reference in a new issue