forked from GNUsocial/gnu-social
move some stuff around for realtime
This commit is contained in:
parent
36e009349d
commit
bdbc2cb8de
@ -76,6 +76,15 @@ class RealtimePlugin extends Plugin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$base = $action->selfUrl();
|
||||||
|
if (mb_strstr($url, '?')) {
|
||||||
|
$url = $base . '&realtime=1';
|
||||||
|
} else {
|
||||||
|
$url = $base . '?realtime=1';
|
||||||
|
}
|
||||||
|
|
||||||
|
$title = $action->title();
|
||||||
|
|
||||||
$scripts = $this->_getScripts();
|
$scripts = $this->_getScripts();
|
||||||
|
|
||||||
foreach ($scripts as $script) {
|
foreach ($scripts as $script) {
|
||||||
@ -94,6 +103,7 @@ class RealtimePlugin extends Plugin
|
|||||||
|
|
||||||
$script = ' $(document).ready(function() { '.
|
$script = ' $(document).ready(function() { '.
|
||||||
$this->_updateInitialize($timeline, $user_id).
|
$this->_updateInitialize($timeline, $user_id).
|
||||||
|
' RealtimeUpdate.addPopup("'.$url.'", "'.$title.'"); '.
|
||||||
'}); ';
|
'}); ';
|
||||||
|
|
||||||
$action->raw($script);
|
$action->raw($script);
|
||||||
@ -189,28 +199,6 @@ class RealtimePlugin extends Plugin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onStartShowPageNotice($action)
|
|
||||||
{
|
|
||||||
$timeline = $this->_getTimeline($action);
|
|
||||||
if (!empty($timeline)) {
|
|
||||||
$base = $action->selfUrl();
|
|
||||||
if (mb_strstr($url, '?')) {
|
|
||||||
$url = $base . '&realtime=1';
|
|
||||||
} else {
|
|
||||||
$url = $base . '?realtime=1';
|
|
||||||
}
|
|
||||||
$title = $action->title();
|
|
||||||
$code = "window.open('$url', '$title', 'toolbar=no,resizable=yes,scrollbars=yes,status=yes,height=640,width=575');";
|
|
||||||
$action->element('a', array('href' => $base,
|
|
||||||
'onclick' => $code,
|
|
||||||
'id' => 'realtime_timeline',
|
|
||||||
'title' => _('Pop up')),
|
|
||||||
'Pop up');
|
|
||||||
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onStartShowBody($action)
|
function onStartShowBody($action)
|
||||||
{
|
{
|
||||||
$realtime = $action->boolean('realtime');
|
$realtime = $action->boolean('realtime');
|
||||||
|
@ -109,6 +109,11 @@ RealtimeUpdate = {
|
|||||||
dl = "<a class=\"notice_delete\" href=\""+delurl+"\" title=\"Delete this notice\">Delete</a>";
|
dl = "<a class=\"notice_delete\" href=\""+delurl+"\" title=\"Delete this notice\">Delete</a>";
|
||||||
|
|
||||||
return dl;
|
return dl;
|
||||||
|
},
|
||||||
|
|
||||||
|
addPopup: function(url, title)
|
||||||
|
{
|
||||||
|
// FIXME: need to add the realtime popup button here
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user