From 0f9571f0e138526f140949cd5fb815d40ae0a3c0 Mon Sep 17 00:00:00 2001 From: Msjoinder Date: Sun, 5 Jan 2014 12:12:34 -0600 Subject: [PATCH 1/2] Following > list of users followed by any user --- css/style.css | 22 ++++++++++++++++++++++ following.html | 27 ++++++++++++++++++++++++++- home.html | 26 +++++++++++++++++++++++++- interface_common.js | 29 ++++++++++++++++++++++++++++- mobile_abstract.js | 17 +++++++++++++++++ twister_actions.js | 6 ++++++ twister_following.js | 17 +++++++++++++++++ 7 files changed, 141 insertions(+), 3 deletions(-) diff --git a/css/style.css b/css/style.css index d3fb359..04e01af 100644 --- a/css/style.css +++ b/css/style.css @@ -1324,6 +1324,28 @@ 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 +{ + overflow-y: auto; +} +.following-modal .modal-buttons +{ + display: none; +} +.following-modal ol +{ + margin: 15px; +} +/************************************* ****************** LOADER ************ **************************************/ .postboard-loading diff --git a/following.html b/following.html index f7615dd..acd8b20 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 18cbb37..a9e9c0a 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..a47c7ed 100644 --- a/twister_following.js +++ b/twister_following.js @@ -83,6 +83,23 @@ 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); + following_user_li.find(".mini-following-info").attr("data-screen-name", following_user); + following_user_li.find(".following-screen-name b").text(following_user); + + getAvatar( following_user, following_user_li.find(".mini-following-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(); From 438767b2140abc27e24c60b2b0fe46311f9805ea Mon Sep 17 00:00:00 2001 From: Msjoinder Date: Mon, 6 Jan 2014 09:41:14 -0600 Subject: [PATCH 2/2] link following to profile pages; css fixes --- css/style.css | 19 ++++++++++++++++++- following.html | 4 ++-- home.html | 4 ++-- twister_following.js | 9 ++++++--- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/css/style.css b/css/style.css index 04e01af..dd5adef 100644 --- a/css/style.css +++ b/css/style.css @@ -1335,6 +1335,7 @@ button.disabled:hover } .following-modal .modal-content { + padding: 15px; overflow-y: auto; } .following-modal .modal-buttons @@ -1343,7 +1344,23 @@ button.disabled:hover } .following-modal ol { - margin: 15px; + 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 ************ diff --git a/following.html b/following.html index acd8b20..b96954c 100644 --- a/following.html +++ b/following.html @@ -401,8 +401,8 @@