summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@status.net>2009-11-04 09:12:34 +0000
committerSarven Capadisli <csarven@status.net>2009-11-04 09:12:34 +0000
commitdf1ee6867e9774374b01784eb671bd16e6c58984 (patch)
tree57d9b4f36c870c28b5c8e0cff9d8ed28e2f86592 /plugins
parentdcca9fbec0cea9c5e15c4d58a8e9870514dfdbdd (diff)
Sync Realtime JavaScript with 0.9.x
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Realtime/realtimeupdate.js47
1 files changed, 31 insertions, 16 deletions
diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js
index 4cd68a816..9371326fe 100644
--- a/plugins/Realtime/realtimeupdate.js
+++ b/plugins/Realtime/realtimeupdate.js
@@ -7,6 +7,7 @@ RealtimeUpdate = {
_replyurl: '',
_favorurl: '',
_deleteurl: '',
+ _updatecounter: 0,
init: function(userid, replyurl, favorurl, deleteurl)
{
@@ -15,6 +16,8 @@ RealtimeUpdate = {
RealtimeUpdate._favorurl = favorurl;
RealtimeUpdate._deleteurl = deleteurl;
+ DT = document.title;
+
$(window).blur(function() {
$('#notices_primary .notice').css({
'border-top-color':$('#notices_primary .notice:last').css('border-top-color'),
@@ -25,24 +28,33 @@ RealtimeUpdate = {
'border-top-color':'#AAAAAA',
'border-top-style':'solid'
});
+
+ RealtimeUpdate._updatecounter = 0;
+ document.title = DT;
+
+ return false;
});
},
receive: function(data)
{
- id = data.id;
-
- // Don't add it if it already exists
- //
- if ($("#notice-"+id).length > 0) {
- return;
- }
-
- var noticeItem = RealtimeUpdate.makeNoticeItem(data);
- $("#notices_primary .notices").prepend(noticeItem);
- $("#notices_primary .notice:first").css({display:"none"});
- $("#notices_primary .notice:first").fadeIn(1000);
- NoticeReply();
+ setTimeout(function() {
+ id = data.id;
+
+ // Don't add it if it already exists
+ if ($("#notice-"+id).length > 0) {
+ return;
+ }
+
+ var noticeItem = RealtimeUpdate.makeNoticeItem(data);
+ $("#notices_primary .notices").prepend(noticeItem);
+ $("#notices_primary .notice:first").css({display:"none"});
+ $("#notices_primary .notice:first").fadeIn(1000);
+ NoticeReply();
+
+ RealtimeUpdate._updatecounter += 1;
+ document.title = '('+RealtimeUpdate._updatecounter+') ' + DT;
+ }, 500);
},
makeNoticeItem: function(data)
@@ -125,14 +137,17 @@ RealtimeUpdate = {
addPopup: function(url, timeline, iconurl)
{
- $('#content').prepend('<button id="realtime_timeline" title="Pop up in a window">Pop up</button>');
+ $('#notices_primary').css({'position':'relative'});
+ $('#notices_primary').prepend('<button id="realtime_timeline" title="Pop up in a window">Pop up</button>');
$('#realtime_timeline').css({
- 'margin':'0 0 18px 0',
+ 'margin':'0 0 11px 0',
'background':'transparent url('+ iconurl + ') no-repeat 0% 30%',
'padding':'0 0 0 20px',
'display':'block',
- 'float':'right',
+ 'position':'absolute',
+ 'top':'-20px',
+ 'right':'0',
'border':'none',
'cursor':'pointer',
'color':$("a").css("color"),