Skip to content

Instantly share code, notes, and snippets.

@kaichen
Created October 29, 2008 13:34
Show Gist options
  • Save kaichen/20692 to your computer and use it in GitHub Desktop.
Save kaichen/20692 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand({
name: "dict",
icon: "http://dict.cn/favicon.ico",
homepage: "http://dict.cn/",
author: { name: "Kai Chen", email: "[email protected]"},
license: "GPL",
description: "Search word in dict.cn",
help: "dict word_wanted_to_search",
takes: {"input": noun_arb_text},
preview: function( pblock, input ) {
pblock.innerHTML = "Search dict.cn: " + input.text;
},
execute: function(input) {
var url = "http://dict.cn/{QUERY}"
var query = input.text + ".htm";
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