summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@status.net>2009-11-18 10:53:48 +0000
committerSarven Capadisli <csarven@status.net>2009-11-18 10:53:48 +0000
commit0c81f39bee37e288ad6d56091884da61b96637c5 (patch)
tree7601da265727931ad93b02ee482defaaa78ba64e
parent5e0fb1ddfc877cec5b367857a58f621f47067ddc (diff)
Added check to see whether window has focus
-rw-r--r--plugins/Realtime/realtimeupdate.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js
index 3c5d37f79..d77a95f7a 100644
--- a/plugins/Realtime/realtimeupdate.js
+++ b/plugins/Realtime/realtimeupdate.js
@@ -34,6 +34,7 @@ RealtimeUpdate = {
_favorurl: '',
_deleteurl: '',
_updatecounter: 0,
+ _windowhasfocus: false,
init: function(userid, replyurl, favorurl, deleteurl)
{
@@ -44,6 +45,8 @@ RealtimeUpdate = {
DT = document.title;
+ $(window).bind('focus', function(){ RealtimeUpdate._windowhasfocus = true; });
+
$(window).blur(function() {
$('#notices_primary .notice').removeClass('mark-top');
@@ -51,6 +54,7 @@ RealtimeUpdate = {
RealtimeUpdate._updatecounter = 0;
document.title = DT;
+ RealtimeUpdate._windowhasfocus = false;
return false;
});
@@ -72,8 +76,10 @@ RealtimeUpdate = {
SN.U.NoticeReply();
SN.U.NoticeFavor();
- RealtimeUpdate._updatecounter += 1;
- document.title = '('+RealtimeUpdate._updatecounter+') ' + DT;
+ if (RealtimeUpdate._windowhasfocus === false) {
+ RealtimeUpdate._updatecounter += 1;
+ document.title = '('+RealtimeUpdate._updatecounter+') ' + DT;
+ }
},
makeNoticeItem: function(data)