##// END OF EJS Templates
Add dead_post class to the posts when thread reached bumplimit on autoupdate
neko259 -
r429:87abbf95 default
parent child Browse files
Show More
@@ -96,6 +96,7 b' function updateThread() {'
96 $('#image-count').text(getImageCount());
96 $('#image-count').text(getImageCount());
97
97
98 updateBumplimitProgress(data.added.length);
98 updateBumplimitProgress(data.added.length);
99 updatePostBumpableStatus();
99 })
100 })
100 .error(function(data) {
101 .error(function(data) {
101 // TODO Show error message that server is unavailable?
102 // TODO Show error message that server is unavailable?
@@ -127,6 +128,9 b' function getImageCount() {'
127 return $('.thread').find('img').length
128 return $('.thread').find('img').length
128 }
129 }
129
130
131 /**
132 * Update bumplimit progress bar
133 */
130 function updateBumplimitProgress(postDelta) {
134 function updateBumplimitProgress(postDelta) {
131 var progressBar = $('#bumplimit_progress');
135 var progressBar = $('#bumplimit_progress');
132 if (progressBar) {
136 if (progressBar) {
@@ -137,11 +141,24 b' function updateBumplimitProgress(postDel'
137 var bumplimit = postCount - postDelta + oldPostsToLimit;
141 var bumplimit = postCount - postDelta + oldPostsToLimit;
138
142
139 var newPostsToLimit = bumplimit - postCount;
143 var newPostsToLimit = bumplimit - postCount;
140 if (newPostsToLimit < 0) {
144 if (newPostsToLimit <= 0) {
141 progressBar.remove();
145 $('.bar-bg').remove();
142 } else {
146 } else {
143 postsToLimitElement.text(newPostsToLimit);
147 postsToLimitElement.text(newPostsToLimit);
144 progressBar.width((100 - postCount / bumplimit * 100.0) + '%');
148 progressBar.width((100 - postCount / bumplimit * 100.0) + '%');
145 }
149 }
146 }
150 }
147 }
151 }
152
153 /**
154 * If the bumplimit is reached, add dead_post class to all posts
155 */
156 function updatePostBumpableStatus() {
157 var postCount = getReplyCount();
158 var postsToLimitElement = $('#left_to_limit');
159 var postsToLimit = parseInt(postsToLimitElement.text());
160
161 if (postsToLimit <= 0) {
162 $('.thread').find('.post').addClass('dead_post');
163 }
164 }
@@ -40,7 +40,7 b' post or its part (delimited by N charact'
40 [DONE] Quote characters within quote causes quote parsing to fail
40 [DONE] Quote characters within quote causes quote parsing to fail
41
41
42 [IN PROGRESS] Replies, images, last update time in bottom panel doesn't change when
42 [IN PROGRESS] Replies, images, last update time in bottom panel doesn't change when
43 thread updates
43 thread updates (last update changing left)
44
44
45 = Testing =
45 = Testing =
46 [NOT STARTED] Make tests for every view
46 [NOT STARTED] Make tests for every view
General Comments 0
You need to be logged in to leave comments. Login now