Skip to content

Instantly share code, notes, and snippets.

@picanteverde
Created February 15, 2009 23:09
Show Gist options
  • Save picanteverde/64894 to your computer and use it in GitHub Desktop.
Save picanteverde/64894 to your computer and use it in GitHub Desktop.
function processNode() {
var href = jQuery(this).attr("href");
if(/[a-z]\:\/\//.exec(href) === null) {
if(href[0] == "/")
jQuery(this).attr("href", "http://www.taringa.net" + href);
}
}
CmdUtils.CreateCommand({
homepage: "http://www.taringa.net/",
author: {name:"picanteverde", email:"[email protected]"},
description: "Buscador de taringa (taringeador)",
name:"taringa",
takes: {"busqueda":noun_arb_text},
preview:function(pblock,input){
pblock.innerHTML= "<h2>TARINGA!</h2><p>Buscando "+ input.text +" en taringa ....</p>";
if(input.text!=""){
var url= "http://www.taringa.net/buscador.php?q=" + input.text;
Utils.parseRemoteDocument(
url, // URL
null, // post data
function(doc) { // success callback
jQuery(".link_resultado",doc).css("height","40px");
jQuery(".link_resultado",doc).css("border-top","1px solid #dddddd");
jQuery(".link_resultado",doc).css("padding-top","1px");
jQuery(".link_resultado_titulo",doc).css("float","left");
jQuery(".link_resultado_titulo",doc).css("font-weight","bold");
jQuery(".link_resultado_titulo",doc).css("font-size","9pt");
jQuery(".link_resultado_opc",doc).css("float","right");
jQuery(".link_resultado_opc",doc).css("color","#999999");
jQuery(".link_resultado_opc",doc).css("font-size","7pt");
jQuery(".box_cuerpo:nth(1)",doc).find("a").each(processNode);
var content = jQuery(".box_cuerpo:nth(1)",doc).html();
pblock.innerHTML = "<h2 style=\"margin-bottom:0px\">TARINGA! <span style=\"font-size:7pt;color:#dddddd\">buscando : \""+ input.text +"\"</span></h2>" + content;
},
function() { // error callback
pblock.innerHTML = "<h2>Error!</h2><p>En este momento la gente de taringa debe estar solucionando los problemas.</p>";
}
);
}
},
execute: function(input){
var msg = input.text + "... cargando busqueda de TARINGA!";
var url2 = "http://www.taringa.net/buscador.php?q=" + input.text;
Utils.openUrlInBrowser( url2 );
displayMessage( msg );
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment