public
Last active

  • Download Gist
ubiquity-twitter-search.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
makeSearchCommand({
name: "twitter-search",
url: "http://search.twitter.com/search?q={QUERY}",
icon: "http://twitter.com/favicon.ico",
description: "Searches twitter for your words.",
preview: function(pBlock, directObject) {
var query = directObject.text;
pBlock.innerHTML = "Searching for...";
 
var url = "http://search.twitter.com/search.json";
var params = {q: query};
var pTemplate = '<table>{for result in results}<tr><td><img src="${result.profile_image_url}" /></td><td><a href="http://twitter.com/${result.from_user}/statuses/${result.id}" style="color: yellow;">${result.from_user}</a>: ${result.text}</td></tr>{/for}</table>';
 
jQuery.get(url, params, function(response) {
var json = Utils.decodeJson(response);
pBlock.innerHTML = CmdUtils.renderTemplate(pTemplate, json);
});
}
});

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.