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. 80
      js/twister_following.js

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">

1
js/interface_common.js

@ -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:

80
js/twister_following.js

@ -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'); console.warn('nothing to proceed: no twisters to follow was suggested');
var item = $('#follow-suggestion-template').clone(true) return;
.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')) { var list = module.find('.follow-suggestions');
getFullname(suggestion, item.find('.twister-user-full')); var item = twister.tmpl.whoTofollowPeer.clone(true);
getBioToElem(suggestion, item.find('.bio'));
item.find('.twister-user-remove').remove();
}
if (prepend) item.find('.twister-user-info').attr('data-screen-name', peerAlias);
list.prepend(item).show(); item.find('.twister-user-name').attr('href', $.MAL.userUrl(peerAlias));
else item.find('.twister-user-tag').text('@' + peerAlias);
list.append(item).show();
while (module.hasClass('new-users') && list.children().length > 3) getAvatar(peerAlias, item.find('.twister-user-photo'));
list.children().last().remove(); getStatusTime(peerAlias, item.find('.latest-activity .time'));
module.find('.refresh-users').show(); if (module.hasClass('who-to-follow') || module.hasClass('who-to-follow-modal')) {
module.find('.loading-roller').hide(); item.find('.twister-by-user-name').attr('href', $.MAL.userUrl(followedBy));
} else getFullname(followedBy, item.find('.followed-by').text(followedBy));
console.warn('nothing to proceed: no twisters to follow was suggested'); 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…
Cancel
Save