Added an update counter in the document title. When window is in blur,

it will update the document title when new notices are received. The
counter will reset when window is blurred (after a focus) again.
This commit is contained in:
Sarven Capadisli 2009-10-18 15:10:49 +00:00
parent 6b5810f5d5
commit eaaa01a171

View File

@ -7,6 +7,7 @@ RealtimeUpdate = {
_replyurl: '', _replyurl: '',
_favorurl: '', _favorurl: '',
_deleteurl: '', _deleteurl: '',
_updatecounter: 0,
init: function(userid, replyurl, favorurl, deleteurl) init: function(userid, replyurl, favorurl, deleteurl)
{ {
@ -15,6 +16,8 @@ RealtimeUpdate = {
RealtimeUpdate._favorurl = favorurl; RealtimeUpdate._favorurl = favorurl;
RealtimeUpdate._deleteurl = deleteurl; RealtimeUpdate._deleteurl = deleteurl;
DT = document.title;
$(window).blur(function() { $(window).blur(function() {
$('#notices_primary .notice').css({ $('#notices_primary .notice').css({
'border-top-color':$('#notices_primary .notice:last').css('border-top-color'), 'border-top-color':$('#notices_primary .notice:last').css('border-top-color'),
@ -26,6 +29,9 @@ RealtimeUpdate = {
'border-top-style':'solid' 'border-top-style':'solid'
}); });
RealtimeUpdate._updatecounter = 0;
document.title = DT;
return false; return false;
}); });
}, },
@ -45,6 +51,9 @@ RealtimeUpdate = {
$("#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);
NoticeReply(); NoticeReply();
RealtimeUpdate._updatecounter += 1;
document.title = '('+RealtimeUpdate._updatecounter+') ' + DT;
}, 500); }, 500);
}, },