Created
April 7, 2009 21:04
-
-
Save dacort/91454 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doSearch(query,page) { | |
page = parseInt(page); | |
if (!(page > 0)) { | |
page = 1; | |
} | |
$("#results").text(''); | |
$.getJSON("http://tweepsearch.com/search.json?query=" + query + "&page="+page+"&count=5&callback=?", | |
function(data){ | |
var content = "<table cellspacing='5'><td bgcolor='#e0e0e0' colspan='2' align='center'>Users matching <a target='_blank' href='http://tweepsearch.com/search?query=" + escape(query) + "'>" + $('<div/>').text(query).html() + "</a> from TweepSearch</td>"; | |
$.each(data, function(i,user) { | |
var img = user['profile_image_url'].replace('_normal', '_mini'); | |
var link = "http://twitter.com/" + user['screen_name']; | |
content += "<tr style='padding-bottom:10px;'><td><a target='_blank' href='"+link+"'><img height='24' width='24' border='0' src='" + img + "' /></a></td>"; | |
content += "<td style='line-height:13px;padding-left:5px;'>" + user['name']; | |
if (user['description'] > "") { | |
content += " - " + user['description']; | |
} else { | |
content += " - No description"; | |
} | |
content += "</td></tr>"; | |
}); | |
content += "</table>"; | |
if (data.length == 5) { | |
content += "<a href='javascript:doSearch(\"" + query.replace('"','\\"') + "\"," + (page+1) + ")'>Load more</a>"; | |
} | |
$("#results").append(content); | |
}); | |
} | |
$(document).ready(function(){ | |
doSearch("location:seattle"); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment