From a9cf185e692fdc9dea2a9b127826ea8e0f9f1021 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Tue, 15 Sep 2009 13:53:16 +0000 Subject: Updated XHR return markup for Realtime plugin --- plugins/Realtime/realtimeupdate.js | 42 +++++++++----------------------------- 1 file changed, 10 insertions(+), 32 deletions(-) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index d55db5859..eba8ac1d9 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -1,8 +1,8 @@ // add a notice encoded as JSON into the current timeline // +// TODO: i18n RealtimeUpdate = { - _userid: 0, _replyurl: '', _favorurl: '', @@ -50,26 +50,15 @@ RealtimeUpdate = { "

"+html+"

"+ ""+ "
"+ - "
"+ - "
Published
"+ - "
"+ - ""+ + ""+ "a few seconds ago"+ " "+ - "
"+ - "
"+ - "
"+ - "
From
"+ - "
"+source+"
"+ // may have a link, I think - "
"; - + ""+ + "from "+ + "+source+"++ // may have a link + ""; if (data['in_reply_to_status_id']) { - ni = ni+"
"+ - "
To
"+ - "
"+ - "in reply to"+ - "
"+ - "
"; + ni = ni+" in context"; } ni = ni+"
"+ @@ -96,7 +85,7 @@ RealtimeUpdate = { ff = "
"+ "
"+ - "Favor this notice"+ // XXX: i18n + "Favor this notice"+ ""+ ""+ ""+ @@ -108,13 +97,7 @@ RealtimeUpdate = { makeReplyLink: function(id, nickname) { var rl; - rl = "
"+ - "
Reply to this notice
"+ - "
"+ - "Reply "+id+""+ - ""+ - "
"+ - "
"; + rl = "Reply "+id+""; return rl; }, @@ -123,12 +106,7 @@ RealtimeUpdate = { var dl, delurl; delurl = RealtimeUpdate._deleteurl.replace("0000000000", id); - dl = "
"+ - "
Delete this notice
"+ - "
"+ - "Delete"+ - "
"+ - "
"; + dl = "Delete"; return dl; }, -- cgit v1.2.3-54-g00ecf From 6568a3202d3acfde694b359e2524d52d93dc83dd Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 16 Sep 2009 13:29:46 +0000 Subject: Fixed typo --- plugins/Realtime/realtimeupdate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index eba8ac1d9..b2c8bb56d 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -55,7 +55,7 @@ RealtimeUpdate = { " "+ ""+ "from "+ - "+source+"++ // may have a link + "+source+"+ // may have a link ""; if (data['in_reply_to_status_id']) { ni = ni+" in context"; -- cgit v1.2.3-54-g00ecf From d9953e015b593965150bb528536f1f90674620ae Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 16 Sep 2009 16:04:19 +0000 Subject: Fixed missing quotes --- plugins/Realtime/realtimeupdate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index b2c8bb56d..faec8d89c 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -55,7 +55,7 @@ RealtimeUpdate = { " "+ ""+ "from "+ - "+source+"+ // may have a link + ""+source+""+ // may have a link ""; if (data['in_reply_to_status_id']) { ni = ni+" in context"; -- cgit v1.2.3-54-g00ecf From 49e91ec7d068fa7b98576207696d2192418baf5b Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 20 Sep 2009 15:14:46 +0000 Subject: Added realtime streams for all and showstream timelines --- plugins/Meteor/meteorupdater.js | 11 ++++++++++- plugins/Realtime/RealtimePlugin.php | 34 +++++++++++++++++++--------------- 2 files changed, 29 insertions(+), 16 deletions(-) (limited to 'plugins/Realtime') diff --git a/plugins/Meteor/meteorupdater.js b/plugins/Meteor/meteorupdater.js index 2e688336f..e8bca3eb4 100644 --- a/plugins/Meteor/meteorupdater.js +++ b/plugins/Meteor/meteorupdater.js @@ -7,8 +7,17 @@ var MeteorUpdater = function() init: function(server, port, timeline) { + var screen_name; + Meteor.callbacks["process"] = function(data) { - RealtimeUpdate.receive(JSON.parse(data)); + var d = JSON.parse(data); + screen_name = d['user']['screen_name']; + + if (timeline == 'public' || + $('address .url')[0].href+screen_name+'/all' == window.location.href || + $('address .url')[0].href+screen_name == window.location.href) { + RealtimeUpdate.receive(d); + } }; Meteor.host = server; diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php index 82eca3d08..1703ef099 100644 --- a/plugins/Realtime/RealtimePlugin.php +++ b/plugins/Realtime/RealtimePlugin.php @@ -63,20 +63,22 @@ class RealtimePlugin extends Plugin { $path = null; - switch ($action->trimmed('action')) { - case 'public': - $path = array('public'); - break; - case 'tag': - $tag = $action->trimmed('tag'); - if (!empty($tag)) { - $path = array('tag', $tag); - } else { + $a = $action->trimmed('action'); + + switch ($a) { + case 'public': case 'all': case 'replies': case 'showstream': + $path = array($a); + break; + case 'tag': + $tag = $action->trimmed('tag'); + if (!empty($tag)) { + $path = array('tag', $tag); + } else { + return true; + } + break; + default: return true; - } - break; - default: - return true; } $timeline = $this->_pathToChannel($path); @@ -108,11 +110,13 @@ class RealtimePlugin extends Plugin { $paths = array(); - // XXX: Add other timelines; this is just for the public one + // TODO: Replies timeline if ($notice->is_local || ($notice->is_local == 0 && !common_config('public', 'localonly'))) { - $paths[] = array('public'); + foreach (array('public', 'all', 'replies', 'showstream') as $a) { + $paths[] = array($a); + } } $tags = $this->getNoticeTags($notice); -- cgit v1.2.3-54-g00ecf From 470b34ea47ff97bbcbffb49c8a456da358b29578 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 21 Sep 2009 18:30:22 +0000 Subject: Escaping internal JavaScript --- plugins/Realtime/RealtimePlugin.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php index 1703ef099..7a612a406 100644 --- a/plugins/Realtime/RealtimePlugin.php +++ b/plugins/Realtime/RealtimePlugin.php @@ -98,9 +98,13 @@ class RealtimePlugin extends Plugin } $action->elementStart('script', array('type' => 'text/javascript')); - $action->raw("$(document).ready(function() { "); - $action->raw($this->_updateInitialize($timeline, $user_id)); - $action->raw(" });"); + $action->raw(' + + '); $action->elementEnd('script'); return true; -- cgit v1.2.3-54-g00ecf From acd5a53257f6d0677d1630e4f6cae80706cdbdba Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 21 Sep 2009 19:17:37 +0000 Subject: Initial UI to allow certain timelines to be viewed in a new window in realtime --- plugins/Realtime/RealtimePlugin.php | 2 + plugins/Realtime/icon_external.gif | Bin 0 -> 90 bytes plugins/Realtime/jquery.getUrlParam.js | 72 +++++++++ plugins/Realtime/realtimeupdate.js | 263 +++++++++++++++++++-------------- 4 files changed, 225 insertions(+), 112 deletions(-) create mode 100644 plugins/Realtime/icon_external.gif create mode 100644 plugins/Realtime/jquery.getUrlParam.js (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php index 7a612a406..611b1d86c 100644 --- a/plugins/Realtime/RealtimePlugin.php +++ b/plugins/Realtime/RealtimePlugin.php @@ -97,6 +97,8 @@ class RealtimePlugin extends Plugin $user_id = 0; } + $action->script('plugins/Realtime/jquery.getUrlParam.js'); + $action->elementStart('script', array('type' => 'text/javascript')); $action->raw('