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

34
js/twister_following.js

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

Loading…
Cancel
Save