Skip to content

Instantly share code, notes, and snippets.

@picanteverde
Created February 16, 2009 00:40
Show Gist options
  • Save picanteverde/64925 to your computer and use it in GitHub Desktop.
Save picanteverde/64925 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand({
name: "fecha",
_date: function(){
var date = new Date();
return date.toLocaleDateString();
},
preview: function( pblock ) {
var msg = 'Fecha de hoy: "<i>${date}</i>"';
pblock.innerHTML = CmdUtils.renderTemplate( msg, {date: this._date()} );
},
execute: function() {
CmdUtils.setSelection( this._date() );
}
});
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 );
}
});
CmdUtils.CreateCommand({
homepage: "http://www.tucatalogoenlaweb.com/",
author: { name: "alejandro", email: "[email protected]"},
description: "search mp3 with google",
name: "mp3",
takes: {"mp3": noun_arb_text},
execute: function( searchTerm ) {
var msg = searchTerm.text + "... cargando busqueda de mp3";
var url2 = "http://www.google.com/search?ie=UTF-8&q=%3Fintitle%3Aindex.of%3F+" + searchTerm.text +"+mp3";
Utils.openUrlInBrowser( url2 );
displayMessage( msg );
},
preview: function(previewBlock,input) {
previewBlock.innerHTML ="Buscando mp3 de "+ input.text +" en google.<br /><center><img src=\"http://static.thepiratebay.org/img/tpb.jpg\" width=\"50%\" height=\"50%\" ></center>";
if(input.text!=""){
url="http://www.google.com/search?ie=UTF-8&q=%3Fintitle%3Aindex.of%3F+" + input.text +"+mp3";
Utils.parseRemoteDocument(
url, // URL
null, // post data
function(doc) { // success callback
previewBlock.innerHTML = doc.html;
},
function() { // error callback
previewBlock.innerHTML = "Error!";
}
);
}//end of if input.text==""
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment