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 @@ -56,7 +56,6 @@ function updateThread() { var bottom = isPageBottom(); var addedPosts = data.added; - for (var i = 0; i < addedPosts.length; i++) { var postText = addedPosts[i]; @@ -95,6 +94,8 @@ function updateThread() { $('#reply-count').text(getReplyCount()); $('#image-count').text(getImageCount()); + + updateBumplimitProgress(data.added.length + data.updated.length); }) .error(function(data) { // TODO Show error message that server is unavailable? @@ -125,3 +126,22 @@ function getReplyCount() { function getImageCount() { return $('.thread').find('img').length } + +function updateBumplimitProgress(postDelta) { + var progressBar = $('#bumplimit_progress'); + if (progressBar) { + var postsToLimitElement = $('#left_to_limit'); + + var oldPostsToLimit = parseInt(postsToLimitElement.text()); + var postCount = getReplyCount(); + var bumplimit = postCount - postDelta + oldPostsToLimit; + + var newPostsToLimit = bumplimit - postCount; + if (newPostsToLimit < 0) { + progressBar.remove(); + } else { + postsToLimitElement.text(newPostsToLimit); + progressBar.width((100 - postCount / bumplimit * 100.0) + '%'); + } + } +} \ No newline at end of file diff --git a/boards/templates/boards/post.html b/boards/templates/boards/post.html --- a/boards/templates/boards/post.html +++ b/boards/templates/boards/post.html @@ -1,6 +1,7 @@ {% load i18n %} {% load board %} +{% spaceless %} {% if can_bump %}
{% else %} @@ -66,3 +67,4 @@
{% endif %} +{% endspaceless %} \ No newline at end of file diff --git a/boards/templates/boards/thread.html b/boards/templates/boards/thread.html --- a/boards/templates/boards/thread.html +++ b/boards/templates/boards/thread.html @@ -10,6 +10,7 @@ {% endblock %} {% block content %} + {% spaceless %} {% get_current_language as LANGUAGE_CODE %} @@ -18,10 +19,10 @@ {% cache 600 thread_view thread.id thread.last_edit_time moderator LANGUAGE_CODE %} {% if bumpable %}
-
+
- {{ posts_left }} {% trans 'posts to bumplimit' %} + {{ posts_left }} {% trans 'posts to bumplimit' %}
{% endif %} @@ -143,6 +144,7 @@
+ {% endspaceless %} {% endblock %} {% block metapanel %}