thumbnails now work, queet box bugfix, qvitter compact format removed

This commit is contained in:
Hannes Mannerheim 2014-10-02 19:24:54 +02:00
parent ac2d8d27a1
commit 45adaa560a
13 changed files with 1598 additions and 1660 deletions

View File

@ -101,17 +101,7 @@ class QvitterPlugin extends Plugin {
array('action' => 'apiqvitterallfollowing',
'id' => Nickname::INPUT_FMT));
$m->connect('api/qvitter/update_cover_photo.json',
array('action' => 'ApiUpdateCoverPhoto'));
$m->connect('api/qvitter/statuses/friends_timeline.json',
array('action' => 'apiqvitterfriends'));
$m->connect('api/qvitter/statuses/friends_timeline/:id.json',
array('action' => 'apiqvitterfriends',
'id' => Nickname::INPUT_FMT));
$m->connect('api/qvitter/statuses/mentions/:id.json',
array('action' => 'apiqvittermentions',
'id' => Nickname::INPUT_FMT));
$m->connect('api/qvitter/statuses/mentions.:format',
array('action' => 'apiqvittermentions'));
array('action' => 'ApiUpdateCoverPhoto'));
$m->connect('api/qvitter/statuses/notifications.json',
array('action' => 'apiqvitternotifications'));
$m->connect(':nickname/notifications',
@ -259,7 +249,7 @@ class QvitterPlugin extends Plugin {
/**
* Group addresses in API response
* Add stuff to notices in API responses
*
* @param Action $action action being executed
*
@ -269,6 +259,7 @@ class QvitterPlugin extends Plugin {
function onNoticeSimpleStatusArray($notice, &$twitter_status)
{
// groups
$notice_groups = $notice->getGroups();
$group_addressees = false;
foreach($notice_groups as $g) {
@ -278,6 +269,35 @@ class QvitterPlugin extends Plugin {
if($group_addressees == '') $group_addressees = false;
$twitter_status['statusnet_in_groups'] = $group_addressees;
// thumb urls
// find all thumbs
$attachments = $notice->attachments();
$attachment_url_to_thumb = array();
if (!empty($attachments)) {
foreach ($attachments as $attachment) {
try {
$enclosure_o = $attachment->getEnclosure();
$thumb = File_thumbnail::getKV('file_id', $attachment->id);
if(isset($thumb->url)) {
$attachment_url_to_thumb[$enclosure_o->url] = $thumb->url;
}
} catch (ServerException $e) {
// There was not enough metadata available
}
}
}
// add thumbs to $twitter_status
if (!empty($twitter_status['attachments'])) {
foreach ($twitter_status['attachments'] as &$attachment) {
if (!empty($attachment_url_to_thumb[$attachment['url']])) {
$attachment['thumb_url'] = $attachment_url_to_thumb[$attachment['url']];
}
}
}
return true;
}

View File

@ -1,46 +0,0 @@
<?php
/* · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· ·
· ·
· Q V I T T E R ·
· ·
· http://github.com/hannesmannerheim/qvitter ·
· ·
· ·
· <o) ·
· /_//// ·
· (____/ ·
· (o< ·
· o> \\\\_\ ·
· \\) \____) ·
· ·
· ·
· ·
· Qvitter is free software: you can redistribute it and / or modify it ·
· under the terms of the GNU Affero General Public License as published by ·
· the Free Software Foundation, either version three of the License or (at ·
· your option) any later version. ·
· ·
· Qvitter is distributed in hope that it will be useful but WITHOUT ANY ·
· WARRANTY; without even the implied warranty of MERCHANTABILTY or FITNESS ·
· FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for ·
· more details. ·
· ·
· You should have received a copy of the GNU Affero General Public License ·
· along with Qvitter. If not, see <http://www.gnu.org/licenses/>. ·
· ·
· Contact h@nnesmannerhe.im if you have any questions. ·
· ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
if (!defined('GNUSOCIAL')) { exit(1); }
class ApiQvitterFriendsAction extends ApiTimelineFriendsAction
{
function showTimeline()
{
ApiQvitterAction::showQvitterJsonTimeline($this->notices);
}
}

View File

@ -1,44 +0,0 @@
<?php
/* · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· ·
· ·
· Q V I T T E R ·
· ·
· http://github.com/hannesmannerheim/qvitter ·
· ·
· ·
· <o) ·
· /_//// ·
· (____/ ·
· (o< ·
· o> \\\\_\ ·
· \\) \____) ·
· ·
· ·
· ·
· Qvitter is free software: you can redistribute it and / or modify it ·
· under the terms of the GNU Affero General Public License as published by ·
· the Free Software Foundation, either version three of the License or (at ·
· your option) any later version. ·
· ·
· Qvitter is distributed in hope that it will be useful but WITHOUT ANY ·
· WARRANTY; without even the implied warranty of MERCHANTABILTY or FITNESS ·
· FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for ·
· more details. ·
· ·
· You should have received a copy of the GNU Affero General Public License ·
· along with Qvitter. If not, see <http://www.gnu.org/licenses/>. ·
· ·
· Contact h@nnesmannerhe.im if you have any questions. ·
· ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
if (!defined('GNUSOCIAL')) { exit(1); }
class ApiQvitterMentionsAction extends ApiTimelineMentionsAction
{
function showTimeline()
{
ApiQvitterAction::showQvitterJsonTimeline($this->notices);
}
}

View File

@ -141,7 +141,7 @@ class ApiTimelinePublicAndExternalAction extends ApiPrivateAuthAction
break;
case 'json':
ApiQvitterAction::showQvitterJsonTimeline($this->notices);
$this->showJsonTimeline($this->notices);
break;
case 'as':
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);

View File

@ -351,9 +351,9 @@ class QvitterAction extends ApiAction
</div>
</div>
<div class="menu-container">
<a class="stream-selection friends-timeline" data-stream-header="" data-stream-name="qvitter/statuses/friends_timeline.json"><i class="chev-right"></i></a>
<a class="stream-selection friends-timeline" data-stream-header="" data-stream-name="statuses/friends_timeline.json"><i class="chev-right"></i></a>
<a class="stream-selection notifications" data-stream-header="" data-stream-name="qvitter/statuses/notifications.json"><span id="unseen-notifications"></span><i class="chev-right"></i></a>
<a class="stream-selection mentions" data-stream-header="" data-stream-name="qvitter/statuses/mentions.json"><i class="chev-right"></i></a>
<a class="stream-selection mentions" data-stream-header="" data-stream-name="statuses/mentions.json"><i class="chev-right"></i></a>
<a class="stream-selection my-timeline" data-stream-header="@statuses/user_timeline.json" data-stream-name="statuses/user_timeline.json"><i class="chev-right"></i></a>
<a class="stream-selection favorites" data-stream-header="" data-stream-name="favorites.json"><i class="chev-right"></i></a>
<a href="<?php print $instanceurl ?>" class="stream-selection public-timeline" data-stream-header="" data-stream-name="statuses/public_timeline.json"><i class="chev-right"></i></a>

View File

@ -1,160 +0,0 @@
<?php
/* · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· ·
· ·
· Q V I T T E R ·
· ·
· http://github.com/hannesmannerheim/qvitter ·
· ·
· ·
· <o) ·
· /_//// ·
· (____/ ·
· (o< ·
· o> \\\\_\ ·
· \\) \____) ·
· ·
· ·
· ·
· Qvitter is free software: you can redistribute it and / or modify it ·
· under the terms of the GNU Affero General Public License as published by ·
· the Free Software Foundation, either version three of the License or (at ·
· your option) any later version. ·
· ·
· Qvitter is distributed in hope that it will be useful but WITHOUT ANY ·
· WARRANTY; without even the implied warranty of MERCHANTABILTY or FITNESS ·
· FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for ·
· more details. ·
· ·
· You should have received a copy of the GNU Affero General Public License ·
· along with Qvitter. If not, see <http://www.gnu.org/licenses/>. ·
· ·
· Contact h@nnesmannerhe.im if you have any questions. ·
· ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
if (!defined('GNUSOCIAL')) { exit(1); }
class ApiQvitterAction extends ApiAction
{
function showQvitterJsonTimeline($notice)
{
$this->initDocument('json');
$statuses = array();
if (is_array($notice)) {
$notice = new ArrayWrapper($notice);
}
while ($notice->fetch()) {
try {
$twitter_status = $this->twitterStatusArray($notice);
array_push($statuses, $twitter_status);
} catch (Exception $e) {
common_log(LOG_ERR, $e->getMessage());
continue;
}
}
$simplified_statuses = new stdClass();
$i=0;
foreach($statuses as &$s) {
foreach($s as &$ss) {
if($ss === false || $ss === null) {
$ss=0;
}
elseif($ss === true) {
$ss=1;
}
}
foreach($s['user'] as &$su) {
if($su === false || $su === null) {
$su=0;
}
elseif($su === true) {
$su=1;
}
}
$simplified_statuses->s[$i][0] = $s['id'];
$simplified_statuses->s[$i][1] = strtotime($s['created_at']);
$simplified_statuses->s[$i][2] = $s['text'];
$simplified_statuses->s[$i][3] = $s['statusnet_html'];
$simplified_statuses->s[$i][4] = $s['in_reply_to_status_id'];
$simplified_statuses->s[$i][5] = $s['in_reply_to_user_id'];
$simplified_statuses->s[$i][6] = $s['in_reply_to_screen_name'];
$simplified_statuses->s[$i][7] = $s['favorited'];
$simplified_statuses->s[$i][8] = $s['repeated'];
$simplified_statuses->s[$i][9] = $s['statusnet_in_groups'];
$simplified_statuses->s[$i][10] = $s['user']['id'];
$simplified_statuses->s[$i][11] = $s['statusnet_conversation_id'];
$simplified_statuses->s[$i][12] = $s['source'];
$simplified_statuses->u[$s['user']['id']][0] = $s['user']['screen_name'];
$simplified_statuses->u[$s['user']['id']][1] = $s['user']['name'];
$simplified_statuses->u[$s['user']['id']][2] = $s['user']['location'];
$simplified_statuses->u[$s['user']['id']][3] = $s['user']['description'];
$simplified_statuses->u[$s['user']['id']][4] = $s['user']['profile_image_url_profile_size'];
$simplified_statuses->u[$s['user']['id']][5] = $s['user']['profile_image_url_original'];
$simplified_statuses->u[$s['user']['id']][6] = $s['user']['groups_count'];
$simplified_statuses->u[$s['user']['id']][7] = $s['user']['linkcolor'];
$simplified_statuses->u[$s['user']['id']][8] = $s['user']['backgroundcolor'];
$simplified_statuses->u[$s['user']['id']][9] = $s['user']['url'];
$simplified_statuses->u[$s['user']['id']][10] = $s['user']['followers_count'];
$simplified_statuses->u[$s['user']['id']][11] = $s['user']['friends_count'];
$simplified_statuses->u[$s['user']['id']][12] = $s['user']['favourites_count'];
$simplified_statuses->u[$s['user']['id']][13] = $s['user']['statuses_count'];
$simplified_statuses->u[$s['user']['id']][14] = $s['user']['following'];
$simplified_statuses->u[$s['user']['id']][15] = $s['user']['statusnet_blocking'];
$simplified_statuses->u[$s['user']['id']][16] = $s['user']['statusnet_profile_url'];
$simplified_statuses->u[$s['user']['id']][17] = $s['user']['cover_photo'];
if(isset($s['retweeted_status'])) {
$simplified_statuses->s[$i][13][0] = $s['retweeted_status']['id'];
$simplified_statuses->s[$i][13][1] = strtotime($s['retweeted_status']['created_at']);
$simplified_statuses->s[$i][13][2] = $s['retweeted_status']['text'];
$simplified_statuses->s[$i][13][3] = $s['retweeted_status']['statusnet_html'];
$simplified_statuses->s[$i][13][4] = $s['retweeted_status']['in_reply_to_status_id'];
$simplified_statuses->s[$i][13][5] = $s['retweeted_status']['in_reply_to_user_id'];
$simplified_statuses->s[$i][13][6] = $s['retweeted_status']['in_reply_to_screen_name'];
$simplified_statuses->s[$i][13][7] = $s['retweeted_status']['favorited'];
$simplified_statuses->s[$i][13][8] = $s['retweeted_status']['repeated'];
$simplified_statuses->s[$i][13][9] = $s['retweeted_status']['statusnet_in_groups'];
$simplified_statuses->s[$i][13][10] = $s['retweeted_status']['user']['id'];
$simplified_statuses->s[$i][13][11] = $s['retweeted_status']['statusnet_conversation_id'];
$simplified_statuses->s[$i][13][12] = $s['retweeted_status']['source'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][0] = $s['retweeted_status']['user']['screen_name'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][1] = $s['retweeted_status']['user']['name'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][2] = $s['retweeted_status']['user']['location'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][3] = $s['retweeted_status']['user']['description'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][4] = $s['retweeted_status']['user']['profile_image_url_profile_size'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][5] = $s['retweeted_status']['user']['profile_image_url_original'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][6] = $s['retweeted_status']['user']['groups_count'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][7] = $s['retweeted_status']['user']['linkcolor'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][8] = $s['retweeted_status']['user']['backgroundcolor'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][9] = $s['retweeted_status']['user']['url'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][10] = $s['retweeted_status']['user']['followers_count'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][11] = $s['retweeted_status']['user']['friends_count'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][12] = $s['retweeted_status']['user']['favourites_count'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][13] = $s['retweeted_status']['user']['statuses_count'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][14] = $s['retweeted_status']['user']['following'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][15] = $s['retweeted_status']['user']['statusnet_blocking'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][16] = $s['retweeted_status']['user']['statusnet_profile_url'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][17] = $s['retweeted_status']['user']['cover_photo'];
}
$i++;
}
$this->showJsonObjects($simplified_statuses);
$this->endDocument('json');
}
}

View File

@ -2003,6 +2003,7 @@ ul.queet-actions li .icon.sm-fav {
border: 1px solid rgba(0, 0, 0, 0.1);
border-radius: 6px 6px 6px 6px;
margin:8px 0;
overflow: hidden;
}
.stream-item.expanded > .queet{
}
@ -3619,7 +3620,7 @@ body.rtl .profile-banner-footer ul.stats {
content: "@";
}
.queet-text .vcard .group:before,
.queet-text .h-card .group:before {
.queet-text .h-card.group:before {
content:"!";
}
.queet.rtl .queet-text .vcard .group:before,

File diff suppressed because it is too large Load Diff

View File

@ -94,8 +94,7 @@ function getFromAPI(stream, actionOnSuccess) {
dataType: 'json',
success: function(data) {
// decode if we have a qvitter compact stream
data = decodeQvitterCompactFormat(data);
data = convertEmptyObjectToEmptyArray(data);
actionOnSuccess(data);
},
@ -256,8 +255,7 @@ function postActionToAPI(action, actionOnSuccess) {
error: function(data){ actionOnSuccess(false); console.log(data); },
success: function(data) {
// decode if we have a qvitter compact stream
data = decodeQvitterCompactFormat(data);
data = convertEmptyObjectToEmptyArray(data);
actionOnSuccess(data);
}

View File

@ -331,9 +331,9 @@ function setNewCurrentStream(stream,actionOnSuccess,setLocation) {
if(stream.substring(0,45) == 'statuses/followers.json?count=20&screen_name='
|| stream.substring(0,43) == 'statuses/friends.json?count=20&screen_name='
|| stream.substring(0,48) == 'statusnet/groups/list.json?count=10&screen_name='
|| stream.substring(0,51) == 'qvitter/statuses/friends_timeline.json?screen_name='
|| stream.substring(0,43) == 'statuses/friends_timeline.json?screen_name='
|| stream.substring(0,27) == 'favorites.json?screen_name='
|| stream.substring(0,43) == 'qvitter/statuses/mentions.json?screen_name='
|| stream.substring(0,35) == 'statuses/mentions.json?screen_name='
|| stream.substring(0,27) == 'statuses/user_timeline.json') {
var defaultStreamName = 'statuses/user_timeline.json?' + stream.substring(stream.indexOf('screen_name='));
var streamHeader = '@' + stream.substring(stream.lastIndexOf('=')+1);
@ -346,8 +346,8 @@ function setNewCurrentStream(stream,actionOnSuccess,setLocation) {
var streamHeader = '@' + window.loggedIn.screen_name;
}
// if this is one of the default streams, get header from DOM
else if(stream == 'qvitter/statuses/friends_timeline.json'
|| stream == 'qvitter/statuses/mentions.json'
else if(stream == 'statuses/friends_timeline.json'
|| stream == 'statuses/mentions.json'
|| stream == 'qvitter/statuses/notifications.json'
|| stream == 'favorites.json'
|| stream == 'statuses/public_timeline.json'
@ -389,7 +389,7 @@ function setNewCurrentStream(stream,actionOnSuccess,setLocation) {
else if(stream.substring(0,40) == 'statuses/user_timeline.json?screen_name=') {
var h2FeedHeader = window.sL.notices + '<div class="queet-streams">/ <a class="queet-stream mentions">' + window.sL.mentions + '</a> / <a class="queet-stream favorites">' + window.sL.favoritesNoun +'</a></div>';
}
else if(stream.substring(0,43) == 'qvitter/statuses/mentions.json?screen_name=') {
else if(stream.substring(0,35) == 'statuses/mentions.json?screen_name=') {
var h2FeedHeader = '<div class="queet-streams"><a class="queet-stream queets">' + window.sL.notices + '</a> /</div>' + window.sL.mentions + '<div class="queet-streams">/ <a class="queet-stream favorites">' + window.sL.favoritesNoun + '</a></div>';
}
else if(stream.substring(0,27) == 'favorites.json?screen_name=') {
@ -404,7 +404,7 @@ function setNewCurrentStream(stream,actionOnSuccess,setLocation) {
else if(stream.substring(0,24) == 'statusnet/groups/admins/') {
var h2FeedHeader = window.sL.adminCount;
}
else if(stream.substring(0,51) == 'qvitter/statuses/friends_timeline.json?screen_name=') {
else if(stream.substring(0,43) == 'statuses/friends_timeline.json?screen_name=') {
var h2FeedHeader = '<span style="unicode-bidi:bidi-override;direction:ltr;">' + streamHeader + '/all</span>'; // ugly rtl fix, sry, we should have translations for this stream header
}
else {
@ -452,9 +452,9 @@ function setNewCurrentStream(stream,actionOnSuccess,setLocation) {
if(stream.substring(0,23) == 'statuses/followers.json'
|| stream.substring(0,21) == 'statuses/friends.json'
|| stream.substring(0,26) == 'statusnet/groups/list.json'
|| stream.substring(0,43) == 'qvitter/statuses/mentions.json?screen_name='
|| stream.substring(0,35) == 'statuses/mentions.json?screen_name='
|| stream.substring(0,27) == 'favorites.json?screen_name='
|| stream.substring(0,51) == 'qvitter/statuses/friends_timeline.json?screen_name=') {
|| stream.substring(0,43) == 'statuses/friends_timeline.json?screen_name=') {
getFromAPI(defaultStreamName + '&count=1', function(profile_data){
if(profile_data) {
getFromAPI(stream, function(user_data){
@ -565,7 +565,7 @@ function convertStreamToPath(stream) {
var screenName = stream.substring(stream.lastIndexOf('=')+1);
return screenName + '/subscriptions';
}
else if(stream.substring(0,43) == 'qvitter/statuses/mentions.json?screen_name=') {
else if(stream.substring(0,35) == 'statuses/mentions.json?screen_name=') {
var screenName = stream.substring(stream.indexOf('=')+1);
return screenName + '/replies';
}
@ -583,7 +583,7 @@ function convertStreamToPath(stream) {
else if(stream == 'statuses/friends.json?count=20') {
return window.loggedIn.screen_name + '/subscriptions';
}
else if(stream == 'qvitter/statuses/mentions.json') {
else if(stream == 'statuses/mentions.json') {
return window.loggedIn.screen_name + '/replies';
}
else if(stream == 'qvitter/statuses/notifications.json') {
@ -599,10 +599,10 @@ function convertStreamToPath(stream) {
var screenName = stream.substring(stream.indexOf('=')+1);
return screenName;
}
else if(stream == 'qvitter/statuses/friends_timeline.json') {
else if(stream == 'statuses/friends_timeline.json') {
return window.loggedIn.screen_name + '/all';
}
else if(stream.substring(0,51) == 'qvitter/statuses/friends_timeline.json?screen_name=') {
else if(stream.substring(0,51) == 'statuses/friends_timeline.json?screen_name=') {
var screenName = stream.substring(stream.indexOf('=')+1);
return screenName + '/all';
}
@ -685,10 +685,10 @@ function getStreamFromUrl() {
var userToStream = loc.replace('/','').replace('/all','');
if(userToStream.length>0) {
if(window.loggedIn.screen_name == userToStream) {
streamToSet = 'qvitter/statuses/friends_timeline.json';
streamToSet = 'statuses/friends_timeline.json';
}
else {
streamToSet = 'qvitter/statuses/friends_timeline.json?screen_name=' + userToStream;
streamToSet = 'statuses/friends_timeline.json?screen_name=' + userToStream;
}
}
}
@ -698,10 +698,10 @@ function getStreamFromUrl() {
var userToStream = loc.replace('/','').replace('/replies','');
if(userToStream.length>0) {
if(window.loggedIn.screen_name == userToStream) {
streamToSet = 'qvitter/statuses/mentions.json';
streamToSet = 'statuses/mentions.json';
}
else {
streamToSet = 'qvitter/statuses/mentions.json?screen_name=' + userToStream;
streamToSet = 'statuses/mentions.json?screen_name=' + userToStream;
}
}
}

View File

@ -1869,10 +1869,10 @@ $('#settings').html(window.sL.settings);
$('#other-servers-link').html(window.sL.otherServers);
$('.language-dropdown .dropdown-toggle small').html(window.sL.languageSelected);
$('.language-dropdown .current-language').html(window.sL.languageName);
$('.stream-selection[data-stream-name="qvitter/statuses/friends_timeline.json"]').prepend(window.sL.timeline);
$('.stream-selection[data-stream-name="qvitter/statuses/friends_timeline.json"]').attr('data-stream-header',window.sL.timeline);
$('.stream-selection[data-stream-name="qvitter/statuses/mentions.json"]').prepend(window.sL.mentions);
$('.stream-selection[data-stream-name="qvitter/statuses/mentions.json"]').attr('data-stream-header',window.sL.mentions);
$('.stream-selection[data-stream-name="statuses/friends_timeline.json"]').prepend(window.sL.timeline);
$('.stream-selection[data-stream-name="statuses/friends_timeline.json"]').attr('data-stream-header',window.sL.timeline);
$('.stream-selection[data-stream-name="statuses/mentions.json"]').prepend(window.sL.mentions);
$('.stream-selection[data-stream-name="statuses/mentions.json"]').attr('data-stream-header',window.sL.mentions);
$('.stream-selection[data-stream-name="qvitter/statuses/notifications.json"]').prepend(window.sL.notifications);
$('.stream-selection[data-stream-name="qvitter/statuses/notifications.json"]').attr('data-stream-header',window.sL.notifications);
$('.stream-selection[data-stream-name="favorites.json"]').prepend(window.sL.favoritesNoun);

View File

@ -335,92 +335,21 @@ function timestampToTwitterDate(timestamp) {
/* ·
·
· Decode Qvitter's compact API reponse
·
· @param data: the data returned from qvitter's compact api response
·
· @return data formatted as the non-compact "[old] twitter style" api response
· If we want to make sure we have empty arrays, not empty objects
·
· · · · · · · · · · */
function decodeQvitterCompactFormat(data) {
function convertEmptyObjectToEmptyArray(data) {
// empty object? return empty array instead...
if($.isEmptyObject(data)) {
return [];
}
// leave data unchanged if we don't recognize it
else if(typeof data.s == 'undefined') {
else {
return data;
}
// decode
else {
var users = new Object();
var i = 0;
$.each(data.u, function(k,v){
users[k] = new Object;
users[k].id = k;
users[k].screen_name = v[0];
users[k].name = (v[1]==0?null:v[1]);
users[k].location = (v[2]==0?null:v[2]);
users[k].description = (v[3]==0?null:v[3]);
users[k].profile_image_url_profile_size = v[4];
users[k].profile_image_url_original = v[5];
users[k].groups_count = v[6];
users[k].linkcolor = (v[7]==0?false:v[7]);
users[k].backgroundcolor = (v[8]==0?false:v[8]);
users[k].url = (v[9]==0?null:v[9]);
users[k].followers_count = v[10];
users[k].friends_count = v[11];
users[k].favourites_count = v[12];
users[k].statuses_count = v[13];
users[k].following = (v[14]==0?false:v[14]);
users[k].statusnet_blocking = (v[15]==0?false:v[15]);
users[k].statusnet_profile_url = v[16];
users[k].cover_photo = (v[17]==0?false:v[17]);
i++;
});
var unqvitter = Array();
var i = 0;
$.each(data.s, function(k,v){
unqvitter[i] = new Object;
unqvitter[i].id = v[0];
unqvitter[i].created_at = timestampToTwitterDate(v[1]);
unqvitter[i].text = v[2];
unqvitter[i].statusnet_html = v[3];
unqvitter[i].in_reply_to_status_id = (v[4]==0?null:v[4]);
unqvitter[i].in_reply_to_user_id = (v[5]==0?null:v[5]);
unqvitter[i].in_reply_to_screen_name = (v[6]==0?null:v[6]);
unqvitter[i].favorited = (v[7]==0?false:v[7]);
unqvitter[i].repeated = (v[8]==0?false:v[8]);
unqvitter[i].statusnet_in_groups = (v[9]==0?false:v[9]);
unqvitter[i].user = users[v[10]];
unqvitter[i].statusnet_conversation_id = v[11];
unqvitter[i].uri = window.siteInstanceURL + 'notice/' + v[0];
unqvitter[i].source = (v[12]==0?null:v[12]);
if(typeof v[13] != 'undefined') {
unqvitter[i].retweeted_status = new Object;
unqvitter[i].retweeted_status.id = v[13][0];
unqvitter[i].retweeted_status.created_at = timestampToTwitterDate(v[13][1]);
unqvitter[i].retweeted_status.text = v[13][2];
unqvitter[i].retweeted_status.statusnet_html = v[13][3];
unqvitter[i].retweeted_status.in_reply_to_status_id = (v[13][4]==0?null:v[13][4]);
unqvitter[i].retweeted_status.in_reply_to_user_id = (v[13][5]==0?null:v[13][5]);
unqvitter[i].retweeted_status.in_reply_to_screen_name = (v[13][6]==0?null:v[13][6]);
unqvitter[i].retweeted_status.favorited = (v[13][7]==0?false:v[13][7]);
unqvitter[i].retweeted_status.repeated = (v[13][8]==0?false:v[13][8]);
unqvitter[i].retweeted_status.statusnet_in_groups = (v[13][9]==0?false:v[13][9]);
unqvitter[i].retweeted_status.user = users[v[13][10]];
unqvitter[i].retweeted_status.statusnet_conversation_id = v[13][11];
unqvitter[i].retweeted_status.uri = window.siteInstanceURL + 'notice/' + v[13][0];
unqvitter[i].retweeted_status.source = (v[13][12]==0?null:v[13][12]);
}
i++;
});
return unqvitter;
}
}

View File

@ -665,7 +665,7 @@ $('body').on('click','.profile-banner-footer .stats li a, .queet-stream',functio
setNewCurrentStream('statuses/user_timeline.json?screen_name=' + screenName,function(){},true);
}
else if($(this).hasClass('mentions')) {
setNewCurrentStream('qvitter/statuses/mentions.json?screen_name=' + screenName,function(){},true);
setNewCurrentStream('statuses/mentions.json?screen_name=' + screenName,function(){},true);
}
else if($(this).hasClass('favorites')) {
setNewCurrentStream('favorites.json?screen_name=' + screenName,function(){},true);
@ -739,11 +739,11 @@ $(document).on('click','a', function(e) {
// logged in users streams
else if ($(this).attr('href').replace('http://','').replace('https://','').replace(window.siteRootDomain + '/' + window.loggedIn.screen_name,'') == '/all') {
e.preventDefault();
setNewCurrentStream('qvitter/statuses/friends_timeline.json',function(){},true);
setNewCurrentStream('statuses/friends_timeline.json',function(){},true);
}
else if ($(this).attr('href').replace('http://','').replace('https://','').replace(window.siteRootDomain + '/' + window.loggedIn.screen_name,'') == '/replies') {
e.preventDefault();
setNewCurrentStream('qvitter/statuses/mentions.json',function(){},true);
setNewCurrentStream('statuses/mentions.json',function(){},true);
}
else if ($(this).attr('href').replace('http://','').replace('https://','').replace(window.siteRootDomain + '/' + window.loggedIn.screen_name,'') == '/notifications') {
e.preventDefault();
@ -1317,7 +1317,13 @@ $('body').on('click','.action-reply-container',function(){
$queetHtmlExpandedContent.remove();
var queetHtmlWithoutFooter = $queetHtml.html();
popUpAction('popup-reply-' + this_stream_item_id, window.sL.replyTo + ' ' + this_stream_item.find('.screen-name').html(),replyFormHtml(this_stream_item,this_stream_item_id),queetHtmlWithoutFooter);
$('#popup-reply-' + this_stream_item_id).find('.modal-body').find('.queet-box').width($('#popup-reply-' + this_stream_item_id).find('.modal-body').find('.inline-reply-queetbox').width()-20);
// fix the width of the queet box, otherwise the syntax highlighting break
var queetBoxWidth = $('#popup-reply-' + this_stream_item_id).find('.modal-body').find('.inline-reply-queetbox').width()-20;
$('#popup-reply-' + this_stream_item_id).find('.modal-body').find('.queet-box-syntax').width(queetBoxWidth);
$('#popup-reply-' + this_stream_item_id).find('.modal-body').find('.syntax-middle').width(queetBoxWidth);
$('#popup-reply-' + this_stream_item_id).find('.modal-body').find('.two').width(queetBoxWidth);
$('#popup-reply-' + this_stream_item_id).find('.modal-body').find('.queet-box').trigger('click'); // expand
});