summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2009-11-18 17:04:42 -0500
committerCraig Andrews <candrews@integralblue.com>2009-11-18 17:04:42 -0500
commitcac5a417f2a81b974781d4dbc40fd9d718a7a7f2 (patch)
treeac4798b1acd4abbe1674af08af99460374bda537 /plugins
parenta00141a180d54cbcc244e0157c72f53ac53779b3 (diff)
parent199ccdb53fbd732eeced3edf734e39687729da9b (diff)
Merge branch '0.9.x' of gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Realtime/RealtimePlugin.php7
-rw-r--r--plugins/Realtime/realtimeupdate.css49
-rw-r--r--plugins/Realtime/realtimeupdate.js84
3 files changed, 83 insertions, 57 deletions
diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php
index 6d59bd1b1..2cff03d6c 100644
--- a/plugins/Realtime/RealtimePlugin.php
+++ b/plugins/Realtime/RealtimePlugin.php
@@ -118,6 +118,13 @@ class RealtimePlugin extends Plugin
return true;
}
+ function onEndShowStatusNetStyles($action)
+ {
+ $action->cssLink(common_path('plugins/Realtime/realtimeupdate.css'),
+ null, 'screen, projection, tv');
+ return true;
+ }
+
function onEndNoticeSave($notice)
{
$paths = array();
diff --git a/plugins/Realtime/realtimeupdate.css b/plugins/Realtime/realtimeupdate.css
new file mode 100644
index 000000000..0ab5dd32b
--- /dev/null
+++ b/plugins/Realtime/realtimeupdate.css
@@ -0,0 +1,49 @@
+#notices_primary {
+position:relative;
+}
+
+#realtime_actions {
+position: absolute;
+top: -20px;
+right: 0;
+margin: 0 0 11px 0;
+}
+
+#realtime_actions li {
+margin-left: 18px;
+list-style-type: none;
+float: left;
+}
+
+#realtime_actions button {
+width: 16px;
+height: 16px;
+display: block;
+border: none;
+cursor: pointer;
+text-indent: -9999px;
+float: left;
+}
+
+#realtime_play {
+background: url(icon_play.gif) no-repeat 47% 47%;
+margin-left: 4px;
+}
+
+#realtime_pause {
+background: url(icon_pause.gif) no-repeat 47% 47%;
+}
+
+#realtime_popup {
+background: url(icon_external.gif) no-repeat 0 30%;
+}
+
+#queued_counter {
+float:left;
+line-height:1.2;
+}
+
+#showstream #notices_primary {
+margin-top: 18px;
+}
+
diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js
index e2bd8daea..a2c4da113 100644
--- a/plugins/Realtime/realtimeupdate.js
+++ b/plugins/Realtime/realtimeupdate.js
@@ -66,26 +66,26 @@ RealtimeUpdate = {
receive: function(data)
{
- id = data.id;
-
- // Don't add it if it already exists
- if ($("#notice-"+id).length > 0) {
- return;
- }
-
if (RealtimeUpdate._paused === false) {
RealtimeUpdate.purgeLastNoticeItem();
RealtimeUpdate.insertNoticeItem(data);
-
- RealtimeUpdate.updateWindowCounter();
}
else {
RealtimeUpdate._queuedNotices.push(data);
+
+ RealtimeUpdate.updateQueuedCounter();
}
+
+ RealtimeUpdate.updateWindowCounter();
},
insertNoticeItem: function(data) {
+ // Don't add it if it already exists
+ if ($("#notice-"+data.id).length > 0) {
+ return;
+ }
+
var noticeItem = RealtimeUpdate.makeNoticeItem(data);
$("#notices_primary .notices").prepend(noticeItem);
$("#notices_primary .notice:first").css({display:"none"});
@@ -192,21 +192,7 @@ RealtimeUpdate = {
initActions: function(url, timeline, path)
{
var NP = $('#notices_primary');
- NP.prepend('<ul id="realtime_actions"><li id="realtime_pauseplay"></li><li id="realtime_timeline"></li></ul>');
- NP.css({'position':'relative'});
-
- $('#realtime_actions').css({
- 'position':'absolute',
- 'top':'-20px',
- 'right':'0',
- 'margin':'0 0 11px 0'
- });
-
- $('#realtime_actions li').css({
- 'margin-left':'18px',
- 'list-style-type':'none',
- 'float':'left'
- });
+ NP.prepend('<ul id="realtime_actions"><li id="realtime_playpause"></li><li id="realtime_timeline"></li></ul>');
RealtimeUpdate._pluginPath = path;
@@ -221,20 +207,11 @@ RealtimeUpdate = {
showPause: function()
{
- RT_PP = $('#realtime_pauseplay');
+ RT_PP = $('#realtime_playpause');
RT_PP.empty();
RT_PP.append('<button id="realtime_pause" class="pause" title="Pause">Pause</button>');
RT_P = $('#realtime_pause');
- $('#realtime_pause').css({
- 'background':'url('+RealtimeUpdate._pluginPath+'icon_pause.gif) no-repeat 47% 47%',
- 'width':'16px',
- 'height':'16px',
- 'display':'block',
- 'border':'none',
- 'cursor':'pointer',
- 'text-indent':'-9999px'
- });
RT_P.bind('click', function() {
RealtimeUpdate._paused = true;
@@ -245,20 +222,11 @@ RealtimeUpdate = {
showPlay: function()
{
- RT_PP = $('#realtime_pauseplay');
+ RT_PP = $('#realtime_playpause');
RT_PP.empty();
- RT_PP.append('<button id="realtime_play" class="play" title="Play">Play</button>');
+ RT_PP.append('<span id="queued_counter"></span> <button id="realtime_play" class="play" title="Play">Play</button>');
RT_P = $('#realtime_play');
- RT_P.css({
- 'background':'url('+RealtimeUpdate._pluginPath+'icon_play.gif) no-repeat 47% 47%',
- 'width':'16px',
- 'height':'16px',
- 'display':'block',
- 'border':'none',
- 'cursor':'pointer',
- 'text-indent':'-9999px'
- });
RT_P.bind('click', function() {
RealtimeUpdate._paused = false;
@@ -270,12 +238,25 @@ RealtimeUpdate = {
});
},
- showQueuedNotices: function() {
+ showQueuedNotices: function()
+ {
$.each(RealtimeUpdate._queuedNotices, function(i, n) {
RealtimeUpdate.insertNoticeItem(n);
});
RealtimeUpdate._queuedNotices = [];
+
+ RealtimeUpdate.removeQueuedCounter();
+ },
+
+ updateQueuedCounter: function()
+ {
+ $('#realtime_playpause #queued_counter').html('('+RealtimeUpdate._queuedNotices.length+')');
+ },
+
+ removeQueuedCounter: function()
+ {
+ $('#realtime_playpause #queued_counter').empty();
},
initAddPopup: function(url, timeline, path)
@@ -284,17 +265,6 @@ RealtimeUpdate = {
NP.append('<button id="realtime_popup" title="Pop up in a window">Pop up</button>');
var PP = $('#realtime_popup');
- PP.css({
- 'background':'transparent url('+ path + 'icon_external.gif) no-repeat 0 30%',
- 'width':'16px',
- 'height':'16px',
- 'display':'block',
- 'border':'none',
- 'cursor':'pointer',
- 'text-indent':'-9999px'
- });
- $('#showstream #notices_primary').css({'margin-top':'18px'});
-
PP.bind('click', function() {
window.open(url,
'',