Skip to content

Instantly share code, notes, and snippets.

@bogomil bogomil/bgsearch
Created Sep 1, 2009

Embed
What would you like to do?
// Search bulgarian websites. It is still in development, but is more than usable.
CmdUtils.CreateCommand({
names: ['търси', 'дири', 'намери'],
arguments: [
{role: "object", label: 'дума', nountype: noun_arb_text},
{role: "goal", label: 'източник', nountype: noun_arb_text}
],
homepage: "http://www.bogomil.info/2759/",
author: {name: "Bogomil Shopov", email: "shopov.bogomil@gmail.com"},
license: "GPL",
description: "Търсене във много източници на български език.",
help: "Напишете какво искате да търсите и къде. Пример: търси вафла > Дневник.",
execute: function(arguments) {
var kakvo = arguments.object.text;
var kade = arguments.goal.text;
if(kade == "Дневник"){
var url = "http://www.dnevnik.bg/search.php?stext="+kakvo;
}
else if(kade == "Гювеч"){
var url ="http://search.gbg.bg/?q="+kakvo+"&c=gbg";
}
else if(kade == "Дира"){
kakvo= this._trans(kakvo);
var url= "http://diri.bg/search.php?textfield="+kakvo+"&vid=0";
}
else if(kade=="Актуално"){
kakvo = this._trans(kakvo);
var url = "http://www.actualno.com/search.html?search="+ kakvo;
}
else{
var url = "http://bogomil.info?"+kakvo+kade;
}
Utils.openUrlInBrowser(url);
},
_trans: function this_trans(what)
{
var req = new XMLHttpRequest;
req.open("POST", "http://bogomil.info/ubiquity/decode.php",false);
req.send(what);
var output = req.responseText;
// displayMessage(output);
return output;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.