-
-
Save anonymous/126316 to your computer and use it in GitHub Desktop.
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
CmdUtils.CreateCommand({ | |
name: "wikipedia", | |
description: "ウィキペディア", | |
help: "基本的に誰でも加筆や修正ができるWiki形式のWeb百科事典です。", | |
query_url: "http://ja.wikipedia.org/w/wiki.phtml?search=", | |
icon: "http://ja.wikipedia.org/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