Skip to content

Instantly share code, notes, and snippets.

@BrunoCaimar
Created September 11, 2009 19:37
Show Gist options
  • Save BrunoCaimar/185521 to your computer and use it in GitHub Desktop.
Save BrunoCaimar/185521 to your computer and use it in GitHub Desktop.
DLPO - Dicionário Priberam de Lingua Portuguesa On-Line - Ubiquity command
CmdUtils.CreateCommand({
names: ["dlpo"],
icon: "http://www.priberam.pt/favicon.ico",
description: "DLPO - Dicionário Priberam de Lingua Portuguesa On-Line v0.0.3.20090917",
help: "Procura a definição da palavra informada no DLPO - Dicionário Priberam de Língua Portuguesa On-Line (http://www.priberam.pt/dlpo/)",
author: {
name: "Bruno Caimar",
email: "bruno.caimar@gmail.com"
},
license: "MIT",
homepage: "http://ubiquity.brunocaimar.com/",
arguments: [{
role: 'object',
nountype: noun_arb_text
}],
preview: function preview(pblock, args) {
pblock.innerHTML = "DLPO - Procura a definição para a palavra <b>" + args.object.html + "</b>";
var urlPreview = "http://www.priberam.pt/dlpo/verbeteacel.aspx";
var data = {
pal: args.object.text
};
if (Utils.trim(args.object.text) !== "") {
CmdUtils.previewGet(pblock, urlPreview, data, function (retorno) {
pblock.innerHTML += retorno;
},
"html");
}
},
execute: function execute(args) {
var urlExecute = "http://www.priberam.pt/dlpo/default.aspx";
urlExecute += "?pal=" + args.object.text;
Utils.openUrlInBrowser(urlExecute);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment