diff options
author | Sarven Capadisli <csarven@status.net> | 2009-11-18 10:54:57 +0000 |
---|---|---|
committer | Sarven Capadisli <csarven@status.net> | 2009-11-18 10:54:57 +0000 |
commit | 23367ecdcf3146fe4a8d294e95d908f9c4882361 (patch) | |
tree | 1dba458b071ad91690c333ef6824faa4075089a4 /plugins/Realtime/realtimeupdate.js | |
parent | 0c81f39bee37e288ad6d56091884da61b96637c5 (diff) |
Setting max notice count in order not to freak out the browser with
memory issues. It removes the node and unbinds the previously assigned
events.
Diffstat (limited to 'plugins/Realtime/realtimeupdate.js')
-rw-r--r-- | plugins/Realtime/realtimeupdate.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index d77a95f7a..8e7383a02 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -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(); |