Skip to content

Instantly share code, notes, and snippets.

@imsaar
Created January 28, 2009 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imsaar/54172 to your computer and use it in GitHub Desktop.
Save imsaar/54172 to your computer and use it in GitHub Desktop.
Dictionary Lookup Mozilla Ubiquity Command
/* This is Ali Rizvi's ubiquity first command */
CmdUtils.CreateCommand({
name: "dictionary",
// icon: "http://saaridev.wordpress.com",
homepage: "http://saaridev.wordpress.com",
author: { name: "Ali Rizvi", email: "@gmail.com"},
license: "Ruby License",
description: "Command to lookup a work on dictioanry.com",
help: "dictionary <word-to-lookup>",
takes: {"input": noun_arb_text},
preview: function( pblock, input ) {
searchText = jQuery.trim(input.text);
if(searchText.length < 1) {
pblock.innerHTML = "Searches for word on dictionary.com";
return;
}
var previewTemplate = "Searches dictionary.com for <b>${query}</b>";
var previewData = {query: searchText};
pblock.innerHTML = CmdUtils.renderTemplate(previewTemplate, previewData);
},
execute: function(input) {
var url = "http://dictionary.reference.com/browse/{QUERY}";
var query = input.text ;
var urlString = url.replace("{QUERY}", query);
Utils.openUrlInBrowser(urlString);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment