diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index f8337bf636..fac977a420 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -787,7 +787,7 @@ define(function() { if (scrollTop < 50 && Topic.postCount > 1) { localStorage.removeItem("topic:" + tid + ":bookmark"); - pagination.innerHTML = '0 out of ' + Topic.postCount; + pagination.innerHTML = '1 out of ' + Topic.postCount; progressBar.width(0); return; } @@ -814,9 +814,8 @@ define(function() { smallestNonNegative = Number.MAX_VALUE; } - pagination.innerHTML = this.postnumber + ' out of ' + Topic.postCount; - console.log((this.postnumber / Topic.postCount * 100) + '%'); - progressBar.width((this.postnumber / Topic.postCount * 100) + '%'); + pagination.innerHTML = (this.postnumber-1) + ' out of ' + Topic.postCount; + progressBar.width(((this.postnumber-1) / Topic.postCount * 100) + '%'); } }); @@ -867,8 +866,9 @@ define(function() { } function createNewPosts(data, infiniteLoaded) { - if(!data || (data.posts && !data.posts.length)) + if(!data || (data.posts && !data.posts.length)) { return; + } function removeAlreadyAddedPosts() { data.posts = data.posts.filter(function(post) { @@ -900,7 +900,7 @@ define(function() { var insertAfter = findInsertionPoint(); var html = templates.prepare(templates['topic'].blocks['posts']).parse(data); - var regexp = new RegExp("[\\s\\S]*", 'g'); + var regexp = new RegExp("([\\s\\S]*?)", 'g'); html = html.replace(regexp, ''); translator.translate(html, function(translatedHTML) { @@ -948,7 +948,7 @@ define(function() { socket.emit('api:topic.loadMore', { tid: tid, - after: $('#post-container .post-row.infiniteloaded').length + after: $('#post-container .post-row.infiniteloaded').last().attr('data-index') + 1 }, function (data) { infiniteLoaderActive = false; if (data.posts.length) { diff --git a/public/templates/topic.tpl b/public/templates/topic.tpl index 155e03038d..89a0ea6262 100644 --- a/public/templates/topic.tpl +++ b/public/templates/topic.tpl @@ -26,7 +26,7 @@