Request a lot less data when not on the “known Sones” page.
[Sone.git] / src / main / resources / static / javascript / sone.js
index 60a3848..fa2c275 100644 (file)
@@ -560,7 +560,7 @@ function ajaxifyNotification(notification) {
 }
 
 function getStatus() {
-       $.getJSON("getStatus.ajax", {}, function(data, textStatus) {
+       $.getJSON("getStatus.ajax", {"loadAllSones": isKnownSonesPage()}, function(data, textStatus) {
                if ((data != null) && data.success) {
                        /* process Sone information. */
                        $.each(data.sones, function(index, value) {
@@ -660,6 +660,16 @@ function getShownPostId() {
        return $("#sone .post-id").text();
 }
 
+/**
+ * Returns whether the current page is the “known Sones” page.
+ *
+ * @returns {Boolean} <code>true</code> if the current page is the “known
+ *          Sones” page, <code>false</code> otherwise
+ */
+function isKnownSonesPage() {
+       return getPageId() == "known-sones";
+}
+
 var loadedPosts = {};
 var loadedReplies = {};