Browse Source

add hashtag search

master
digital dreamer 11 years ago
parent
commit
a81246cd5f
  1. 1
      home.html
  2. 28
      js/interface_common.js
  3. 3
      js/interface_localization.js
  4. 4
      js/twister_actions.js
  5. 14
      js/twister_following.js

1
home.html

@ -429,6 +429,7 @@
<button class="postboard-news" style="display:none;"></button> <button class="postboard-news" style="display:none;"></button>
</h2> </h2>
<span class="no-posts-found-message" style="display:none;">There aren't any posts with this hashtag.</span>
<ol id="profile-posts" class="postboard-posts"> <ol id="profile-posts" class="postboard-posts">
</ol> </ol>

28
js/interface_common.js

@ -5,8 +5,6 @@
// Profile, mentions and hashtag modal // Profile, mentions and hashtag modal
// Post actions: submit, count characters // Post actions: submit, count characters
var preventSlide = false;
//dispara o modal genérico //dispara o modal genérico
//o modalClass me permite fazer tratamentos específicos de CSS para cada modal //o modalClass me permite fazer tratamentos específicos de CSS para cada modal
function openModal( modalClass ) function openModal( modalClass )
@ -161,6 +159,19 @@ function openHashtagModal(e)
$( "."+hashtagModalClass + " h3" ).text( "#" + hashtag ); $( "."+hashtagModalClass + " h3" ).text( "#" + hashtag );
} }
function openHashtagModalFromSearch(hashtag)
{
var hashtagModalClass = "hashtag-modal";
openModal( hashtagModalClass );
$( "."+hashtagModalClass ).attr("data-resource","hashtag");
var hashtagModalContent = newHashtagModal( hashtag );
hashtagModalContent.appendTo("." +hashtagModalClass + " .modal-content");
//título do modal
$( "."+hashtagModalClass + " h3" ).text( "#" + hashtag );
}
function updateHashtagModal(postboard,hashtag) { function updateHashtagModal(postboard,hashtag) {
var $hashtagModalClass = $(".hashtag-modal"); var $hashtagModalClass = $(".hashtag-modal");
if( !$hashtagModalClass.length || $hashtagModalClass.css("display") == 'none' ) if( !$hashtagModalClass.length || $hashtagModalClass.css("display") == 'none' )
@ -239,7 +250,7 @@ var reTwistPopup = function( e )
{ {
if(!defaultScreenName) if(!defaultScreenName)
{ {
preventSlide=true; e.stopPropagation();
alert(polyglot.t("You have to log in to retransmit messages.")); alert(polyglot.t("You have to log in to retransmit messages."));
return; return;
} }
@ -317,14 +328,7 @@ var postExpandFunction = function( e, postLi )
var openClass = "open"; var openClass = "open";
//This is used in "guest mode", when user gets an alert that he can't reply or retransmit if( !postLi.hasClass( openClass ) ) {
//when not logged in. Otherwise, this click would also be understood as a command to open/close
//the post, which would look weird.
if(preventSlide)
{
preventSlide=false;
}
else if( !postLi.hasClass( openClass ) ) {
originalPost.detach(); originalPost.detach();
postLi.empty(); postLi.empty();
postLi.addClass( openClass ); postLi.addClass( openClass );
@ -388,7 +392,7 @@ var postReplyClick = function( e )
{ {
if(!defaultScreenName) if(!defaultScreenName)
{ {
preventSlide=true; e.stopPropagation();
alert(polyglot.t("You have to log in to post replies.")); alert(polyglot.t("You have to log in to post replies."));
return; return;
} }

3
js/interface_localization.js

@ -205,7 +205,8 @@ if(preferredLanguage == "en"){
"Custom": "Custom", "Custom": "Custom",
"Mentions": "Mentions", "Mentions": "Mentions",
"Use proxy for image preview only": "Use proxy for image preview only", "Use proxy for image preview only": "Use proxy for image preview only",
"Use external links behind a proxy": "Use external links behind a proxy" "Use external links behind a proxy": "Use external links behind a proxy",
"There aren't any posts with this hashtag.": "There aren't any posts with this hashtag.",
}; };
} }
if(preferredLanguage == "es"){ if(preferredLanguage == "es"){

4
js/twister_actions.js

@ -237,6 +237,9 @@ function processHashtag(postboard, hashtag, data) {
} }
} }
if(!postboard.children().length&&!_hashtagPendingPosts.length)
postboard.closest("div").find(".no-posts-found-message").show();
if( _hashtagPendingPosts.length ) { if( _hashtagPendingPosts.length ) {
if( !postboard.children().length || autoUpdateHashtag ) { if( !postboard.children().length || autoUpdateHashtag ) {
displayHashtagPending(postboard); displayHashtagPending(postboard);
@ -245,6 +248,7 @@ function processHashtag(postboard, hashtag, data) {
newTweetsBar.text(polyglot.t("new_posts", _hashtagPendingPosts.length)); newTweetsBar.text(polyglot.t("new_posts", _hashtagPendingPosts.length));
newTweetsBar.fadeIn("slow"); newTweetsBar.fadeIn("slow");
} }
postboard.closest("div").find(".no-posts-found-message").hide();
} }
} }
} }

14
js/twister_following.js

@ -354,8 +354,20 @@ function closeSearchDialog()
_lastSearchUsersResults = []; _lastSearchUsersResults = [];
} }
function userSearchKeypress(item) { function userSearchKeypress(event) {
var partialName = $(".userMenu-search-field").val().toLowerCase(); var partialName = $(".userMenu-search-field").val().toLowerCase();
var searchResults = $(".search-results");
if ( partialName.substr( 0, 1 ) == '#' ) {
if(searchResults.is(":visible"))
searchResults.slideUp( "fast" );
if ( event.which == 13 )
openHashtagModalFromSearch(partialName.substr(1));
return;
}
if ( partialName.substr( 0, 1 ) == '@' ) { if ( partialName.substr( 0, 1 ) == '@' ) {
partialName = partialName.substr( 1 ); partialName = partialName.substr( 1 );

Loading…
Cancel
Save