-
-
Save imsaar/54172 to your computer and use it in GitHub Desktop.
Dictionary Lookup Mozilla Ubiquity Command
This file contains 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
/* 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