Sensitive blur

FossilOrigin-Name: 02b03b2d9414103a7c5fea6bf0fd8d4780280993cd592457b22729ccb02176af
This commit is contained in:
me@ow.nekobit.net 2022-03-28 14:45:25 +00:00
parent 5609f96baa
commit 7cb80631a1
5 changed files with 32 additions and 13 deletions

18
dist/treebird20.css vendored
View file

@ -662,15 +662,23 @@ ul li:first-child a.sidebarbtn
margin: 10px 0 3px 0;
}
.zoom
.attachment-container
{
z-index: 3;
display: inline-block;
overflow: hidden;
}
.zoom:hover
.sensitive
{
transition: transform .5s;
transition-timing-function: cubic-bezier(1, 0, 1, 0);
transform: scaleX(1.8) scaleY(1.8);
z-index: 2;
filter: blur(16px);
transition: filter .4s;
}
.sensitive:hover
{
filter: none;
}
.statusbox textarea

View file

@ -25,11 +25,18 @@
#include "../static/attachments.chtml"
#include "../static/attachment_image.chtml"
char* construct_attachment(struct mstdnt_attachment* att, int* str_size)
struct attachments_args
{
struct mstdnt_attachment* atts;
mstdnt_bool sensitive;
};
char* construct_attachment(mstdnt_bool sensitive, struct mstdnt_attachment* att, int* str_size)
{
char* att_html;
size_t s = easprintf(&att_html, data_attachment_image_html,
sensitive ? "sensitive" : "",
att->url);
if (str_size) *str_size = s;
return att_html;
@ -37,13 +44,15 @@ char* construct_attachment(struct mstdnt_attachment* att, int* str_size)
static char* construct_attachments_voidwrap(void* passed, size_t index, int* res)
{
return construct_attachment((struct mstdnt_attachment*)passed + index, res);
struct attachments_args* args = passed;
return construct_attachment(args->sensitive, args->atts + index, res);
}
char* construct_attachments(struct mstdnt_attachment* atts, size_t atts_len, size_t* str_size)
char* construct_attachments(mstdnt_bool sensitive, struct mstdnt_attachment* atts, size_t atts_len, size_t* str_size)
{
size_t elements_size;
char* elements = construct_func_strings(construct_attachments_voidwrap, atts, atts_len, &elements_size);
struct attachments_args args = { atts, sensitive };
char* elements = construct_func_strings(construct_attachments_voidwrap, &args, atts_len, &elements_size);
char* att_view;
size_t s = easprintf(&att_view, data_attachments_html, elements);

View file

@ -20,7 +20,7 @@
#define ATTACHMENTS_H
#include <mastodont.h>
char* construct_attachment(struct mstdnt_attachment* att, int* str_size);
char* construct_attachments(struct mstdnt_attachment* atts, size_t atts_len, size_t* str_size);
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);
#endif // ATTACHMENTS_H

View file

@ -114,7 +114,7 @@ char* construct_status(struct mstdnt_status* status, int* size)
if (status->favourites_count)
easprintf(&favourites_count, NUM_STR, status->favourites_count);
if (status->media_attachments_len)
attachments = construct_attachments(status->media_attachments, status->media_attachments_len, NULL);
attachments = construct_attachments(status->sensitive, status->media_attachments, status->media_attachments_len, NULL);
if (status->pleroma.emoji_reactions_len)
emoji_reactions = construct_emoji_reactions(status->pleroma.emoji_reactions, status->pleroma.emoji_reactions_len, NULL);

View file

@ -1 +1,3 @@
<img class="zoom" width="256" src="%s">
<div class="attachment-container">
<img class="%s" width="256" src="%s">
</div>