From: David ‘Bombe’ Roden Date: Thu, 21 Oct 2010 12:12:49 +0000 (+0200) Subject: Only register each Sone once! X-Git-Tag: 0.1-RC1~117 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=dd6c6a0cd8e75ff556038de771f577156ec0af79;p=Sone.git Only register each Sone once! --- diff --git a/src/main/resources/templates/include/viewSone.html b/src/main/resources/templates/include/viewSone.html index e054122..896f670 100644 --- a/src/main/resources/templates/include/viewSone.html +++ b/src/main/resources/templates/include/viewSone.html @@ -19,9 +19,20 @@ $("#sone .sone#" + soneId + " .last-update span.time").text(lastUpdated); } + registeredSones = {}; + $(document).ready(function() { $("#sone .sone").each(function() { - getStatus($(this).attr("id")); + soneId = $(this).attr("id"); + if (registeredSones[soneId]) { + return; + } + registeredSones[soneId] = true; + (function(soneId) { + setTimeout(function() { + getStatus(soneId); + }, 5000); + })(soneId); }); });