Created
July 31, 2009 12:47
-
-
Save antoniodourado/159208 to your computer and use it in GitHub Desktop.
Hack para fazer buscas no Mercado Livre BR
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
/* Hack para o Mercado Livre Versão 0.1 | |
Sintaxe: | |
-ml <conteudo de pesquisa> | |
-mercadolivre <conteudo de pesquisa> | |
Todos os direitos reservados. | |
*/ | |
CmdUtils.CreateCommand({ | |
names: ["mercadolivre","ml"], | |
icon: "http://www.mercadolivre.com.br/favicon.ico", | |
description: "Realiza buscas no mercado livre", | |
help: "Digite ml ou mercadolivre seguido do termo a ser pesquisado no Mercado Livre.", | |
author: {name: "Antonio Dourado", email: "antoniodourado@gmail.com"}, | |
license: "GPL", | |
homepage: "www.twitter.com/antoniodourado", | |
arguments: [{role: 'object', nountype: noun_arb_text}], | |
preview: function preview(pblock, args) { | |
var schString = jQuery.trim(args.object.text); | |
if(schString.length > 0) | |
pblock.innerHTML = "Sua busca no mercado livre será feita com o seguinte conteúdo \n <b>" + args.object.html + "</b>."; | |
else | |
pblock.innerHTML = "Você deverá digitar palavras para a busca!"; | |
}, | |
execute: function execute(args) { | |
var schString = jQuery.trim(args.object.text); | |
var urlSite = "http://lista.mercadolivre.com.br/"; | |
if(schString.length > 0){ | |
schString = schString.replace(/\s/g,'-'); | |
Utils.openUrlInBrowser(urlSite+schString); | |
} | |
else | |
displayMessage("Não foram informadas palavras para a busca.") | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ricardoalves101020030@gmail.com