Created
August 29, 2008 19:06
-
-
Save june29/8035 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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