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 @@ @@ -429,6 +429,7 @@
<button class="postboard-news" style="display:none;"></button>
</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>

28
js/interface_common.js

@ -5,8 +5,6 @@ @@ -5,8 +5,6 @@
// Profile, mentions and hashtag modal
// Post actions: submit, count characters
var preventSlide = false;
//dispara o modal genérico
//o modalClass me permite fazer tratamentos específicos de CSS para cada modal
function openModal( modalClass )
@ -161,6 +159,19 @@ function openHashtagModal(e) @@ -161,6 +159,19 @@ function openHashtagModal(e)
$( "."+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) {
var $hashtagModalClass = $(".hashtag-modal");
if( !$hashtagModalClass.length || $hashtagModalClass.css("display") == 'none' )
@ -239,7 +250,7 @@ var reTwistPopup = function( e ) @@ -239,7 +250,7 @@ var reTwistPopup = function( e )
{
if(!defaultScreenName)
{
preventSlide=true;
e.stopPropagation();
alert(polyglot.t("You have to log in to retransmit messages."));
return;
}
@ -317,14 +328,7 @@ var postExpandFunction = function( e, postLi ) @@ -317,14 +328,7 @@ var postExpandFunction = function( e, postLi )
var openClass = "open";
//This is used in "guest mode", when user gets an alert that he can't reply or retransmit
//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 ) ) {
if( !postLi.hasClass( openClass ) ) {
originalPost.detach();
postLi.empty();
postLi.addClass( openClass );
@ -388,7 +392,7 @@ var postReplyClick = function( e ) @@ -388,7 +392,7 @@ var postReplyClick = function( e )
{
if(!defaultScreenName)
{
preventSlide=true;
e.stopPropagation();
alert(polyglot.t("You have to log in to post replies."));
return;
}

3
js/interface_localization.js

@ -205,7 +205,8 @@ if(preferredLanguage == "en"){ @@ -205,7 +205,8 @@ if(preferredLanguage == "en"){
"Custom": "Custom",
"Mentions": "Mentions",
"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"){

4
js/twister_actions.js

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

14
js/twister_following.js

@ -354,8 +354,20 @@ function closeSearchDialog() @@ -354,8 +354,20 @@ function closeSearchDialog()
_lastSearchUsersResults = [];
}
function userSearchKeypress(item) {
function userSearchKeypress(event) {
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 ) == '@' ) {
partialName = partialName.substr( 1 );

Loading…
Cancel
Save