Small optimization to prevent loading of a post if it’s obviously not necessary.
[Sone.git] / src / main / resources / static / javascript / sone.js
index 9aa0b82..ccf7149 100644 (file)
@@ -700,6 +700,9 @@ function loadNewPost(postId) {
        if (hasPost(postId)) {
                return;
        }
+       if (!isIndexPage() && (!isViewPostPage() || (getShownPostId() != postId))) {
+               return;
+       }
        $.getJSON("getPost.ajax", { "post" : postId }, function(data, textStatus) {
                if ((data != null) && data.success) {
                        if (hasPost(data.post.id)) {