Focus replies when "Load more" clicked
This commit is contained in:
		
							parent
							
								
									f1529077d7
								
							
						
					
					
						commit
						c25b780c03
					
				| 
						 | 
				
			
			@ -14,7 +14,7 @@
 | 
			
		|||
    background-color: $bg_panel;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.main-tweet {
 | 
			
		||||
.main-tweet, .replies {
 | 
			
		||||
    padding-top: 50px;
 | 
			
		||||
    margin-top: -50px;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -52,10 +52,10 @@ proc renderConversation*(conversation: Conversation; prefs: Prefs; path: string)
 | 
			
		|||
      renderNewer(Query(), getLink(conversation.tweet))
 | 
			
		||||
 | 
			
		||||
    if conversation.replies.content.len > 0:
 | 
			
		||||
      tdiv(class="replies"):
 | 
			
		||||
      tdiv(class="replies", id="r"):
 | 
			
		||||
        for thread in conversation.replies.content:
 | 
			
		||||
          if thread == nil: continue
 | 
			
		||||
          renderReplyThread(thread, prefs, path)
 | 
			
		||||
 | 
			
		||||
    if conversation.replies.hasMore:
 | 
			
		||||
      renderMore(Query(), conversation.replies.minId)
 | 
			
		||||
      renderMore(Query(), conversation.replies.minId, focus="#r")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,9 +17,9 @@ proc renderNewer*(query: Query; path: string): VNode =
 | 
			
		|||
    a(href=(path & url)):
 | 
			
		||||
      text "Load newest"
 | 
			
		||||
 | 
			
		||||
proc renderMore*(query: Query; minId: string): VNode =
 | 
			
		||||
proc renderMore*(query: Query; minId: string; focus=""): VNode =
 | 
			
		||||
  buildHtml(tdiv(class="show-more")):
 | 
			
		||||
    a(href=(&"?{getQuery(query)}max_position={minId}")):
 | 
			
		||||
    a(href=(&"?{getQuery(query)}max_position={minId}{focus}")):
 | 
			
		||||
      text "Load more"
 | 
			
		||||
 | 
			
		||||
proc renderNoMore(): VNode =
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue