Add button to show earlier thread replies

This commit is contained in:
Zed 2019-12-06 06:03:50 +01:00
parent dc56e3ebe2
commit 397471f8f4
3 changed files with 17 additions and 0 deletions

View File

@ -160,6 +160,11 @@ proc parseConversation*(node: XmlNode; after: string): Conversation =
) )
) )
if result.before != nil:
let maxId = node.selectAttr(".in-reply-to .stream-container", "data-max-position")
if maxId.len > 0:
result.before.more = -1
let showMore = node.selectAttr(".ThreadedConversation-showMoreThreads button", let showMore = node.selectAttr(".ThreadedConversation-showMoreThreads button",
"data-cursor") "data-cursor")

View File

@ -80,6 +80,11 @@
margin-bottom: 0; margin-bottom: 0;
margin-left: -2.5px; margin-left: -2.5px;
} }
.earlier-replies {
padding-bottom: 0;
margin-bottom: -5px;
}
} }
.timeline-item.thread-last::before { .timeline-item.thread-last::before {

View File

@ -3,6 +3,11 @@ import karax/[karaxdsl, vdom]
import ".."/[types, formatters] import ".."/[types, formatters]
import tweet, timeline import tweet, timeline
proc renderEarlier(thread: Chain): VNode =
buildHtml(tdiv(class="timeline-item more-replies earlier-replies")):
a(class="more-replies-text", href=getLink(thread.content[0])):
text "earlier replies"
proc renderMoreReplies(thread: Chain): VNode = proc renderMoreReplies(thread: Chain): VNode =
let num = if thread.more != -1: $thread.more & " " else: "" let num = if thread.more != -1: $thread.more & " " else: ""
let reply = if thread.more == 1: "reply" else: "replies" let reply = if thread.more == 1: "reply" else: "replies"
@ -31,6 +36,8 @@ proc renderConversation*(conversation: Conversation; prefs: Prefs; path: string)
tdiv(class="main-thread"): tdiv(class="main-thread"):
if conversation.before != nil: if conversation.before != nil:
tdiv(class="before-tweet thread-line"): tdiv(class="before-tweet thread-line"):
if conversation.before.more == -1:
renderEarlier(conversation.before)
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)