Skip to content

Instantly share code, notes, and snippets.

Created September 18, 2008 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/11398 to your computer and use it in GitHub Desktop.
Save anonymous/11398 to your computer and use it in GitHub Desktop.
var noun_type_city = new CmdUtils.NounType (
"ime mesta",
["Beograd", "Cacak", "Valjevo", "Kragujevac"]
);
CmdUtils.CreateCommand({
name: "sr-map",
homepage: "http://v0xel.ubuntusrbija.org",
description: "Pretražuje B92 mape za zadatu ulicu i grad",
author: {
name: "Petar Vasic",
email: "p.vasic@gmail.com"
},
contributors: [
"Raca Mirko",
"Marko Kocić <marko.kocic@gmail.com>"
],
licence: "MPL",
help: "Pretražuje mape.b92.net za zadatu ulicu i broj, u zadatom gradu (podrazumevani grad je Beograd)",
takes: {"ulica": noun_arb_text},
modifiers: {
'broj': noun_arb_text,
'mesto': noun_type_city
},
preview: function (pblock, street, mods) {
pblock.innerHTML = "Korišćenje: <em>ime_ulice</em> broj <em>broj</em> mesto <em>ime_mesta</em>";
},
execute: function( street, mods ) {
var url = "http://mape.b92.net//map.aspx";
url += "?ulica=" + escape(street.text);
if (mods.broj.text !== undefined) {
url += "&Broj=" + escape(mods.broj.text);
}
if (mods.mesto.text === undefined) {
url += "&mesto=Beograd";
} else {
url += "&mesto=" + escape(mods.mesto.text);
}
Utils.openUrlInBrowser(url);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment