diff --git a/lib/persona.js b/lib/persona.js index 6107f7e..11c2c03 100644 --- a/lib/persona.js +++ b/lib/persona.js @@ -70,7 +70,7 @@ $(document).ready(function() { $(window).one('action:taskbar.pushed', function(ev, data) { updateChatCount(data.element); }); - + } else if (!data.element.hasClass('active')) { updateChatCount(data.element); } @@ -121,8 +121,11 @@ $(document).ready(function() { function setupPaginator() { function appendPageNumber(ev, data) { - var el = data.after ? data.after : data.before, - page = Math.ceil((el.attr('data-index') - 1) / config.postsPerPage), + var el = data.after ? data.after : data.before; + if (!el) { + return; + } + var page = Math.ceil((el.attr('data-index') - 1) / config.postsPerPage), handle = $('
' + page + '
'), shadow = $('
'); @@ -159,7 +162,7 @@ $(document).ready(function() { var distance = ev.originalEvent.touches[0].clientX - originalX, handlePos = parseInt(handle.css('left'), 10), postWidth = handle.parents('[component="post"]').width(); - + toPage = Math.ceil((handlePos + distance) / postWidth * ajaxify.data.pageCount); if (toPage >= ajaxify.data.pageCount) {