From 27a018a23ed9309e4dd6744ed89ca042e2ac5d88 Mon Sep 17 00:00:00 2001 From: erqan Date: Thu, 22 Sep 2016 18:14:40 +0300 Subject: [PATCH 1/5] users' last activity (status) time in 'who to follow' lists --- css/style.css | 7 +++++-- home.html | 4 ++++ js/interface_common.js | 4 ++++ js/interface_localization.js | 40 +++++++++++++++++++++++------------- js/twister_following.js | 1 + js/twister_io.js | 19 +++++++++++++++++ 6 files changed, 59 insertions(+), 16 deletions(-) diff --git a/css/style.css b/css/style.css index 97c69da..1392531 100644 --- a/css/style.css +++ b/css/style.css @@ -890,12 +890,15 @@ textarea.splited-post { color: #e34f42; } -.followers +.followers, +.last-activity { font-size: 12px; color: rgba( 0, 0, 0, .6 ); + margin-left: 58px; } -.followed-by +.followed-by, +.user-status-time { color: #e34f42; font-size: 13px; diff --git a/home.html b/home.html index 88aa84e..052ed5d 100644 --- a/home.html +++ b/home.html @@ -302,6 +302,10 @@ × +
+ Last activity + +
diff --git a/js/interface_common.js b/js/interface_common.js index 5aedcc5..8b1fe9d 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -389,6 +389,7 @@ function checkNetworkStatusAndAskRedirect(cbFunc, cbReq) { } function timeGmtToText(t) { + if (t == 0) return '-'; var d = new Date(0); d.setUTCSeconds(t); return d.toString().replace(/GMT.*/g, ''); @@ -750,6 +751,7 @@ function fillWhoToFollowModal(list, hlist, start) { getFullname(utf, item.find('.twister-user-full')); getBioToElem(utf, item.find('.bio')); getFullname(followingUsers[i], item.find('.followed-by').text(followingUsers[i])); + getStatusTime(utf,item.find('.user-status-time')); item.find('.twister-user-remove').remove(); @@ -2620,6 +2622,8 @@ function initInterfaceCommon() { displayQueryPending($('.hashtag-modal .postboard-posts')); }); + $('.user-status-time').on('mouseup', {feeder: '.user-status-time'}, handleClickOpenConversation); + replaceDashboards(); $(window).resize(replaceDashboards); diff --git a/js/interface_localization.js b/js/interface_localization.js index 6270935..bdae9d0 100644 --- a/js/interface_localization.js +++ b/js/interface_localization.js @@ -366,7 +366,8 @@ if(preferredLanguage == "en"){ "users_favs": "Favorites of @%{username}", "Favorites": "Favorites", "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"){ @@ -705,7 +706,8 @@ if(preferredLanguage == "es"){ "users_favs": "Favorites of @%{username}", "Favorites": "Favorites", "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}", "Favorites": "Favorites", "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}", "Favorites": "Favorites", "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}", "Favorites": "Favorites", "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}", "Favorites": "Favorites", "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.", "users_favs": "Favorites of @%{username}", "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}", "Favorites": "Favorites", "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}", "Favorites": "Favorites", "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}", "Favorites": "Favorites", "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}", "Favorites": "Favorites", "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", "Favorites": "Favoriler", "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}", "Favorites": "Favorites", "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" }; } diff --git a/js/twister_following.js b/js/twister_following.js index 3ea7ba9..1d96934 100644 --- a/js/twister_following.js +++ b/js/twister_following.js @@ -515,6 +515,7 @@ function processWhoToFollowSuggestion(suggestion, followedBy) { getAvatar(suggestion, item.find('.twister-user-photo')); getFullname(followedBy, item.find('.followed-by').text(followedBy)); + getStatusTime(suggestion,item.find('.user-status-time')); item.find('.twister-user-remove').on('click', function() { item.remove(); diff --git a/js/twister_io.js b/js/twister_io.js index 5b6a8d8..0a98dc3 100644 --- a/js/twister_io.js +++ b/js/twister_io.js @@ -522,6 +522,25 @@ function getPostsCount(peerAlias, elem) { ); } +function getStatusTime(peerAlias, elem) { + dhtget(peerAlias, 'status', 's', + function(req, v) { + var time = 0; + var k = -1; + if (v && v.userpost) { + time = v.userpost.time; + k = v.userpost.k; + } + elem.text(timeGmtToText(time)); + elem.attr('data-time', time); + if (k > -1) { + elem.attr('data-screen-name', peerAlias); + elem.attr('data-id', k); + } + }, {peerAlias: peerAlias, elem: elem} + ); +} + function getPostMaxAvailability(peerAlias, k, cbFunc, cbReq) { twisterRpc('getpiecemaxseen', [peerAlias, k], function(req, ret) { From c5e8c650f4931332cfd17cde0027b9c4430e8b33 Mon Sep 17 00:00:00 2001 From: erqan Date: Sat, 24 Sep 2016 15:30:09 +0300 Subject: [PATCH 2/5] in following list also --- css/style.css | 8 +++++++- home.html | 6 ++++++ js/interface_common.js | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/css/style.css b/css/style.css index 1392531..db36ed2 100644 --- a/css/style.css +++ b/css/style.css @@ -2346,7 +2346,7 @@ ol.toptrends-list { display: inline-block; text-align: initial; width: 320px; - height: 120px; + height: 130px; margin: 2px; padding: 2px; border: solid 1px rgba(69, 71, 77, .1); @@ -2389,6 +2389,12 @@ ol.toptrends-list { right: 32px; } +.following-own-modal .following-list .last-activity { + position: absolute; + top: 110px; + right: 32px; + margin: 0; +} /************************************* *********** AUTOCOMPLETING *********** **************************************/ diff --git a/home.html b/home.html index 052ed5d..c971185 100644 --- a/home.html +++ b/home.html @@ -780,6 +780,12 @@
+
+ + Last activity + + +
diff --git a/js/interface_common.js b/js/interface_common.js index 8b1fe9d..9c68d88 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -711,6 +711,7 @@ function addPeerToFollowingList(list, peerAlias) { .on('mouseup', {route: $.MAL.mentionsUrl(peerAlias)}, routeOnClick); getAvatar(peerAlias, item.find('.mini-profile-photo')); getFullname(peerAlias, item.find('.mini-profile-name')); + getStatusTime(peerAlias, item.find('.user-status-time')); if (peerAlias === defaultScreenName) item.find('.following-config').hide(); From 8662401d0d345ce43d1761e59ab71a17ae268a9c Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Tue, 27 Sep 2016 04:04:35 +0500 Subject: [PATCH 3/5] quibbling to Erkan's latest activity --- css/style.css | 11 ++++++----- home.html | 12 +++++------- js/interface_common.js | 7 ++++--- js/twister_following.js | 2 +- js/twister_io.js | 23 ++++++++++------------- 5 files changed, 26 insertions(+), 29 deletions(-) diff --git a/css/style.css b/css/style.css index db36ed2..b1c131c 100644 --- a/css/style.css +++ b/css/style.css @@ -891,19 +891,19 @@ textarea.splited-post { } .followers, -.last-activity -{ +.latest-activity { font-size: 12px; color: rgba( 0, 0, 0, .6 ); margin-left: 58px; } + .followed-by, -.user-status-time -{ +.latest-activity .time { color: #e34f42; font-size: 13px; cursor: pointer; } + .twister-user-name, .twister-by-user-name { @@ -2389,12 +2389,13 @@ ol.toptrends-list { right: 32px; } -.following-own-modal .following-list .last-activity { +.following-own-modal .following-list .latest-activity { position: absolute; top: 110px; right: 32px; margin: 0; } + /************************************* *********** AUTOCOMPLETING *********** **************************************/ diff --git a/home.html b/home.html index c971185..bdbfd1b 100644 --- a/home.html +++ b/home.html @@ -302,9 +302,9 @@ × -
+
Last activity - +
@@ -780,11 +780,9 @@
-
- - Last activity - - +
+ Last activity +
diff --git a/js/interface_common.js b/js/interface_common.js index 9c68d88..90460ab 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -711,7 +711,7 @@ function addPeerToFollowingList(list, peerAlias) { .on('mouseup', {route: $.MAL.mentionsUrl(peerAlias)}, routeOnClick); getAvatar(peerAlias, item.find('.mini-profile-photo')); getFullname(peerAlias, item.find('.mini-profile-name')); - getStatusTime(peerAlias, item.find('.user-status-time')); + getStatusTime(peerAlias, item.find('.latest-activity .time')); if (peerAlias === defaultScreenName) item.find('.following-config').hide(); @@ -752,7 +752,7 @@ function fillWhoToFollowModal(list, hlist, start) { getFullname(utf, item.find('.twister-user-full')); getBioToElem(utf, item.find('.bio')); getFullname(followingUsers[i], item.find('.followed-by').text(followingUsers[i])); - getStatusTime(utf,item.find('.user-status-time')); + getStatusTime(utf, item.find('.latest-activity .time')); item.find('.twister-user-remove').remove(); @@ -2623,7 +2623,8 @@ function initInterfaceCommon() { displayQueryPending($('.hashtag-modal .postboard-posts')); }); - $('.user-status-time').on('mouseup', {feeder: '.user-status-time'}, handleClickOpenConversation); + getElem('.latest-activity', true).on('mouseup', + {feeder: '.latest-activity'}, handleClickOpenConversation); replaceDashboards(); $(window).resize(replaceDashboards); diff --git a/js/twister_following.js b/js/twister_following.js index 1d96934..c736b05 100644 --- a/js/twister_following.js +++ b/js/twister_following.js @@ -515,7 +515,7 @@ function processWhoToFollowSuggestion(suggestion, followedBy) { getAvatar(suggestion, item.find('.twister-user-photo')); getFullname(followedBy, item.find('.followed-by').text(followedBy)); - getStatusTime(suggestion,item.find('.user-status-time')); + getStatusTime(suggestion, item.find('.latest-activity .time')); item.find('.twister-user-remove').on('click', function() { item.remove(); diff --git a/js/twister_io.js b/js/twister_io.js index 0a98dc3..c9d1ab1 100644 --- a/js/twister_io.js +++ b/js/twister_io.js @@ -524,19 +524,16 @@ function getPostsCount(peerAlias, elem) { function getStatusTime(peerAlias, elem) { dhtget(peerAlias, 'status', 's', - function(req, v) { - var time = 0; - var k = -1; - if (v && v.userpost) { - time = v.userpost.time; - k = v.userpost.k; - } - elem.text(timeGmtToText(time)); - elem.attr('data-time', time); - if (k > -1) { - elem.attr('data-screen-name', peerAlias); - elem.attr('data-id', k); - } + 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} ); } From c282d9fa6936a451645ae2abdd058f28f3c66ad6 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Tue, 27 Sep 2016 04:05:47 +0500 Subject: [PATCH 4/5] add latest activity CSS for `calm` and `nin` --- theme_calm/css/style.css | 20 +++++++++++++++----- theme_nin/css/style.css | 20 +++++++++++++++++--- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/theme_calm/css/style.css b/theme_calm/css/style.css index 73b38a4..6a9bc02 100644 --- a/theme_calm/css/style.css +++ b/theme_calm/css/style.css @@ -1072,16 +1072,19 @@ textarea.splited-post { opacity: .8; } -.followers -{ +.followers, +.latest-activity { font-size: 12px; color: rgba( 0, 0, 0, .6 ); + margin-left: 58px; } -.followed-by -{ + +.followed-by, +.latest-activity .time { font-size: 13px; cursor: pointer; } + .twister-user-name, .twister-by-user-name { @@ -2767,7 +2770,7 @@ textarea.splited-post { display: inline-block; text-align: initial; width: 320px; - height: 120px; + height: 130px; margin: 2px; padding: 2px; border: solid 1px rgba(69, 71, 77, .1); @@ -2813,6 +2816,13 @@ textarea.splited-post { right: 32px; } +.following-own-modal .following-list .latest-activity { + position: absolute; + top: 110px; + right: 32px; + margin: 0; +} + .gifCheckBox { float: right; vertical-align: middle; diff --git a/theme_nin/css/style.css b/theme_nin/css/style.css index eef5b66..2caf94f 100644 --- a/theme_nin/css/style.css +++ b/theme_nin/css/style.css @@ -2209,7 +2209,8 @@ textarea.splited-post { } /* line 447, ../sass/style.sass */ -.followers { +.followers, +.latest-activity { font-size: 12px; color: #66686B; } @@ -2219,13 +2220,22 @@ textarea.splited-post { } /* line 453, ../sass/style.sass */ -.followed-by { +.followed-by, +.latest-activity { color: #aaa; font-size: 12px; cursor: pointer; display: block; } +.who-to-follow .latest-activity { + margin-bottom: 8px; +} + +.who-to-follow .latest-activity .label { + display: none; +} + /* line 459, ../sass/style.sass */ .twister-user-name, .twister-by-user-name { font-weight: bold; @@ -3356,7 +3366,7 @@ ol.toptrends-list a:hover { .following-own-modal .following-list > li { display: inline-block; width: 320px; - height: 160px; + height: 184px; margin: 2px; padding: 2px; border: solid 1px rgba(69, 71, 77, .1); @@ -3456,6 +3466,10 @@ ol.toptrends-list a:hover { display: block; } +.following-own-modal .following-list .latest-activity { + font-size: 11px; +} + /********** AUTOCOMPLETING *********/ /* line 1087, ../sass/style.sass */ From 32d6d59ee98c7a29b3562e7959dbab4f4d730a0e Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Tue, 27 Sep 2016 04:21:38 +0500 Subject: [PATCH 5/5] add checks to handleClickOpenConversation() --- js/interface_common.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/js/interface_common.js b/js/interface_common.js index 90460ab..8abbd24 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -875,14 +875,22 @@ function handleClickOpenProfileModal(event) { } function handleClickOpenConversation(event) { - event.preventDefault(); - event.stopPropagation(); + var elem = $(event.target).closest(event.data.feeder); + if (!elem.length) { + muteEvent(event, true); + return; + } - var elem = $(event.target); - var postData = elem.closest(event.data.feeder); + var post = { + 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') - + ':post' + postData.attr('data-id'); + event.data.route = '#conversation?post=' + post.writer + ':post' + post.id; routeOnClick(event); }