Skip to content

Commit

Permalink
Change max page for channels
Browse files Browse the repository at this point in the history
  • Loading branch information
JonHMChan committed Jul 1, 2015
1 parent b79703b commit 76978ee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ $(document).ready(function() {
set_page(page);

// Set total pages
$("span.page.total_pages").html(Math.max(Math.floor(data.posts.length / 5), 1));
$("span.page.total_pages").html(Math.max(Math.ceil(data.posts.length / 5), 1));

// Bind page clicks
$("a.page").click(function() {
Expand All @@ -120,7 +120,7 @@ $(document).ready(function() {
}

function set_page(page_num) {
var max = Math.floor(data.posts.length / 5);
var max = Math.ceil(data.posts.length / 5);

if (data == null) return;
if (!valid_page(page_num)) {
Expand Down Expand Up @@ -200,6 +200,6 @@ $(document).ready(function() {
}

function valid_page(page_num) {
return (page_num > 0 && page_num <= Math.max(Math.floor(data.posts.length / 5), 1))
return (page_num > 0 && page_num <= Math.max(Math.ceil(data.posts.length / 5), 1))
}
});

0 comments on commit 76978ee

Please sign in to comment.