2011-02-07 3 views
0

Я хочу добавить виджет twitter hastag в мое приложение, как это сделать. функция должна попросить пользователя добавить хэш-тег конкретной вещи и добавить его на страницу своего профиля, как это сделать.Twitter hashtag

Просьба предложить мне логику и реализацию

ответ

0

я, наконец, получил решение этой проблемы я был в состоянии получить каналы из твиттера и разместить его на моем веб-приложение, я ищу для конкретного хэш-тега и фиды что особенно хэш тег будет отображаться

здесь код,

<script type="text/javascript">  
    $(document).ready(function() // don't do anything until the document is loaded. 
    {  
    $("#submit").click(function(event){ // wire up this as an onclick event to the submit button. 
var searchTerm = $("#search").val() ; // get the user-entered search term 
var baseUrl = "http://search.twitter.com/search.json?q=%23"; 
$.getJSON(baseUrl + searchTerm + "&rpp=1500&callback=?", function(data) // call getJSON providing the complete url with search term and a JSONP callback 
{ 
$("#tweets").empty(); // clear out any previous results. 
if(data.results.length < 1) // friendly "no results" 
    $('#tweets').html("No results JOINEVENTUS"); 
$.each(data.results, function() // iterate over the results; 
{ 
$('<div align="justify"></div>') 
.hide() 
.append('<img src="' + this.profile_image_url + '" width="80px" /> ') 
.append('<span><a href="http://www.twitter.com/' 
+ this.from_user + '">' + this.from_user 
+ '</a> ' + makeLink(this.text) + '</span>') 
.appendTo('#tweets') // append the constructed results HTML to the tweets div 
.fadeIn(2000); // fade in the results over 2 seconds. 
}); 
}); 
}); 
}); 

function makeLink(text) // this REGEX converts http(s) links that are embedded in the tweet text into real hyperlinks. 
{ 
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; 
return text.replace(exp,"<a href='$1'>$1</a>"); 
} 
</script> 
</HEAD> 
<BODY style="margin-left:20%;margin-right:20%"> 
<div align="center"> 
<h2>Twitter tag search</h2> 
<div>Enter Search Term</div> 
<input type="text" id=search /> 
<input type="button" id=submit value="Search" /> 
<DIV id="tweets" /> 
</div> 

</BODY> 
Смежные вопросы