##// 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 96 $('#image-count').text(getImageCount());
97 97
98 98 updateBumplimitProgress(data.added.length);
99 updatePostBumpableStatus();
99 100 })
100 101 .error(function(data) {
101 102 // TODO Show error message that server is unavailable?
@@ -127,6 +128,9 b' function getImageCount() {'
127 128 return $('.thread').find('img').length
128 129 }
129 130
131 /**
132 * Update bumplimit progress bar
133 */
130 134 function updateBumplimitProgress(postDelta) {
131 135 var progressBar = $('#bumplimit_progress');
132 136 if (progressBar) {
@@ -137,11 +141,24 b' function updateBumplimitProgress(postDel'
137 141 var bumplimit = postCount - postDelta + oldPostsToLimit;
138 142
139 143 var newPostsToLimit = bumplimit - postCount;
140 if (newPostsToLimit < 0) {
141 progressBar.remove();
144 if (newPostsToLimit <= 0) {
145 $('.bar-bg').remove();
142 146 } else {
143 147 postsToLimitElement.text(newPostsToLimit);
144 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 40 [DONE] Quote characters within quote causes quote parsing to fail
41 41
42 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 45 = Testing =
46 46 [NOT STARTED] Make tests for every view
General Comments 0
You need to be logged in to leave comments. Login now