Skip to content

Instantly share code, notes, and snippets.

@jmatt
Created April 7, 2010 19:44
Show Gist options
  • Save jmatt/359342 to your computer and use it in GitHub Desktop.
Save jmatt/359342 to your computer and use it in GitHub Desktop.
// Source: http://gist.github.com/180078
// original author: { name: "Ricardo Niederberger Cabral", email: "ricardo@isnotworking.com"}
var noun_type_article = {
_name: "anything",
suggest: function( text, html ) {
var suggestions = [CmdUtils.makeSugg(text)];
return suggestions;
}
}
CmdUtils.CreateCommand({
names: ["duckduckgo", "ddg"],
icon: "http://www.duckduckgo.com/favicon.ico",
homepage: "http://gist.github.com/359342",
author: { name: "J. Matt Peterson", email: "rovaedne@gmail.com"},
license: "MPL",
help: "Searches DuckDuckGo",
arguments: [{role:'object', nountype: noun_type_article, label:'keywords'}],
execute: function(args) {
var url = "https://duckduckgo.com/?q={QUERY}"
var query = args.object.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