Mercurial > my-ubiquity-commands
view wowhead/wowhead.js @ 0:a2715827c482
Origination.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Thu, 19 Mar 2009 23:30:41 -0700 |
parents | |
children | e077838df525 |
line wrap: on
line source
/* This is a template command. */ CmdUtils.CreateCommand({ name: "wowhead", icon: "http://www.wowhead.com/favicon.png", homepage: "http://www.wowhead.com/", author: {name: "Your Name", email: "you@example.com"}, license: "GPL", description: "A short description of your command", help: "How to use your command", takes: {"input": /.*/}, previewUrl: Utils.url({uri: "results.html", base: feed.id}), preview: function(pblock, input) { var url = ("http://www.wowhead.com/?search=" + encodeURI(input.text) + "&opensearch"); CmdUtils.previewAjax(pblock, { url: url, dataType: "text", error: function() { pblock.innerHTML = "Sorry, an error occurred."; }, success: function(data) { var scriptTag = pblock.ownerDocument.createElement("script"); scriptTag.textContent = "showResults(" + data + ");"; pblock.appendChild(scriptTag); } }); }, execute: function(input) { displayMessage("You selected: " + input.text); } });