Explorar el Código

Focus replies when "Load more" clicked

Zed hace 6 años
padre
commit
c25b780c03
Se han modificado 3 ficheros con 5 adiciones y 5 borrados
  1. 1 1
      src/sass/tweet/thread.scss
  2. 2 2
      src/views/status.nim
  3. 2 2
      src/views/timeline.nim

+ 1 - 1
src/sass/tweet/thread.scss

@@ -14,7 +14,7 @@
     background-color: $bg_panel;
 }
 
-.main-tweet {
+.main-tweet, .replies {
     padding-top: 50px;
     margin-top: -50px;
 }

+ 2 - 2
src/views/status.nim

@@ -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")

+ 2 - 2
src/views/timeline.nim

@@ -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 =