From 5e0eb0242255a3bbc42f758f703fbfc0b895a617 Mon Sep 17 00:00:00 2001 From: Zed Date: Wed, 29 Dec 2021 06:41:00 +0100 Subject: [PATCH] Improve withheld tweet rendering --- src/parser.nim | 8 ++++---- src/sass/tweet/_base.scss | 1 + src/views/general.nim | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/parser.nim b/src/parser.nim index 5d3c74d..b9aeba1 100644 --- a/src/parser.nim +++ b/src/parser.nim @@ -271,10 +271,9 @@ proc parseTweet(js: JsonNode): Tweet = else: discard with jsWithheld, js{"withheld_in_countries"}: - var withheldInCountries: seq[string] - - if jsWithheld.kind == JArray: - withheldInCountries = jsWithheld.to(seq[string]) + let withheldInCountries: seq[string] = + if jsWithheld.kind != JArray: @[] + else: jsWithheld.to(seq[string]) # XX - Content is withheld in all countries # XY - Content is withheld due to a DMCA request. @@ -282,6 +281,7 @@ proc parseTweet(js: JsonNode): Tweet = withheldInCountries.len > 0 and ("XX" in withheldInCountries or "XY" in withheldInCountries or "withheld" in result.text): + result.text.removeSuffix(" Learn more.") result.available = false proc finalizeTweet(global: GlobalObjects; id: string): Tweet = diff --git a/src/sass/tweet/_base.scss b/src/sass/tweet/_base.scss index e6069b3..e29b880 100644 --- a/src/sass/tweet/_base.scss +++ b/src/sass/tweet/_base.scss @@ -191,6 +191,7 @@ box-sizing: border-box; border-radius: 10px; background-color: var(--bg_color); + z-index: 2; } .tweet-link { diff --git a/src/views/general.nim b/src/views/general.nim index 71b259a..144b8cc 100644 --- a/src/views/general.nim +++ b/src/views/general.nim @@ -44,7 +44,7 @@ proc renderHead*(prefs: Prefs; cfg: Config; titleText=""; desc=""; video=""; let opensearchUrl = getUrlPrefix(cfg) & "/opensearch" buildHtml(head): - link(rel="stylesheet", type="text/css", href="/css/style.css?v=5") + link(rel="stylesheet", type="text/css", href="/css/style.css?v=6") link(rel="stylesheet", type="text/css", href="/css/fontello.css?v=2") if theme.len > 0: