Browse Source

Merge pull request #363 from erqan/last-activity

peers' latest activity (status) time in 'who to follow' lists
readme-update
Сёма Мрачный 8 years ago committed by GitHub
parent
commit
a9265289ec
  1. 20
      css/style.css
  2. 8
      home.html
  3. 26
      js/interface_common.js
  4. 40
      js/interface_localization.js
  5. 1
      js/twister_following.js
  6. 16
      js/twister_io.js
  7. 20
      theme_calm/css/style.css
  8. 20
      theme_nin/css/style.css

20
css/style.css

@ -890,17 +890,20 @@ textarea.splited-post {
color: #e34f42; color: #e34f42;
} }
.followers .followers,
{ .latest-activity {
font-size: 12px; font-size: 12px;
color: rgba( 0, 0, 0, .6 ); color: rgba( 0, 0, 0, .6 );
margin-left: 58px;
} }
.followed-by
{ .followed-by,
.latest-activity .time {
color: #e34f42; color: #e34f42;
font-size: 13px; font-size: 13px;
cursor: pointer; cursor: pointer;
} }
.twister-user-name, .twister-user-name,
.twister-by-user-name .twister-by-user-name
{ {
@ -2343,7 +2346,7 @@ ol.toptrends-list {
display: inline-block; display: inline-block;
text-align: initial; text-align: initial;
width: 320px; width: 320px;
height: 120px; height: 130px;
margin: 2px; margin: 2px;
padding: 2px; padding: 2px;
border: solid 1px rgba(69, 71, 77, .1); border: solid 1px rgba(69, 71, 77, .1);
@ -2386,6 +2389,13 @@ ol.toptrends-list {
right: 32px; right: 32px;
} }
.following-own-modal .following-list .latest-activity {
position: absolute;
top: 110px;
right: 32px;
margin: 0;
}
/************************************* /*************************************
*********** AUTOCOMPLETING *********** *********** AUTOCOMPLETING ***********
**************************************/ **************************************/

8
home.html

@ -302,6 +302,10 @@
</a> </a>
</div> </div>
<a class="twister-user-remove">&times;</a> <a class="twister-user-remove">&times;</a>
<div class="latest-activity" data-screen-name="" data-id="" data-time="0">
<span class="label">Last activity</span>
<span class="time"></span>
</div>
<button class="follow">Follow</button> <button class="follow">Follow</button>
</div> </div>
</li> </li>
@ -776,6 +780,10 @@
<div> <div>
<span class="swarm-status" style="display: none;"></span> <span class="swarm-status" style="display: none;"></span>
</div> </div>
<div class="latest-activity" data-screen-name="" data-id="" data-time="0">
<span class="label">Last activity</span>
<span class="time"></span>
</div>
</div> </div>
</li> </li>
</div> </div>

26
js/interface_common.js

@ -389,6 +389,7 @@ function checkNetworkStatusAndAskRedirect(cbFunc, cbReq) {
} }
function timeGmtToText(t) { function timeGmtToText(t) {
if (t == 0) return '-';
var d = new Date(0); var d = new Date(0);
d.setUTCSeconds(t); d.setUTCSeconds(t);
return d.toString().replace(/GMT.*/g, ''); return d.toString().replace(/GMT.*/g, '');
@ -710,6 +711,7 @@ function addPeerToFollowingList(list, peerAlias) {
.on('mouseup', {route: $.MAL.mentionsUrl(peerAlias)}, routeOnClick); .on('mouseup', {route: $.MAL.mentionsUrl(peerAlias)}, routeOnClick);
getAvatar(peerAlias, item.find('.mini-profile-photo')); getAvatar(peerAlias, item.find('.mini-profile-photo'));
getFullname(peerAlias, item.find('.mini-profile-name')); getFullname(peerAlias, item.find('.mini-profile-name'));
getStatusTime(peerAlias, item.find('.latest-activity .time'));
if (peerAlias === defaultScreenName) if (peerAlias === defaultScreenName)
item.find('.following-config').hide(); item.find('.following-config').hide();
@ -750,6 +752,7 @@ function fillWhoToFollowModal(list, hlist, start) {
getFullname(utf, item.find('.twister-user-full')); getFullname(utf, item.find('.twister-user-full'));
getBioToElem(utf, item.find('.bio')); getBioToElem(utf, item.find('.bio'));
getFullname(followingUsers[i], item.find('.followed-by').text(followingUsers[i])); getFullname(followingUsers[i], item.find('.followed-by').text(followingUsers[i]));
getStatusTime(utf, item.find('.latest-activity .time'));
item.find('.twister-user-remove').remove(); item.find('.twister-user-remove').remove();
@ -872,14 +875,22 @@ function handleClickOpenProfileModal(event) {
} }
function handleClickOpenConversation(event) { function handleClickOpenConversation(event) {
event.preventDefault(); var elem = $(event.target).closest(event.data.feeder);
event.stopPropagation(); if (!elem.length) {
muteEvent(event, true);
return;
}
var elem = $(event.target); var post = {
var postData = elem.closest(event.data.feeder); writer: elem.attr('data-screen-name'),
id: elem.attr('data-id')
};
if (!post.writer || !post.id) {
muteEvent(event, true);
return;
}
event.data.route = '#conversation?post=' + postData.attr('data-screen-name') event.data.route = '#conversation?post=' + post.writer + ':post' + post.id;
+ ':post' + postData.attr('data-id');
routeOnClick(event); routeOnClick(event);
} }
@ -2620,6 +2631,9 @@ function initInterfaceCommon() {
displayQueryPending($('.hashtag-modal .postboard-posts')); displayQueryPending($('.hashtag-modal .postboard-posts'));
}); });
getElem('.latest-activity', true).on('mouseup',
{feeder: '.latest-activity'}, handleClickOpenConversation);
replaceDashboards(); replaceDashboards();
$(window).resize(replaceDashboards); $(window).resize(replaceDashboards);

40
js/interface_localization.js

@ -366,7 +366,8 @@ if(preferredLanguage == "en"){
"users_favs": "Favorites of @%{username}", "users_favs": "Favorites of @%{username}",
"Favorites": "Favorites", "Favorites": "Favorites",
"You have to log in to favorite messages.": "You have to log in to favorite messages.", "You have to log in to favorite messages.": "You have to log in to favorite messages.",
"fav_this": "Is it for you only?" "fav_this": "Is it for you only?",
"Last activity": "Last activity"
}; };
} }
if(preferredLanguage == "es"){ if(preferredLanguage == "es"){
@ -705,7 +706,8 @@ if(preferredLanguage == "es"){
"users_favs": "Favorites of @%{username}", "users_favs": "Favorites of @%{username}",
"Favorites": "Favorites", "Favorites": "Favorites",
"You have to log in to favorite messages.": "You have to log in to favorite messages.", "You have to log in to favorite messages.": "You have to log in to favorite messages.",
"fav_this": "Is it for you only?" "fav_this": "Is it for you only?",
"Last activity": "Last activity"
}; };
} }
@ -1043,7 +1045,8 @@ if(preferredLanguage == "uk"){
"users_favs": "Favorites of @%{username}", "users_favs": "Favorites of @%{username}",
"Favorites": "Favorites", "Favorites": "Favorites",
"You have to log in to favorite messages.": "You have to log in to favorite messages.", "You have to log in to favorite messages.": "You have to log in to favorite messages.",
"fav_this": "Is it for you only?" "fav_this": "Is it for you only?",
"Last activity": "Last activity"
}; };
} }
@ -1386,7 +1389,8 @@ if(preferredLanguage == "zh-CN"){
"users_favs": "Favorites of @%{username}", "users_favs": "Favorites of @%{username}",
"Favorites": "Favorites", "Favorites": "Favorites",
"You have to log in to favorite messages.": "You have to log in to favorite messages.", "You have to log in to favorite messages.": "You have to log in to favorite messages.",
"fav_this": "Is it for you only?" "fav_this": "Is it for you only?",
"Last activity": "Last activity"
}; };
} }
@ -1726,7 +1730,8 @@ if(preferredLanguage == "nl"){
"users_favs": "Favorites of @%{username}", "users_favs": "Favorites of @%{username}",
"Favorites": "Favorites", "Favorites": "Favorites",
"You have to log in to favorite messages.": "You have to log in to favorite messages.", "You have to log in to favorite messages.": "You have to log in to favorite messages.",
"fav_this": "Is it for you only?" "fav_this": "Is it for you only?",
"Last activity": "Last activity"
}; };
} }
@ -2064,7 +2069,8 @@ if(preferredLanguage == "it"){
"users_favs": "Favorites of @%{username}", "users_favs": "Favorites of @%{username}",
"Favorites": "Favorites", "Favorites": "Favorites",
"You have to log in to favorite messages.": "You have to log in to favorite messages.", "You have to log in to favorite messages.": "You have to log in to favorite messages.",
"fav_this": "Is it for you only?" "fav_this": "Is it for you only?",
"Last activity": "Last activity"
}; };
} }
@ -2403,8 +2409,8 @@ if(preferredLanguage == "fr"){
"No favs here because you are not logged in." : "No favs here because you are not logged in.", "No favs here because you are not logged in." : "No favs here because you are not logged in.",
"users_favs": "Favorites of @%{username}", "users_favs": "Favorites of @%{username}",
"Favorites": "Favorites", "Favorites": "Favorites",
"You have to log in to favorite messages.": "You have to log in to favorite messages." "You have to log in to favorite messages.": "You have to log in to favorite messages.",
"Last activity": "Last activity"
}; };
} }
@ -2750,7 +2756,8 @@ if(preferredLanguage == "ru"){
"users_favs": "Favorites of @%{username}", "users_favs": "Favorites of @%{username}",
"Favorites": "Favorites", "Favorites": "Favorites",
"You have to log in to favorite messages.": "You have to log in to favorite messages.", "You have to log in to favorite messages.": "You have to log in to favorite messages.",
"fav_this": "Is it for you only?" "fav_this": "Is it for you only?",
"Last activity": "Last activity"
}; };
} }
@ -3092,7 +3099,8 @@ if(preferredLanguage == "de"){
"users_favs": "Favorites of @%{username}", "users_favs": "Favorites of @%{username}",
"Favorites": "Favorites", "Favorites": "Favorites",
"You have to log in to favorite messages.": "You have to log in to favorite messages.", "You have to log in to favorite messages.": "You have to log in to favorite messages.",
"fav_this": "Is it for you only?" "fav_this": "Is it for you only?",
"Last activity": "Last activity"
}; };
} }
@ -3429,7 +3437,8 @@ if(preferredLanguage == "ja"){
"users_favs": "Favorites of @%{username}", "users_favs": "Favorites of @%{username}",
"Favorites": "Favorites", "Favorites": "Favorites",
"You have to log in to favorite messages.": "You have to log in to favorite messages.", "You have to log in to favorite messages.": "You have to log in to favorite messages.",
"fav_this": "Is it for you only?" "fav_this": "Is it for you only?",
"Last activity": "Last activity"
}; };
} }
@ -3772,7 +3781,8 @@ if(preferredLanguage == "pt-BR"){
"users_favs": "Favorites of @%{username}", "users_favs": "Favorites of @%{username}",
"Favorites": "Favorites", "Favorites": "Favorites",
"You have to log in to favorite messages.": "You have to log in to favorite messages.", "You have to log in to favorite messages.": "You have to log in to favorite messages.",
"fav_this": "Is it for you only?" "fav_this": "Is it for you only?",
"Last activity": "Last activity"
}; };
} }
@ -4111,7 +4121,8 @@ if(preferredLanguage == "tr"){
"users_favs": "@%{username} kullanıcısının favorileri", "users_favs": "@%{username} kullanıcısının favorileri",
"Favorites": "Favoriler", "Favorites": "Favoriler",
"You have to log in to favorite messages.": "İletileri favorine eklemek için giriş yapmalısın.", "You have to log in to favorite messages.": "İletileri favorine eklemek için giriş yapmalısın.",
"fav_this": "Sana özel mi?" "fav_this": "Sana özel mi?",
"Last activity": "Son etkinlik"
}; };
} }
@ -4453,7 +4464,8 @@ if(preferredLanguage == "cs"){
"users_favs": "Favorites of @%{username}", "users_favs": "Favorites of @%{username}",
"Favorites": "Favorites", "Favorites": "Favorites",
"You have to log in to favorite messages.": "You have to log in to favorite messages.", "You have to log in to favorite messages.": "You have to log in to favorite messages.",
"fav_this": "Is it for you only?" "fav_this": "Is it for you only?",
"Last activity": "Last activity"
}; };
} }

1
js/twister_following.js

@ -515,6 +515,7 @@ function processWhoToFollowSuggestion(suggestion, followedBy) {
getAvatar(suggestion, item.find('.twister-user-photo')); getAvatar(suggestion, item.find('.twister-user-photo'));
getFullname(followedBy, item.find('.followed-by').text(followedBy)); getFullname(followedBy, item.find('.followed-by').text(followedBy));
getStatusTime(suggestion, item.find('.latest-activity .time'));
item.find('.twister-user-remove').on('click', function() { item.find('.twister-user-remove').on('click', function() {
item.remove(); item.remove();

16
js/twister_io.js

@ -522,6 +522,22 @@ function getPostsCount(peerAlias, elem) {
); );
} }
function getStatusTime(peerAlias, elem) {
dhtget(peerAlias, 'status', 's',
function (req, ret) {
if (!ret || !ret.userpost)
return;
req.elem.text(timeGmtToText(ret.userpost.time))
.closest('.latest-activity')
.attr('data-screen-name', req.peerAlias)
.attr('data-id', ret.userpost.k)
.attr('data-time', ret.userpost.time)
;
}, {peerAlias: peerAlias, elem: elem}
);
}
function getPostMaxAvailability(peerAlias, k, cbFunc, cbReq) { function getPostMaxAvailability(peerAlias, k, cbFunc, cbReq) {
twisterRpc('getpiecemaxseen', [peerAlias, k], twisterRpc('getpiecemaxseen', [peerAlias, k],
function(req, ret) { function(req, ret) {

20
theme_calm/css/style.css

@ -1072,16 +1072,19 @@ textarea.splited-post {
opacity: .8; opacity: .8;
} }
.followers .followers,
{ .latest-activity {
font-size: 12px; font-size: 12px;
color: rgba( 0, 0, 0, .6 ); color: rgba( 0, 0, 0, .6 );
margin-left: 58px;
} }
.followed-by
{ .followed-by,
.latest-activity .time {
font-size: 13px; font-size: 13px;
cursor: pointer; cursor: pointer;
} }
.twister-user-name, .twister-user-name,
.twister-by-user-name .twister-by-user-name
{ {
@ -2767,7 +2770,7 @@ textarea.splited-post {
display: inline-block; display: inline-block;
text-align: initial; text-align: initial;
width: 320px; width: 320px;
height: 120px; height: 130px;
margin: 2px; margin: 2px;
padding: 2px; padding: 2px;
border: solid 1px rgba(69, 71, 77, .1); border: solid 1px rgba(69, 71, 77, .1);
@ -2813,6 +2816,13 @@ textarea.splited-post {
right: 32px; right: 32px;
} }
.following-own-modal .following-list .latest-activity {
position: absolute;
top: 110px;
right: 32px;
margin: 0;
}
.gifCheckBox { .gifCheckBox {
float: right; float: right;
vertical-align: middle; vertical-align: middle;

20
theme_nin/css/style.css

@ -2209,7 +2209,8 @@ textarea.splited-post {
} }
/* line 447, ../sass/style.sass */ /* line 447, ../sass/style.sass */
.followers { .followers,
.latest-activity {
font-size: 12px; font-size: 12px;
color: #66686B; color: #66686B;
} }
@ -2219,13 +2220,22 @@ textarea.splited-post {
} }
/* line 453, ../sass/style.sass */ /* line 453, ../sass/style.sass */
.followed-by { .followed-by,
.latest-activity {
color: #aaa; color: #aaa;
font-size: 12px; font-size: 12px;
cursor: pointer; cursor: pointer;
display: block; display: block;
} }
.who-to-follow .latest-activity {
margin-bottom: 8px;
}
.who-to-follow .latest-activity .label {
display: none;
}
/* line 459, ../sass/style.sass */ /* line 459, ../sass/style.sass */
.twister-user-name, .twister-by-user-name { .twister-user-name, .twister-by-user-name {
font-weight: bold; font-weight: bold;
@ -3356,7 +3366,7 @@ ol.toptrends-list a:hover {
.following-own-modal .following-list > li { .following-own-modal .following-list > li {
display: inline-block; display: inline-block;
width: 320px; width: 320px;
height: 160px; height: 184px;
margin: 2px; margin: 2px;
padding: 2px; padding: 2px;
border: solid 1px rgba(69, 71, 77, .1); border: solid 1px rgba(69, 71, 77, .1);
@ -3456,6 +3466,10 @@ ol.toptrends-list a:hover {
display: block; display: block;
} }
.following-own-modal .following-list .latest-activity {
font-size: 11px;
}
/********** AUTOCOMPLETING *********/ /********** AUTOCOMPLETING *********/
/* line 1087, ../sass/style.sass */ /* line 1087, ../sass/style.sass */

Loading…
Cancel
Save