diff --git a/boards/static/js/thread_update.js b/boards/static/js/thread_update.js --- a/boards/static/js/thread_update.js +++ b/boards/static/js/thread_update.js @@ -104,6 +104,8 @@ function getThreadDiff() { updatePost(post) } + updateMetadataPanel(); + // TODO Process removed posts if any $('.metapanel').attr('data-last-update', data.last_update); }) @@ -121,8 +123,6 @@ function updatePost(postHtml) { var threadBlock = $('div.thread'); - var lastUpdate = ''; - var postId = post.attr('id'); // If the post already exists, replace it. Otherwise add as a new one. @@ -139,16 +139,12 @@ function updatePost(postHtml) { updateBumplimitProgress(1); showNewPostsTitle(1); - lastUpdate = post.children('.post-info').first() - .children('.pub_time').first().html(); - if (bottom) { scrollToBottom(); } } processNewPost(post); - updateMetadataPanel(lastUpdate) } /** @@ -186,13 +182,15 @@ function getImageCount() { * Update post count, images count and last update time in the metadata * panel. */ -function updateMetadataPanel(lastUpdate) { +function updateMetadataPanel() { var replyCountField = $('#reply-count'); var imageCountField = $('#image-count'); replyCountField.text(getReplyCount()); imageCountField.text(getImageCount()); + var lastUpdate = $('.post:last').children('.post-info').first() + .children('.pub_time').first().html(); if (lastUpdate !== '') { var lastUpdateField = $('#last-update'); lastUpdateField.html(lastUpdate);