From 1d44bd180e5802f160c40af1924239a3cfcdfaff Mon Sep 17 00:00:00 2001 From: pimlie Date: Sat, 22 Jun 2024 12:38:13 +0200 Subject: [PATCH] feat: add spoiler badge to post title --- static/style.css | 11 +++++++++++ templates/utils.html | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/static/style.css b/static/style.css index 7cef37c..05b4e4b 100644 --- a/static/style.css +++ b/static/style.css @@ -52,6 +52,7 @@ --visited: #aaa; --shadow: 0 1px 3px rgba(0, 0, 0, 0.5); --popup: #b80a27; + --spoiler: #ddd; /* Hint color theme to browser for scrollbar */ color-scheme: dark; @@ -71,6 +72,7 @@ --highlighted: white; --visited: #555; --shadow: 0 1px 3px rgba(0, 0, 0, 0.1); + --spoiler: #0f0f0f; /* Hint color theme to browser for scrollbar */ color-scheme: light; @@ -929,6 +931,15 @@ a.search_subreddit:hover { font-weight: bold; } +.spoiler { + color: var(--spoiler); + margin-left: 5px; + border: 1px solid var(--spoiler); + padding: 3px; + font-size: 12px; + border-radius: 5px; +} + .post_media_content, .post .__NoScript_PlaceHolder__, .gallery { max-width: calc(100% - 40px); grid-area: post_media; diff --git a/templates/utils.html b/templates/utils.html index e40d6c6..2722218 100644 --- a/templates/utils.html +++ b/templates/utils.html @@ -93,6 +93,7 @@ style="color:{{ post.flair.foreground_color }}; background:{{ post.flair.background_color }};">{% call render_flair(post.flair.flair_parts) %} {% endif %} {% if post.flags.nsfw %} NSFW{% endif %} + {% if post.flags.spoiler %} Spoiler{% endif %} @@ -223,7 +224,7 @@ style="color:{{ post.flair.foreground_color }}; background:{{ post.flair.background_color }};" dir="ltr">{% call render_flair(post.flair.flair_parts) %} {% endif %} - {{ post.title }}{% if post.flags.nsfw %} NSFW{% endif %} + {{ post.title }}{% if post.flags.nsfw %} NSFW{% endif %}{% if post.flags.spoiler %} Spoiler{% endif %} {% if (prefs.layout.is_empty() || prefs.layout == "card") && post.post_type == "image" %}