mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-23 11:55:29 +00:00
Focus main tweet in threads
This commit is contained in:
parent
2b7b374708
commit
f1529077d7
|
@ -67,7 +67,7 @@ proc getVideoFetch(tweet: Tweet; agent, token: string) {.async.} =
|
||||||
|
|
||||||
let
|
let
|
||||||
headers = genHeaders({"authorization": auth, "x-guest-token": token},
|
headers = genHeaders({"authorization": auth, "x-guest-token": token},
|
||||||
agent, base / getLink(tweet), lang=false)
|
agent, base / getLink(tweet, focus=false), lang=false)
|
||||||
url = apiBase / (videoUrl % $tweet.id)
|
url = apiBase / (videoUrl % $tweet.id)
|
||||||
json = await fetchJson(url, headers)
|
json = await fetchJson(url, headers)
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ proc getPoll*(tweet: Tweet; agent: string) {.async.} =
|
||||||
if tweet.poll.isNone(): return
|
if tweet.poll.isNone(): return
|
||||||
|
|
||||||
let
|
let
|
||||||
headers = genHeaders(agent, base / getLink(tweet), auth=true)
|
headers = genHeaders(agent, base / getLink(tweet, focus=false), auth=true)
|
||||||
url = base / (pollUrl % $tweet.id)
|
url = base / (pollUrl % $tweet.id)
|
||||||
html = await fetchHtml(url, headers)
|
html = await fetchHtml(url, headers)
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ proc getCard*(tweet: Tweet; agent: string) {.async.} =
|
||||||
if tweet.card.isNone(): return
|
if tweet.card.isNone(): return
|
||||||
|
|
||||||
let
|
let
|
||||||
headers = genHeaders(agent, base / getLink(tweet), auth=true)
|
headers = genHeaders(agent, base / getLink(tweet, focus=false), auth=true)
|
||||||
query = get(tweet.card).query.replace("sensitive=true", "sensitive=false")
|
query = get(tweet.card).query.replace("sensitive=true", "sensitive=false")
|
||||||
html = await fetchHtml(base / query, headers)
|
html = await fetchHtml(base / query, headers)
|
||||||
|
|
||||||
|
|
|
@ -76,9 +76,10 @@ proc getRfc822Time*(tweet: Tweet): string =
|
||||||
proc getTweetTime*(tweet: Tweet): string =
|
proc getTweetTime*(tweet: Tweet): string =
|
||||||
tweet.time.format("h:mm tt' · 'MMM d', 'YYYY")
|
tweet.time.format("h:mm tt' · 'MMM d', 'YYYY")
|
||||||
|
|
||||||
proc getLink*(tweet: Tweet | Quote): string =
|
proc getLink*(tweet: Tweet | Quote; focus=true): string =
|
||||||
if tweet.id == 0: return
|
if tweet.id == 0: return
|
||||||
&"/{tweet.profile.username}/status/{tweet.id}"
|
result = &"/{tweet.profile.username}/status/{tweet.id}"
|
||||||
|
if focus: result &= "#m"
|
||||||
|
|
||||||
proc getTombstone*(text: string): string =
|
proc getTombstone*(text: string): string =
|
||||||
text.replace(re"\n* *Learn more", "").stripText().strip(chars={' ', '\n'})
|
text.replace(re"\n* *Learn more", "").stripText().strip(chars={' ', '\n'})
|
||||||
|
|
|
@ -14,6 +14,11 @@
|
||||||
background-color: $bg_panel;
|
background-color: $bg_panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.main-tweet {
|
||||||
|
padding-top: 50px;
|
||||||
|
margin-top: -50px;
|
||||||
|
}
|
||||||
|
|
||||||
.main-tweet .tweet-content {
|
.main-tweet .tweet-content {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ proc renderConversation*(conversation: Conversation; prefs: Prefs; path: string)
|
||||||
for i, tweet in conversation.before.content:
|
for i, tweet in conversation.before.content:
|
||||||
renderTweet(tweet, prefs, path, index=i)
|
renderTweet(tweet, prefs, path, index=i)
|
||||||
|
|
||||||
tdiv(class="main-tweet"):
|
tdiv(class="main-tweet", id="m"):
|
||||||
let afterClass = if hasAfter: "thread thread-line" else: ""
|
let afterClass = if hasAfter: "thread thread-line" else: ""
|
||||||
renderTweet(conversation.tweet, prefs, path, class=afterClass,
|
renderTweet(conversation.tweet, prefs, path, class=afterClass,
|
||||||
mainTweet=true)
|
mainTweet=true)
|
||||||
|
|
Loading…
Reference in a new issue