Browse Source

tune processWhoToFollowSuggestion()

readme-update
Simon Grim 8 years ago
parent
commit
4349e33097
  1. 13
      home.html
  2. 1
      js/interface_common.js
  3. 34
      js/twister_following.js

13
home.html

@ -220,9 +220,7 @@ @@ -220,9 +220,7 @@
<a class="refresh-users">Refresh</a>
<small>.</small>
<a class="view-all-users" href="#whotofollow">View All</a>
<ol class="follow-suggestions">
<!-- use "follow-suggestion-template" here -->
</ol>
<ol class="follow-suggestions"></ol>
</div>
<div class="loading-roller">
<div></div>
@ -237,9 +235,7 @@ @@ -237,9 +235,7 @@
<a class="refresh-users">Refresh</a>
<small>.</small>
<a class="view-all-users" href="#newusers">View All</a>
<ol class="follow-suggestions">
<!-- use "follow-suggestion-template" here -->
</ol>
<ol class="follow-suggestions"></ol>
</div>
<div class="loading-roller">
<div></div>
@ -301,8 +297,8 @@ @@ -301,8 +297,8 @@
</div>
</li>
<!-- TEMPLATE DE WHO-TO-FOLLOW SUGGESTION -->
<li id="follow-suggestion-template" class="twister-user">
<div id="template-whotofollow-peer">
<li class="twister-user">
<div class="">
<a href="#" class="twister-user-name open-profile-modal">
<img class="twister-user-photo" src="img/grayed_avatar_placeholder_24.png" alt="user-photo"/>
@ -328,6 +324,7 @@ @@ -328,6 +324,7 @@
<button class="follow">Follow</button>
</div>
</li>
</div>
<!-- TEMPLATE DA OL INVÓLUCRO DAS LIST ELEMENTS DO POST EXPANDIDO INIT -->
<ol class="expanded-post">

1
js/interface_common.js

@ -2812,6 +2812,7 @@ $(document).ready(function () { @@ -2812,6 +2812,7 @@ $(document).ready(function () {
twister.tmpl.followersPeer = extractTemplate('#template-followers-peer');
twister.tmpl.followingList = extractTemplate('#template-following-list');
twister.tmpl.followingPeer = extractTemplate('#template-following-peer');
twister.tmpl.whoTofollowPeer = extractTemplate('#template-whotofollow-peer');
twister.tmpl.commonDMsListItem = extractTemplate('#template-direct-messages-list-item')
.on('mouseup', function (event) {
event.data = {route:

34
js/twister_following.js

@ -624,35 +624,37 @@ function getWhoFollows(peerAlias, elem) { @@ -624,35 +624,37 @@ function getWhoFollows(peerAlias, elem) {
;
}
function processWhoToFollowSuggestion(module, suggestion, followedBy, prepend) {
if (suggestion) {
function processWhoToFollowSuggestion(module, peerAlias, followedBy, prepend) {
if (!peerAlias) {
console.warn('nothing to proceed: no twisters to follow was suggested');
return;
}
var list = module.find('.follow-suggestions');
var item = $('#follow-suggestion-template').clone(true)
.removeAttr('id');
var item = twister.tmpl.whoTofollowPeer.clone(true);
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);
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(suggestion, item.find('.twister-user-photo'));
getStatusTime(suggestion, item.find('.latest-activity .time'));
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', function () {
item.remove();
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')){
} 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'));
getFullname(peerAlias, item.find('.twister-user-full'));
getBioToElem(peerAlias, item.find('.bio'));
item.find('.twister-user-remove').remove();
}
@ -666,8 +668,6 @@ function processWhoToFollowSuggestion(module, suggestion, followedBy, prepend) { @@ -666,8 +668,6 @@ function processWhoToFollowSuggestion(module, suggestion, followedBy, prepend) {
module.find('.refresh-users').show();
module.find('.loading-roller').hide();
} else
console.warn('nothing to proceed: no twisters to follow was suggested');
}
function closeSearchDialog(event) {

Loading…
Cancel
Save