# HG changeset patch # User neko259 # Date 2013-12-10 09:24:11 # Node ID 87abbf953f2d876ce4c2c9af01be6721fdff4ad6 # Parent dcf916e95e904618e2ae375f0cdbd167beaff104 Add dead_post class to the posts when thread reached bumplimit on autoupdate 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 @@ -96,6 +96,7 @@ function updateThread() { $('#image-count').text(getImageCount()); updateBumplimitProgress(data.added.length); + updatePostBumpableStatus(); }) .error(function(data) { // TODO Show error message that server is unavailable? @@ -127,6 +128,9 @@ function getImageCount() { return $('.thread').find('img').length } +/** + * Update bumplimit progress bar + */ function updateBumplimitProgress(postDelta) { var progressBar = $('#bumplimit_progress'); if (progressBar) { @@ -137,11 +141,24 @@ function updateBumplimitProgress(postDel var bumplimit = postCount - postDelta + oldPostsToLimit; var newPostsToLimit = bumplimit - postCount; - if (newPostsToLimit < 0) { - progressBar.remove(); + if (newPostsToLimit <= 0) { + $('.bar-bg').remove(); } else { postsToLimitElement.text(newPostsToLimit); progressBar.width((100 - postCount / bumplimit * 100.0) + '%'); } } } + +/** + * If the bumplimit is reached, add dead_post class to all posts + */ +function updatePostBumpableStatus() { + var postCount = getReplyCount(); + var postsToLimitElement = $('#left_to_limit'); + var postsToLimit = parseInt(postsToLimitElement.text()); + + if (postsToLimit <= 0) { + $('.thread').find('.post').addClass('dead_post'); + } +} diff --git a/todo.txt b/todo.txt --- a/todo.txt +++ b/todo.txt @@ -40,7 +40,7 @@ post or its part (delimited by N charact [DONE] Quote characters within quote causes quote parsing to fail [IN PROGRESS] Replies, images, last update time in bottom panel doesn't change when -thread updates +thread updates (last update changing left) = Testing = [NOT STARTED] Make tests for every view