]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Added update delay and max notice count
authorSarven Capadisli <csarven@status.net>
Mon, 16 Nov 2009 22:00:15 +0000 (22:00 +0000)
committerSarven Capadisli <csarven@status.net>
Mon, 16 Nov 2009 22:00:15 +0000 (22:00 +0000)
plugins/Realtime/realtimeupdate.js

index e82b4dbfbbab64332fe7cb798feca87a7b1d51ca..59045c094e383e288da06ca7f06ac6fa07e61af1 100644 (file)
@@ -34,6 +34,8 @@ RealtimeUpdate = {
      _favorurl: '',
      _deleteurl: '',
      _updatecounter: 0,
+     _updatedelay: 500,
+     _maxnotices: 50,
 
      init: function(userid, replyurl, favorurl, deleteurl)
      {
@@ -76,11 +78,16 @@ RealtimeUpdate = {
               $("#notices_primary .notices").prepend(noticeItem);
               $("#notices_primary .notice:first").css({display:"none"});
               $("#notices_primary .notice:first").fadeIn(1000);
+
+              if ($('#notices_primary .notice').length > RealtimeUpdate._maxnotices) {
+                   $("#notices_primary .notice:last").remove();
+              }
+
               NoticeReply();
 
               RealtimeUpdate._updatecounter += 1;
               document.title = '('+RealtimeUpdate._updatecounter+') ' + DT;
-          }, 500);
+          }, RealtimeUpdate._updatedelay);
      },
 
      makeNoticeItem: function(data)