imsaar (owner)

Revisions

  • 76571b imsaar Wed Jan 28 17:36:04 -0800 2009
  • 132a27 Wed Jan 28 13:08:20 -0800 2009
  • 73351e Wed Jan 28 12:44:16 -0800 2009
  • cff017 Wed Jan 28 12:42:42 -0800 2009
  • a9ba95 Wed Jan 28 12:42:02 -0800 2009
gist: 54172 Download_button fork
public
Description:
Dictionary Lookup Mozilla Ubiquity Command
Public Clone URL: git://gist.github.com/54172.git
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* 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);
  }
});