From: David ‘Bombe’ Roden Date: Fri, 13 Jul 2012 07:06:19 +0000 (+0200) Subject: Only request status for shown Sones. X-Git-Tag: 0.8.2^2~2 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=4545888c01a4d7257328e7ab538b832d744aa3fd;p=Sone.git Only request status for shown Sones. This fixes #283. --- diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 2063576..49f372f 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -1193,7 +1193,7 @@ function checkForRemovedReplies(oldNotification, newNotification) { } function getStatus() { - ajaxGet("getStatus.ajax", isViewSonePage() ? {"soneIds": getShownSoneId() } : {"loadAllSones": isKnownSonesPage()}, function(data, textStatus) { + ajaxGet("getStatus.ajax", isViewSonePage() ? {"soneIds": getShownSoneId() } : isKnownSonesPage() ? {"soneIds": getShownSoneIds() } : {}, function(data, textStatus) { if ((data != null) && data.success) { /* process Sone information. */ $.each(data.sones, function(index, value) { @@ -1359,6 +1359,20 @@ function getShownSoneId() { } /** + * Returns the ID of all currently visible Sones. This is mainly used on the + * “Known Sones” page. + * + * @returns The ID of the currently shown Sones + */ +function getShownSoneIds() { + var soneIds = new Array(); + $("#sone #known-sones .sone .id").each(function() { + soneIds.push($(this).text()); + }); + return soneIds.join(","); +} + +/** * Returns whether the current page is a “view post” page. * * @returns {Boolean} true if the current page is a “view post”