0
|
1 /* This is a template command. */
|
|
2 CmdUtils.CreateCommand({
|
|
3 name: "wowhead",
|
|
4 icon: "http://www.wowhead.com/favicon.png",
|
|
5 homepage: "http://www.wowhead.com/",
|
|
6 author: {name: "Your Name", email: "you@example.com"},
|
|
7 license: "GPL",
|
|
8 description: "A short description of your command",
|
|
9 help: "How to use your command",
|
|
10 takes: {"input": /.*/},
|
|
11 previewUrl: Utils.url({uri: "results.html", base: feed.id}),
|
|
12 preview: function(pblock, input) {
|
|
13 var url = ("http://www.wowhead.com/?search=" + encodeURI(input.text) +
|
|
14 "&opensearch");
|
|
15 CmdUtils.previewAjax(pblock, {
|
|
16 url: url,
|
|
17 dataType: "text",
|
|
18 error: function() {
|
|
19 pblock.innerHTML = "Sorry, an error occurred.";
|
|
20 },
|
|
21 success: function(data) {
|
|
22 var scriptTag = pblock.ownerDocument.createElement("script");
|
|
23 scriptTag.textContent = "showResults(" + data + ");";
|
|
24 pblock.appendChild(scriptTag);
|
|
25 }
|
|
26 });
|
|
27 },
|
|
28 execute: function(input) {
|
|
29 displayMessage("You selected: " + input.text);
|
|
30 }
|
|
31 });
|