]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Setting max notice count in order not to freak out the browser with
authorSarven Capadisli <csarven@status.net>
Wed, 18 Nov 2009 10:54:57 +0000 (10:54 +0000)
committerSarven Capadisli <csarven@status.net>
Wed, 18 Nov 2009 10:54:57 +0000 (10:54 +0000)
memory issues. It removes the node and unbinds the previously assigned
events.

plugins/Realtime/realtimeupdate.js

index d77a95f7ad145fb9d6346b38b0286576331733a5..8e7383a0277e55b5e907c819f8a56f9ad01af470 100644 (file)
@@ -34,6 +34,7 @@ RealtimeUpdate = {
      _favorurl: '',
      _deleteurl: '',
      _updatecounter: 0,
+     _maxnotices: 50,
      _windowhasfocus: false,
 
      init: function(userid, replyurl, favorurl, deleteurl)
@@ -73,6 +74,14 @@ 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 .form_disfavor").unbind('submit');
+               $("#notices_primary .notice:last .form_favor").unbind('submit');
+               $("#notices_primary .notice:last .notice_reply").unbind('click');
+               $("#notices_primary .notice:last").remove();
+          }
+
           SN.U.NoticeReply();
           SN.U.NoticeFavor();