Small optimization to prevent loading of a post if it’s obviously not necessary.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 13 Jan 2011 13:48:15 +0000 (14:48 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 13 Jan 2011 13:48:15 +0000 (14:48 +0100)
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)) {