"follows you" badge in profile card

This commit is contained in:
Hannes Mannerheim 2014-09-30 14:52:41 +02:00
parent 91291925c0
commit ac2d8d27a1
7 changed files with 1753 additions and 1492 deletions

View File

@ -283,18 +283,22 @@ class QvitterPlugin extends Plugin {
/**
* Cover photo in API response
*
* @param Action $action action being executed
* Cover photo in API response, also follows_you
*
* @return boolean hook return
*/
function onTwitterUserArray($profile, &$twitter_user)
function onTwitterUserArray($profile, &$twitter_user, $scoped)
{
$twitter_user['cover_photo'] = Profile_prefs::getConfigData($profile, 'qvitter', 'cover_photo');
// follows me?
if ($scoped) {
$twitter_user['follows_you'] = $profile->isSubscribed($scoped);
}
return true;
}

View File

@ -43,7 +43,7 @@ Note: Qvitter is tested with GNU Social version 1.1.1-alpha2 (7e47026085fa4f2071
TODO
----
1. "following you" badge on other peoples profiles
1. avatar upload from profile card
1. better user popup, with e.g. latest queets

View File

@ -2860,13 +2860,27 @@ button.signup-btn.disabled,
}
.profile-header-inner .profile-card-inner h2.username {
margin-top:0;
color: #FFFFFF;
color: #FFFFFF;
font-size: 18px;
font-weight: normal;
line-height: 24px;
margin-bottom: 1px;
text-rendering: optimizelegibility;
}
.profile-header-inner .profile-card-inner h2.username .follows-you {
display:inline-block;
font-size:11px;
color:#eee;
background-color:rgba(0,0,0,0.5);
padding:3px 5px;
height:15px;
line-height:15px;
border-radius:3px;
margin-left:7px;
text-transform:uppercase;
}
.profile-header-inner .profile-card-inner h2.username a {
color:#fff;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

File diff suppressed because one or more lines are too long

View File

@ -161,6 +161,12 @@ function profileCardFromFirstObject(data,screen_name) {
first.user.cover_photo = first.user.profile_image_url_original;
}
// follows me?
var follows_you = '';
if(first.user.follows_you === true && window.myUserID != first.user.id) {
var follows_you = '<span class="follows-you">' + window.sL.followsYou + '</span>';
}
// show user actions if logged in
var followingClass = '';
if(first.user.following) {
@ -189,7 +195,7 @@ function profileCardFromFirstObject(data,screen_name) {
$('#feed').siblings('.profile-card').remove();
// insert profile card into dom
$('#feed').before('<div class="profile-card"><div class="profile-header-inner" style="background-image:url(' + first.user.cover_photo + ')"><div class="profile-header-inner-overlay"></div><a class="profile-picture" href="' + first.user.profile_image_url_original + '"><img src="' + first.user.profile_image_url_profile_size + '" /></a><div class="profile-card-inner"><h1 class="fullname">' + first.user.name + '<span></span></h1><h2 class="username"><span class="screen-name">@' + first.user.screen_name + '</span><span class="follow-status"></span></h2><div class="bio-container"><p>' + first.user.description + '</p></div><p class="location-and-url"><span class="location">' + first.user.location + '</span><span class="divider"> · </span><span class="url"><a href="' + first.user.url + '">' + first.user.url.replace('http://','').replace('https://','') + '</a></span></p></div></div><div class="profile-banner-footer"><ul class="stats"><li><a class="tweet-stats"><strong>' + first.user.statuses_count + '</strong>' + window.sL.notices + '</a></li><li><a class="following-stats"><strong>' + first.user.friends_count + '</strong>' + window.sL.following + '</a></li><li><a class="follower-stats"><strong>' + first.user.followers_count + '</strong>' + window.sL.followers + '</a></li><li><a class="groups-stats"><strong>' + first.user.groups_count + '</strong>' + window.sL.groups + '</a></li></ul>' + followButton + '<div class="clearfix"></div></div></div>');
$('#feed').before('<div class="profile-card"><div class="profile-header-inner" style="background-image:url(' + first.user.cover_photo + ')"><div class="profile-header-inner-overlay"></div><a class="profile-picture" href="' + first.user.profile_image_url_original + '"><img src="' + first.user.profile_image_url_profile_size + '" /></a><div class="profile-card-inner"><h1 class="fullname">' + first.user.name + '<span></span></h1><h2 class="username"><span class="screen-name">@' + first.user.screen_name + '</span>' + follows_you + '</h2><div class="bio-container"><p>' + first.user.description + '</p></div><p class="location-and-url"><span class="location">' + first.user.location + '</span><span class="divider"> · </span><span class="url"><a href="' + first.user.url + '">' + first.user.url.replace('http://','').replace('https://','') + '</a></span></p></div></div><div class="profile-banner-footer"><ul class="stats"><li><a class="tweet-stats"><strong>' + first.user.statuses_count + '</strong>' + window.sL.notices + '</a></li><li><a class="following-stats"><strong>' + first.user.friends_count + '</strong>' + window.sL.following + '</a></li><li><a class="follower-stats"><strong>' + first.user.followers_count + '</strong>' + window.sL.followers + '</a></li><li><a class="groups-stats"><strong>' + first.user.groups_count + '</strong>' + window.sL.groups + '</a></li></ul>' + followButton + '<div class="clearfix"></div></div></div>');
}
// if user hasn't queeted or if we're not allowed to read their queets
@ -202,6 +208,12 @@ function profileCardFromFirstObject(data,screen_name) {
data.cover_photo = data.profile_image_url_original;
}
// follows me?
var follows_you = '';
if(data.follows_you === true && window.myUserID != data.id) {
var follows_you = '<span class="follows-you">' + window.sL.followsYou + '</span>';
}
// show user actions if logged in
var followingClass = '';
if(data.following) {
@ -228,7 +240,7 @@ function profileCardFromFirstObject(data,screen_name) {
// remove any old profile card and show profile card
$('#feed').siblings('.profile-card').remove();
$('#feed').before('<div class="profile-card"><div class="profile-header-inner" style="background-image:url(' + data.cover_photo + ')"><div class="profile-header-inner-overlay"></div><a class="profile-picture" href="' + data.profile_image_url_original + '"><img src="' + data.profile_image_url_profile_size + '" /></a><div class="profile-card-inner"><h1 class="fullname">' + data.name + '<span></span></h1><h2 class="username"><span class="screen-name">@' + data.screen_name + '</span><span class="follow-status"></span></h2><div class="bio-container"><p>' + data.description + '</p></div><p class="location-and-url"><span class="location">' + data.location + '</span><span class="divider"> · </span><span class="url"><a href="' + data.url + '">' + data.url.replace('http://','').replace('https://','') + '</a></span></p></div></div><div class="profile-banner-footer"><ul class="stats"><li><a class="tweet-stats"><strong>' + data.statuses_count + '</strong>' + window.sL.notices + '</a></li><li><a class="following-stats"><strong>' + data.friends_count + '</strong>' + window.sL.following + '</a></li><li><a class="follower-stats"><strong>' + data.followers_count + '</strong>' + window.sL.followers + '</a></li><li><a class="groups-stats"><strong>' + data.groups_count + '</strong>' + window.sL.groups + '</a></li></ul>' + followButton + '<div class="clearfix"></div></div></div>');
$('#feed').before('<div class="profile-card"><div class="profile-header-inner" style="background-image:url(' + data.cover_photo + ')"><div class="profile-header-inner-overlay"></div><a class="profile-picture" href="' + data.profile_image_url_original + '"><img src="' + data.profile_image_url_profile_size + '" /></a><div class="profile-card-inner"><h1 class="fullname">' + data.name + '<span></span></h1><h2 class="username"><span class="screen-name">@' + data.screen_name + '</span>' + follows_you + '</span></h2><div class="bio-container"><p>' + data.description + '</p></div><p class="location-and-url"><span class="location">' + data.location + '</span><span class="divider"> · </span><span class="url"><a href="' + data.url + '">' + data.url.replace('http://','').replace('https://','') + '</a></span></p></div></div><div class="profile-banner-footer"><ul class="stats"><li><a class="tweet-stats"><strong>' + data.statuses_count + '</strong>' + window.sL.notices + '</a></li><li><a class="following-stats"><strong>' + data.friends_count + '</strong>' + window.sL.following + '</a></li><li><a class="follower-stats"><strong>' + data.followers_count + '</strong>' + window.sL.followers + '</a></li><li><a class="groups-stats"><strong>' + data.groups_count + '</strong>' + window.sL.groups + '</a></li></ul>' + followButton + '<div class="clearfix"></div></div></div>');
}});
}
}

View File

@ -150,6 +150,7 @@ window.l.es.notifications = 'Notificaciones';
window.l.es.xFavedYourQueet = 'marcó tu Queet como favorito';
window.l.es.xRepeatedYourQueet = 'te ha requitteado ';
window.l.es.xStartedFollowingYou = 'te ha seguido';
window.l.es.followsYou = 'te sigue';
@ -266,7 +267,7 @@ window.l.pt_br.notifications = 'Notificações';
window.l.pt_br.xFavedYourQueet = 'curtiu seu Queet';
window.l.pt_br.xRepeatedYourQueet = 'requeetou você';
window.l.pt_br.xStartedFollowingYou = 'seguiu você';
window.l.pt_br.followsYou = 'segue você';
@ -383,7 +384,7 @@ window.l.gl.notifications = 'Notificacións';
window.l.gl.xFavedYourQueet = 'marcou como favorito o teu chío';
window.l.gl.xRepeatedYourQueet = 'rechouchioute';
window.l.gl.xStartedFollowingYou = 'está a seguirte';
window.l.gl.followsYou = 'séguete';
// basque
window.l.eu = new Object();
@ -498,7 +499,7 @@ window.l.eu.notifications = 'Jakinarazpenak';
window.l.eu.xFavedYourQueet = 'erabiltzaileak gustuko du zure Txioa';
window.l.eu.xRepeatedYourQueet = 'erabiltzaileak bertxiotu zaitu';
window.l.eu.xStartedFollowingYou = 'jarraitzen hasi zaizu';
window.l.eu.followsYou = 'jarraitzen dizu';
// french
window.l.fr = new Object();
@ -613,7 +614,7 @@ window.l.fr.notifications = 'Notifications';
window.l.fr.xFavedYourQueet = 'a ajouté votre Queet à ses favoris ';
window.l.fr.xRepeatedYourQueet = 'vous a requeeté ';
window.l.fr.xStartedFollowingYou = 'vous a suivi';
window.l.fr.followsYou = 'vous suit';
// deutsch
window.l.de = new Object();
@ -740,7 +741,7 @@ window.l.de.notifications = 'Mitteilungen';
window.l.de.xFavedYourQueet = 'favorisierte Deinen Queet';
window.l.de.xRepeatedYourQueet = 'hat Dich requeetet';
window.l.de.xStartedFollowingYou = 'folgt Dir jetzt';
window.l.de.followsYou = 'folgt Dir';
// english
window.l.en = new Object();
@ -863,7 +864,7 @@ window.l.en.notifications = 'Notifications';
window.l.en.xFavedYourQueet = 'favorited your Queet';
window.l.en.xRepeatedYourQueet = 'requeeted you';
window.l.en.xStartedFollowingYou = 'followed you';
window.l.en.followsYou = 'follows you';
// simplified chinese
@ -979,7 +980,7 @@ window.l.zh_cn.notifications = '通知';
window.l.zh_cn.xFavedYourQueet = '收藏了你的推文';
window.l.zh_cn.xRepeatedYourQueet = '转推了你的推文';
window.l.zh_cn.xStartedFollowingYou = '关注了你';
window.l.zh_cn.followsYou = '关注了你';
// traditional chinese
@ -1095,7 +1096,7 @@ window.l.zh_tw.notifications = '通知';
window.l.zh_tw.xFavedYourQueet = '已收藏你的推文';
window.l.zh_tw.xRepeatedYourQueet = '已轉推你';
window.l.zh_tw.xStartedFollowingYou = '已跟隨你';
window.l.zh_tw.followsYou = '跟隨你';
// svenska
@ -1211,6 +1212,7 @@ window.l.sv.notifications = 'Notiser';
window.l.sv.xFavedYourQueet = 'favoritmarkerade ditt qvitter';
window.l.sv.xRepeatedYourQueet = 'requeetade dig';
window.l.sv.xStartedFollowingYou = 'följde dig';
window.l.sv.followsYou = 'följer dig';
// farsi/persian
window.l.fa = new Object();
@ -1325,6 +1327,7 @@ window.l.fa.notifications = 'آگاه‌سازی‌ها';
window.l.fa.xFavedYourQueet = 'موارد دلخواه خود را صدای جیر جیر';
window.l.fa.xRepeatedYourQueet = 'توییت شما را باز توییت کرد.';
window.l.fa.xStartedFollowingYou = 'شما را دنبال کرد';
window.l.fa.followsYou = 'شما را دنبال می‌کند';
// arabic
window.l.ar = new Object();
@ -1439,6 +1442,7 @@ window.l.ar.notifications = 'التنبيهات';
window.l.ar.xFavedYourQueet = 'بتفضيل تغريدتك';
window.l.ar.xRepeatedYourQueet = 'بإعادة تغريد';
window.l.ar.xStartedFollowingYou = 'بمتابعتك';
window.l.ar.followsYou = 'يُتابعك';
// esperanto
window.l.eo = new Object();
@ -1562,6 +1566,7 @@ window.l.eo.notifications = 'Sciigoj';
window.l.eo.xFavedYourQueet = 'ŝatataj via avizo';
window.l.eo.xRepeatedYourQueet = 'ripetis vin';
window.l.eo.xStartedFollowingYou = 'sekvas vin';
window.l.eo.followsYou = 'sekvas vin';
// italian
window.l.it = new Object();
@ -1685,6 +1690,7 @@ window.l.it.notifications = 'Notifiche';
window.l.it.xFavedYourQueet = 'ha aggiunto ai preferiti il tuo Queet';
window.l.it.xRepeatedYourQueet = 'ti ha requittato';
window.l.it.xStartedFollowingYou = 'ha iniziato a seguirti';
window.l.it.followsYou = 'ti segue';
// Norwegian
window.l.no = new Object();
@ -1799,6 +1805,7 @@ window.l.no.notifications = 'Varsler';
window.l.no.xFavedYourQueet = 'favorittmarkerte queeten din';
window.l.no.xRepeatedYourQueet = 'requeetet deg';
window.l.no.xStartedFollowingYou = 'følger deg';
window.l.no.followsYou = 'følger deg';
// set language, from local storage, else browser language, else english (english also if no localstorage availible)