X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=3088aff09af951d3ef6bdf1543f85a01aa64a249;hb=dbb52371a130df342308472ab7bc2610549f4ed5;hp=db081970116230ea028cf02525cbce26fd4c5935;hpb=0e692c966f8f3937b490949aa9d04b103a22b612;p=Sone.git diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index db08197..3088aff 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -1115,14 +1115,19 @@ function isIndexPage() { } /** - * Returns the current page of the selected pagination. + * Returns the current page of the selected pagination. If no pagination can be + * found with the given selector, {@code 1} is returned. * * @param paginationSelector * The pagination selector * @returns The current page of the pagination */ function getPage(paginationSelector) { - return $(".current-page", paginationSelector).text(); + pagination = $(paginationSelector); + if (pagination.length > 0) { + return $(".current-page", paginationSelector).text(); + } + return 1; } /** @@ -1203,7 +1208,7 @@ function loadNewPost(postId, soneId, recipientId, time) { if (hasPost(postId)) { return; } - if (!isIndexPage()) { + if (!isIndexPage() || (getPage(".pagination-index") > 1)) { if (!isViewPostPage() || (getShownPostId() != postId)) { if (!isViewSonePage() || ((getShownSoneId() != soneId) && (getShownSoneId() != recipientId))) { return; @@ -1218,7 +1223,7 @@ function loadNewPost(postId, soneId, recipientId, time) { if (hasPost(data.post.id)) { return; } - if (!isIndexPage() && !(isViewSonePage() && ((getShownSoneId() == data.post.sone) || (getShownSoneId() == data.post.recipient)))) { + if ((!isIndexPage() || (getPage(".pagination-index") > 1)) && !(isViewSonePage() && ((getShownSoneId() == data.post.sone) || (getShownSoneId() == data.post.recipient)))) { return; } var firstOlderPost = null;