]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Timeout a little incase the notice item from XHR response is
authorSarven Capadisli <csarven@status.net>
Wed, 30 Sep 2009 13:29:37 +0000 (13:29 +0000)
committerSarven Capadisli <csarven@status.net>
Wed, 30 Sep 2009 13:29:37 +0000 (13:29 +0000)
not appended to the page.

plugins/Realtime/realtimeupdate.js

index 3303d3a44f5c219663ae9febc32e73167ec19d50..11e466325ebad553a71c4bdb2c8b373c31289c7e 100644 (file)
@@ -30,19 +30,20 @@ RealtimeUpdate = {
 
      receive: function(data)
      {
-          id = data.id;
-
-          // Don't add it if it already exists
-          //
-          if ($("#notice-"+id).length > 0) {
-               return;
-          }
-
-          var noticeItem = RealtimeUpdate.makeNoticeItem(data);
-          $("#notices_primary .notices").prepend(noticeItem);
-          $("#notices_primary .notice:first").css({display:"none"});
-          $("#notices_primary .notice:first").fadeIn(1000);
-          NoticeReply();
+          setTimeout(function() {
+              id = data.id;
+
+              // Don't add it if it already exists
+              if ($("#notice-"+id).length > 0) {
+                   return;
+              }
+    
+              var noticeItem = RealtimeUpdate.makeNoticeItem(data);
+              $("#notices_primary .notices").prepend(noticeItem);
+              $("#notices_primary .notice:first").css({display:"none"});
+              $("#notices_primary .notice:first").fadeIn(1000);
+              NoticeReply();
+          }, 500);
      },
 
      makeNoticeItem: function(data)