Skip to content

Instantly share code, notes, and snippets.

@patcito
Created October 10, 2008 02:11
Show Gist options
  • Save patcito/15965 to your computer and use it in GitHub Desktop.
Save patcito/15965 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand(
{
name: "isohunt",
takes: {"function": noun_arb_text},
icon: "http://isohunt.com/favicon.ico",
homepage: "http://isohunt.com/",
author: {name: "isoHunt", email: "[email protected]"},
license: "MPL,GPL",
description: "Search isoHunt - Bittorrent Search Engine",
help: "Select a key word",
execute: function(directObject)
{
var url = "http://isohunt.com/torrents/{QUERY}"
var urlString = url.replace("{QUERY}", directObject.text);
Utils.openUrlInBrowser(urlString);
},
preview: function(pblock, directObject)
{
searchText = jQuery.trim(directObject.text);
if(searchText.length <= 0)
{
pblock.innerHTML = "Search isoHunt";
return;
}
var previewTemplate = "Search isoHunt ${query}";
var previewData = {query: searchText};
pblock.innerHTML = CmdUtils.renderTemplate(previewTemplate, previewData);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment