Added update delay and max notice count

This commit is contained in:
Sarven Capadisli 2009-11-16 22:00:15 +00:00
parent e4d191334f
commit 629532e2da

View File

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