From 7cb80631a1137f8eae7c242fb0ba4f1c017f561e Mon Sep 17 00:00:00 2001 From: "me@ow.nekobit.net" Date: Mon, 28 Mar 2022 14:45:25 +0000 Subject: [PATCH] Sensitive blur FossilOrigin-Name: 02b03b2d9414103a7c5fea6bf0fd8d4780280993cd592457b22729ccb02176af --- dist/treebird20.css | 18 +++++++++++++----- src/attachments.c | 17 +++++++++++++---- src/attachments.h | 4 ++-- src/status.c | 2 +- static/attachment_image.html | 4 +++- 5 files changed, 32 insertions(+), 13 deletions(-) diff --git a/dist/treebird20.css b/dist/treebird20.css index 05d8c5f..7db3018 100644 --- a/dist/treebird20.css +++ b/dist/treebird20.css @@ -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 diff --git a/src/attachments.c b/src/attachments.c index 0e05f73..9f325cb 100644 --- a/src/attachments.c +++ b/src/attachments.c @@ -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); diff --git a/src/attachments.h b/src/attachments.h index 6b8bd7c..ca53e49 100644 --- a/src/attachments.h +++ b/src/attachments.h @@ -20,7 +20,7 @@ #define ATTACHMENTS_H #include -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 diff --git a/src/status.c b/src/status.c index e81f893..281df7c 100644 --- a/src/status.c +++ b/src/status.c @@ -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); diff --git a/static/attachment_image.html b/static/attachment_image.html index 7539a50..19d7a8e 100644 --- a/static/attachment_image.html +++ b/static/attachment_image.html @@ -1 +1,3 @@ - +
+ +