mirror of
https://github.com/twisterarmy/twister-html.git
synced 2025-02-05 03:24:17 +00:00
tune processWhoToFollowSuggestion()
This commit is contained in:
parent
f385ed289d
commit
4349e33097
13
home.html
13
home.html
@ -220,9 +220,7 @@
|
|||||||
<a class="refresh-users">Refresh</a>
|
<a class="refresh-users">Refresh</a>
|
||||||
<small>.</small>
|
<small>.</small>
|
||||||
<a class="view-all-users" href="#whotofollow">View All</a>
|
<a class="view-all-users" href="#whotofollow">View All</a>
|
||||||
<ol class="follow-suggestions">
|
<ol class="follow-suggestions"></ol>
|
||||||
<!-- use "follow-suggestion-template" here -->
|
|
||||||
</ol>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="loading-roller">
|
<div class="loading-roller">
|
||||||
<div></div>
|
<div></div>
|
||||||
@ -237,9 +235,7 @@
|
|||||||
<a class="refresh-users">Refresh</a>
|
<a class="refresh-users">Refresh</a>
|
||||||
<small>.</small>
|
<small>.</small>
|
||||||
<a class="view-all-users" href="#newusers">View All</a>
|
<a class="view-all-users" href="#newusers">View All</a>
|
||||||
<ol class="follow-suggestions">
|
<ol class="follow-suggestions"></ol>
|
||||||
<!-- use "follow-suggestion-template" here -->
|
|
||||||
</ol>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="loading-roller">
|
<div class="loading-roller">
|
||||||
<div></div>
|
<div></div>
|
||||||
@ -301,8 +297,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<!-- TEMPLATE DE WHO-TO-FOLLOW SUGGESTION -->
|
<div id="template-whotofollow-peer">
|
||||||
<li id="follow-suggestion-template" class="twister-user">
|
<li class="twister-user">
|
||||||
<div class="">
|
<div class="">
|
||||||
<a href="#" class="twister-user-name open-profile-modal">
|
<a href="#" class="twister-user-name open-profile-modal">
|
||||||
<img class="twister-user-photo" src="img/grayed_avatar_placeholder_24.png" alt="user-photo"/>
|
<img class="twister-user-photo" src="img/grayed_avatar_placeholder_24.png" alt="user-photo"/>
|
||||||
@ -328,6 +324,7 @@
|
|||||||
<button class="follow">Follow</button>
|
<button class="follow">Follow</button>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- TEMPLATE DA OL INVÓLUCRO DAS LIST ELEMENTS DO POST EXPANDIDO INIT -->
|
<!-- TEMPLATE DA OL INVÓLUCRO DAS LIST ELEMENTS DO POST EXPANDIDO INIT -->
|
||||||
<ol class="expanded-post">
|
<ol class="expanded-post">
|
||||||
|
@ -2812,6 +2812,7 @@ $(document).ready(function () {
|
|||||||
twister.tmpl.followersPeer = extractTemplate('#template-followers-peer');
|
twister.tmpl.followersPeer = extractTemplate('#template-followers-peer');
|
||||||
twister.tmpl.followingList = extractTemplate('#template-following-list');
|
twister.tmpl.followingList = extractTemplate('#template-following-list');
|
||||||
twister.tmpl.followingPeer = extractTemplate('#template-following-peer');
|
twister.tmpl.followingPeer = extractTemplate('#template-following-peer');
|
||||||
|
twister.tmpl.whoTofollowPeer = extractTemplate('#template-whotofollow-peer');
|
||||||
twister.tmpl.commonDMsListItem = extractTemplate('#template-direct-messages-list-item')
|
twister.tmpl.commonDMsListItem = extractTemplate('#template-direct-messages-list-item')
|
||||||
.on('mouseup', function (event) {
|
.on('mouseup', function (event) {
|
||||||
event.data = {route:
|
event.data = {route:
|
||||||
|
@ -624,50 +624,50 @@ function getWhoFollows(peerAlias, elem) {
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
function processWhoToFollowSuggestion(module, suggestion, followedBy, prepend) {
|
function processWhoToFollowSuggestion(module, peerAlias, followedBy, prepend) {
|
||||||
if (suggestion) {
|
if (!peerAlias) {
|
||||||
var list = module.find('.follow-suggestions');
|
|
||||||
var item = $('#follow-suggestion-template').clone(true)
|
|
||||||
.removeAttr('id');
|
|
||||||
|
|
||||||
item.find('.twister-user-info').attr('data-screen-name', suggestion);
|
|
||||||
item.find('.twister-user-name').attr('href', $.MAL.userUrl(suggestion));
|
|
||||||
item.find('.twister-user-tag').text('@' + suggestion);
|
|
||||||
|
|
||||||
getAvatar(suggestion, item.find('.twister-user-photo'));
|
|
||||||
getStatusTime(suggestion, item.find('.latest-activity .time'));
|
|
||||||
|
|
||||||
if (module.hasClass('who-to-follow') || module.hasClass('who-to-follow-modal')) {
|
|
||||||
item.find('.twister-by-user-name').attr('href', $.MAL.userUrl(followedBy));
|
|
||||||
getFullname(followedBy, item.find('.followed-by').text(followedBy));
|
|
||||||
item.find('.twister-user-remove').on('click', function () {
|
|
||||||
item.remove();
|
|
||||||
getRandomFollowSuggestion();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else if (module.hasClass('new-users') || module.hasClass('new-users-modal')){
|
|
||||||
item.find('.followers').remove();
|
|
||||||
item.find('.twister-user-remove').remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (module.hasClass('modal-wrapper')) {
|
|
||||||
getFullname(suggestion, item.find('.twister-user-full'));
|
|
||||||
getBioToElem(suggestion, item.find('.bio'));
|
|
||||||
item.find('.twister-user-remove').remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (prepend)
|
|
||||||
list.prepend(item).show();
|
|
||||||
else
|
|
||||||
list.append(item).show();
|
|
||||||
|
|
||||||
while (module.hasClass('new-users') && list.children().length > 3)
|
|
||||||
list.children().last().remove();
|
|
||||||
|
|
||||||
module.find('.refresh-users').show();
|
|
||||||
module.find('.loading-roller').hide();
|
|
||||||
} else
|
|
||||||
console.warn('nothing to proceed: no twisters to follow was suggested');
|
console.warn('nothing to proceed: no twisters to follow was suggested');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var list = module.find('.follow-suggestions');
|
||||||
|
var item = twister.tmpl.whoTofollowPeer.clone(true);
|
||||||
|
|
||||||
|
item.find('.twister-user-info').attr('data-screen-name', peerAlias);
|
||||||
|
item.find('.twister-user-name').attr('href', $.MAL.userUrl(peerAlias));
|
||||||
|
item.find('.twister-user-tag').text('@' + peerAlias);
|
||||||
|
|
||||||
|
getAvatar(peerAlias, item.find('.twister-user-photo'));
|
||||||
|
getStatusTime(peerAlias, item.find('.latest-activity .time'));
|
||||||
|
|
||||||
|
if (module.hasClass('who-to-follow') || module.hasClass('who-to-follow-modal')) {
|
||||||
|
item.find('.twister-by-user-name').attr('href', $.MAL.userUrl(followedBy));
|
||||||
|
getFullname(followedBy, item.find('.followed-by').text(followedBy));
|
||||||
|
item.find('.twister-user-remove').on('click', {item: item}, function (event) {
|
||||||
|
event.data.item.remove();
|
||||||
|
getRandomFollowSuggestion();
|
||||||
|
});
|
||||||
|
} else if (module.hasClass('new-users') || module.hasClass('new-users-modal')) {
|
||||||
|
item.find('.followers').remove();
|
||||||
|
item.find('.twister-user-remove').remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (module.hasClass('modal-wrapper')) {
|
||||||
|
getFullname(peerAlias, item.find('.twister-user-full'));
|
||||||
|
getBioToElem(peerAlias, item.find('.bio'));
|
||||||
|
item.find('.twister-user-remove').remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prepend)
|
||||||
|
list.prepend(item).show();
|
||||||
|
else
|
||||||
|
list.append(item).show();
|
||||||
|
|
||||||
|
while (module.hasClass('new-users') && list.children().length > 3)
|
||||||
|
list.children().last().remove();
|
||||||
|
|
||||||
|
module.find('.refresh-users').show();
|
||||||
|
module.find('.loading-roller').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeSearchDialog(event) {
|
function closeSearchDialog(event) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user