Show More
@@ -25,6 +25,9 b'' | |||
|
25 | 25 | |
|
26 | 26 | var CLASS_POST = '.post' |
|
27 | 27 | |
|
28 | var POST_ADDED = 0; | |
|
29 | var POST_UPDATED = 1; | |
|
30 | ||
|
28 | 31 | var wsUser = ''; |
|
29 | 32 | |
|
30 | 33 | var unreadPosts = 0; |
@@ -102,12 +105,15 b' function getThreadDiff() {' | |||
|
102 | 105 | data, |
|
103 | 106 | function(data) { |
|
104 | 107 | var updatedPosts = data.updated; |
|
108 | var addedPostCount = 0; | |
|
105 | 109 | |
|
106 | 110 | for (var i = 0; i < updatedPosts.length; i++) { |
|
107 | 111 | var postText = updatedPosts[i]; |
|
108 | 112 | var post = $(postText); |
|
109 | 113 | |
|
110 |
updatePost(post) |
|
|
114 | if (updatePost(post) == POST_ADDED) { | |
|
115 | addedPostCount++; | |
|
116 | } | |
|
111 | 117 | } |
|
112 | 118 | |
|
113 | 119 | var hasMetaUpdates = updatedPosts.length > 0; |
@@ -115,6 +121,9 b' function getThreadDiff() {' | |||
|
115 | 121 | updateMetadataPanel(); |
|
116 | 122 | } |
|
117 | 123 | |
|
124 | updateBumplimitProgress(addedPostCount); | |
|
125 | showNewPostsTitle(addedPostCount); | |
|
126 | ||
|
118 | 127 | // TODO Process removed posts if any |
|
119 | 128 | $('.metapanel').attr('data-last-update', data.last_update); |
|
120 | 129 | }, |
@@ -139,8 +148,12 b' function updatePost(postHtml) {' | |||
|
139 | 148 | // If the post already exists, replace it. Otherwise add as a new one. |
|
140 | 149 | var existingPosts = threadBlock.children('.post[id=' + postId + ']'); |
|
141 | 150 | |
|
151 | var type; | |
|
152 | ||
|
142 | 153 | if (existingPosts.size() > 0) { |
|
143 | 154 | existingPosts.replaceWith(post); |
|
155 | ||
|
156 | type = POST_UPDATED; | |
|
144 | 157 | } else { |
|
145 | 158 | post.appendTo(threadBlock); |
|
146 | 159 | |
@@ -148,11 +161,12 b' function updatePost(postHtml) {' | |||
|
148 | 161 | scrollToBottom(); |
|
149 | 162 | } |
|
150 | 163 | |
|
151 | updateBumplimitProgress(1); | |
|
152 | showNewPostsTitle(1); | |
|
164 | type = POST_ADDED; | |
|
153 | 165 | } |
|
154 | 166 | |
|
155 | 167 | processNewPost(post); |
|
168 | ||
|
169 | return type; | |
|
156 | 170 | } |
|
157 | 171 | |
|
158 | 172 | /** |
General Comments 0
You need to be logged in to leave comments.
Login now