Skip to content

@june29 /ubiquity-twitter-search.js
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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);
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.