make realtime plugin grok repeats
This commit is contained in:
parent
80b5a7fe60
commit
d6873beb9b
|
@ -267,6 +267,24 @@ class RealtimePlugin extends Plugin
|
||||||
$profile = $notice->getProfile();
|
$profile = $notice->getProfile();
|
||||||
$arr['user']['profile_url'] = $profile->profileurl;
|
$arr['user']['profile_url'] = $profile->profileurl;
|
||||||
|
|
||||||
|
// Add needed repeat data
|
||||||
|
|
||||||
|
if (!empty($notice->repeat_of)) {
|
||||||
|
$original = Notice::staticGet('id', $notice->repeat_of);
|
||||||
|
if (!empty($original)) {
|
||||||
|
$arr['retweeted_status']['url'] = $original->bestUrl();
|
||||||
|
$arr['retweeted_status']['html'] = htmlspecialchars($original->rendered);
|
||||||
|
$arr['retweeted_status']['source'] = htmlspecialchars($original->source);
|
||||||
|
$originalProfile = $original->getProfile();
|
||||||
|
$arr['retweeted_status']['user']['profile_url'] = $originalProfile->profileurl;
|
||||||
|
if (!empty($original->reply_to)) {
|
||||||
|
$originalReply = Notice::staticGet('id', $original->reply_to);
|
||||||
|
$arr['retweeted_status']['in_reply_to_status_url'] = $originalReply->bestUrl();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$original = null;
|
||||||
|
}
|
||||||
|
|
||||||
return $arr;
|
return $arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,11 +116,24 @@ RealtimeUpdate = {
|
||||||
|
|
||||||
makeNoticeItem: function(data)
|
makeNoticeItem: function(data)
|
||||||
{
|
{
|
||||||
|
if (data.hasOwnProperty('retweeted_status')) {
|
||||||
|
original = data['retweeted_status'];
|
||||||
|
repeat = data;
|
||||||
|
data = original;
|
||||||
|
unique = repeat['id'];
|
||||||
|
responsible = repeat['user'];
|
||||||
|
} else {
|
||||||
|
original = null;
|
||||||
|
repeat = null;
|
||||||
|
unique = data['id'];
|
||||||
|
responsible = data['user'];
|
||||||
|
}
|
||||||
|
|
||||||
user = data['user'];
|
user = data['user'];
|
||||||
html = data['html'].replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"');
|
html = data['html'].replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"');
|
||||||
source = data['source'].replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"');
|
source = data['source'].replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"');
|
||||||
|
|
||||||
ni = "<li class=\"hentry notice\" id=\"notice-"+data['id']+"\">"+
|
ni = "<li class=\"hentry notice\" id=\"notice-"+unique+"\">"+
|
||||||
"<div class=\"entry-title\">"+
|
"<div class=\"entry-title\">"+
|
||||||
"<span class=\"vcard author\">"+
|
"<span class=\"vcard author\">"+
|
||||||
"<a href=\""+user['profile_url']+"\" class=\"url\">"+
|
"<a href=\""+user['profile_url']+"\" class=\"url\">"+
|
||||||
|
@ -142,15 +155,24 @@ RealtimeUpdate = {
|
||||||
ni = ni+" <a class=\"response\" href=\""+data['in_reply_to_status_url']+"\">in context</a>";
|
ni = ni+" <a class=\"response\" href=\""+data['in_reply_to_status_url']+"\">in context</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
ni = ni+"</div>"+
|
if (repeat) {
|
||||||
"<div class=\"notice-options\">";
|
ru = repeat['user'];
|
||||||
|
ni = ni + "<span class=\"repeat vcard\">Repeated by " +
|
||||||
|
"<a href=\"" + ru['profile_url'] + "\" class=\"url\">" +
|
||||||
|
"<img src=\"" + ru['profile_image_url'] + "\" class=\"avatar photo\" width=\"24\" height=\"24\" alt=\"" + ru['screen_name'] + "\"/>" +
|
||||||
|
"<span class=\"nickname\">"+ ru['screen_name'] + "</span></a></span>";
|
||||||
|
}
|
||||||
|
|
||||||
|
ni = ni+"</div>";
|
||||||
|
|
||||||
|
ni = ni + "<div class=\"notice-options\">";
|
||||||
|
|
||||||
if (RealtimeUpdate._userid != 0) {
|
if (RealtimeUpdate._userid != 0) {
|
||||||
var input = $("form#form_notice fieldset input#token");
|
var input = $("form#form_notice fieldset input#token");
|
||||||
var session_key = input.val();
|
var session_key = input.val();
|
||||||
ni = ni+RealtimeUpdate.makeFavoriteForm(data['id'], session_key);
|
ni = ni+RealtimeUpdate.makeFavoriteForm(data['id'], session_key);
|
||||||
ni = ni+RealtimeUpdate.makeReplyLink(data['id'], data['user']['screen_name']);
|
ni = ni+RealtimeUpdate.makeReplyLink(data['id'], data['user']['screen_name']);
|
||||||
if (RealtimeUpdate._userid == data['user']['id']) {
|
if (RealtimeUpdate._userid == responsible['id']) {
|
||||||
ni = ni+RealtimeUpdate.makeDeleteLink(data['id']);
|
ni = ni+RealtimeUpdate.makeDeleteLink(data['id']);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -158,7 +180,8 @@ RealtimeUpdate = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ni = ni+"</div>"+
|
ni = ni+"</div>";
|
||||||
|
|
||||||
"</li>";
|
"</li>";
|
||||||
return ni;
|
return ni;
|
||||||
},
|
},
|
||||||
|
@ -330,7 +353,7 @@ RealtimeUpdate = {
|
||||||
{
|
{
|
||||||
$('.notices .entry-title a, .notices .entry-content a').bind('click', function() {
|
$('.notices .entry-title a, .notices .entry-content a').bind('click', function() {
|
||||||
window.open(this.href, '');
|
window.open(this.href, '');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user