diff --git a/css/style.css b/css/style.css index d3fb359..dd5adef 100644 --- a/css/style.css +++ b/css/style.css @@ -1324,6 +1324,45 @@ button.disabled:hover margin-left: 0; } /************************************* +****************** FOLLOWING MODAL +**************************************/ +.following-modal .modal-wrapper +{ + width: 560px; + height: 470px; + margin: -200px 0 0 -280px; + overflow-x: hidden; +} +.following-modal .modal-content +{ + padding: 15px; + overflow-y: auto; +} +.following-modal .modal-buttons +{ + display: none; +} +.following-modal ol +{ + margin: 5px; +} +.following-modal .open-profile-modal:hover +{ + text-decoration: none; +} +.following-modal .open-profile-modal img +{ + float: none; +} +.following-modal .open-profile-modal span +{ + vertical-align: middle; +} +.following-modal .open-profile-modal span:hover +{ + text-decoration: underline; +} +/************************************* ****************** LOADER ************ **************************************/ .postboard-loading diff --git a/following.html b/following.html index 5da73d6..80bf900 100644 --- a/following.html +++ b/following.html @@ -346,7 +346,7 @@ @@ -391,6 +391,31 @@ + +
+ +

All users publicly followed by @

+ + + +
    + +
+ + +
+ + diff --git a/home.html b/home.html index c7f1c51..5200ed7 100644 --- a/home.html +++ b/home.html @@ -353,7 +353,7 @@ @@ -398,6 +398,30 @@ + +
+ +

All users publicly followed by @

+ + + +
    + +
+ + +
+ diff --git a/interface_common.js b/interface_common.js index 4be5917..2c4c2a7 100644 --- a/interface_common.js +++ b/interface_common.js @@ -100,7 +100,7 @@ function timeSincePost(t) { } // -// Profile, mentions and hashtag modal +// Profile, mentions, hashtag, and following modal // ----------------------------------- function newProfileModal(username) { @@ -198,6 +198,32 @@ function openMentionsModal(e) resetMentionsCount(); } +function newFollowingModal(username) { + var followingModalContent = $( "#following-modal-template" ).children().clone(true); + + updateFollowingData(followingModalContent, username); + + return followingModalContent; +} + +function openFollowingModal(e) +{ + e.stopPropagation(); + e.preventDefault(); + + var $this = $( this ); + var username = $.MAL.followingUrlToUser( $this.attr("href") ); + + var followingModalClass = "following-modal"; + openModal( followingModalClass ); + + var followingModalContent = newFollowingModal( username ); + followingModalContent.appendTo("." +followingModalClass + " .modal-content"); + + //título do modal + $( "."+followingModalClass + " h3" ).text( "Followed by " + username ); +} + // // Post actions, submit, count characters // -------------------------------------- @@ -438,5 +464,6 @@ function initInterfaceCommon() { $( ".open-profile-modal").bind( "click", openProfileModal ); $( ".open-hashtag-modal").bind( "click", openHashtagModal ); + $( ".open-following-modal").bind( "click", openFollowingModal ); $( ".userMenu-connections a").bind( "click", openMentionsModal ); } diff --git a/mobile_abstract.js b/mobile_abstract.js index 2c0311d..5526de0 100644 --- a/mobile_abstract.js +++ b/mobile_abstract.js @@ -147,6 +147,15 @@ var MAL = function() return ""; } + this.followingUrlToUser = function(url) { + var dummyUrl = this.isFollowingUrl(""); + var urlIdx = url.indexOf(dummyUrl); + if( urlIdx >= 0 ) + return url.substr(urlIdx + dummyUrl.length); + else + return ""; + } + this.mentionsUrl = function(username) { if( $.hasOwnProperty("mobile") ) { return "#mentions?user=" + username; @@ -170,6 +179,14 @@ var MAL = function() return "#dmchat?user=" + username; } } + + this.isFollowingUrl = function(username) { + if( $.hasOwnProperty("mobile") ) { + return "#following?user=" + username; + } else { + return "#following?user=" + username; + } + } this.followUrl = function(username) { if( $.hasOwnProperty("mobile") ) { diff --git a/twister_actions.js b/twister_actions.js index 0ec3acb..4c7d9bd 100644 --- a/twister_actions.js +++ b/twister_actions.js @@ -174,10 +174,16 @@ function updateProfileData(profileModalContent, username) { getPostsCount( username, profileModalContent.find(".posts-count") ); getFollowers( username, profileModalContent.find(".followers-count") ); getNumFollowing( username, profileModalContent.find(".following-count") ); + + profileModalContent.find(".following-count").parent().attr("href", $.MAL.isFollowingUrl(username)); requestPostRecursively(profileModalContent.find(".postboard-posts"),username,"status",10); } +function updateFollowingData(followingModalContent, username) { + followingModalContent.find(".following-screen-name b").text(username); + loadFollowingIntoList( username, $(followingModalContent[1]) ); +} function clearHashtagProcessed() { _hashtagProcessedMap = {}; diff --git a/twister_following.js b/twister_following.js index e049dd4..0a3e9d4 100644 --- a/twister_following.js +++ b/twister_following.js @@ -83,6 +83,26 @@ function getNumFollowing( username, item ) { }, null); } +function loadFollowingIntoList( username, html_list ) { + loadFollowingFromDht( username, 1, [], 0, + function(args, following, seqNum) { + html_list.html(""); + $.each(following, function(i, following_user){ + var following_user_li = $( "#following-by-user-template" ).children().clone(true); + + // link follower to profile page + $(following_user_li.children()[0]).attr("data-screen-name", following_user); + $(following_user_li.children()[0]).attr("href", $.MAL.userUrl(following_user)); + + following_user_li.find(".following-screen-name b").text(following_user); + getAvatar( following_user, following_user_li.find(".mini-profile-photo") ); + getFullname( following_user, following_user_li.find(".mini-following-name") ); + + html_list.append( following_user_li ); + }); + }, null); +} + // load following list from localStorage and then from the dht resource function loadFollowing(cbFunc, cbArg) { loadFollowingFromStorage();