Skip to content

Instantly share code, notes, and snippets.

@dann
Created August 30, 2008 02:16
Show Gist options
  • Save dann/8080 to your computer and use it in GitHub Desktop.
Save dann/8080 to your computer and use it in GitHub Desktop.
makeSearchCommand({
name: "cpan",
url: "http://search.cpan.org/search?q={QUERY}&mode=module",
icon: "http://search.cpan.org/favicon.icon",
description: "Searches <a href=\"http://search.cpan.org/\">CPAN</a> for your words.",
preview: function(pblock, directObject){
var searchTerm = directObject.text;
var pTemplate = "Searches <b>${query}</b> from <a href=\"http://search.cpan.org/\">CPAN</a>.";
var pData = {query: searchTerm};
pblock.innerHTML = CmdUtils.renderTemplate(pTemplate, pData);
var url = "http://search.cpan.org/search";
var params = {q: searchTerm, mode: "module"};
jQuery.get( url, params, function(data) {
jQuery(pblock).html(data);
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment