- $timeline = null;
-
- switch ($action->trimmed('action')) {
- case 'public':
- $timeline = 'timelines-public';
- break;
- case 'tag':
- $tag = $action->trimmed('tag');
- if (!empty($tag)) {
- $timeline = 'timelines-tag-'.$tag;
- } else {
- return true;
- }
- break;
- default:
- return true;
- }
-
- $action->element('script', array('type' => 'text/javascript',
- 'src' => 'http://'.$this->webserver.(($this->webport == 80) ? '':':'.$this->webport).'/meteor.js'),
- ' ');
-
- foreach (array('meteorupdater.js', 'json2.js') as $script) {
- $action->element('script', array('type' => 'text/javascript',
- 'src' => common_path('plugins/Meteor/'.$script)),
- ' ');
- }
-
- $user = common_current_user();
-
- if (!empty($user->id)) {
- $user_id = $user->id;
- } else {
- $user_id = 0;
- }
-
- $replyurl = common_local_url('newnotice');
- $favorurl = common_local_url('favor');
- // FIXME: need to find a better way to pass this pattern in
- $deleteurl = common_local_url('deletenotice',
- array('notice' => '0000000000'));
-
- $action->elementStart('script', array('type' => 'text/javascript'));
- $action->raw("$(document).ready(function() { MeteorUpdater.init(\"$this->webserver\", $this->webport, \"{$this->channelbase}{$timeline}\", $user_id, \"$replyurl\", \"$favorurl\", \"$deleteurl\"); });");
- $action->elementEnd('script');
-
- return true;