Skip to content

Instantly share code, notes, and snippets.

/x

Created June 9, 2009 06:19
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 anonymous/126313 to your computer and use it in GitHub Desktop.
Save anonymous/126313 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand({
name: "amazon",
description: "Amazonで書籍や通販商品を検索",
help: "Amazonで書籍を検索します。パラメータに検索キーワードを指定します。",
query_url: "http://www.amazon.co.jp/gp/associates/link-types/searchbox.html?tag=levelup05-22&creative=2131&adid=01SGMPBBB8DW2NSRAEMH&campaign=483&__mk_ja_JP=%83J%83%5E%83J%83i&mode=blended&Submit=Go&keyword=",
icon: "http://www.amazon.co.jp/favicon.ico",
stand: "startcommand",
takes: {parameter: noun_arb_text},
_getQuery: function(directObject) {
var query = this.name;
if (directObject.text != "")
query += " " + directObject.text;
return encodeURI(query);
},
preview: function( pblock, directObject ) {
var shot_url = "http://mozshot.nemui.org/shot?";
var img_url = "<img src='" + shot_url + this.query_url + "'/>";
var help = "<p>" + this.help + "</p>";
pblock.innerHTML = help + img_url;
},
execute: function(directObject) {
var url = "http://www.startcommand.com/stand/" + this.stand + "?cmd={QUERY}";
var query = this._getQuery(directObject);
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