Skip to content

Instantly share code, notes, and snippets.

@jyt

jyt/map directions

Created Jul 27, 2009
Embed
What would you like to do?
//This is a ubiquity command
//to view a map and diections for places specified by you in India.
CmdUtils.CreateCommand({
names: ["view directions","map directions"],
icon: "chrome://ubiquity/skin/icons/map.png",
description: "This command will open a map which show the directions about how to reach from a given place to a given destination in India",
help: "To view the directions type the name of places whose direction map you want to see",
author: {name: "Jyoti", email: "mail2jyoti88@gmail.com"},
homepage: "http://jyzyy.blogspot.com/",
arguments: [{role: 'source', nountype: noun_arb_text},
{role: 'goal', nountype: noun_arb_text}
],
preview: function preview(pblock, args) {
pblock.innerHTML = "view a map depiccting the directions from <b>" + args.source.html + "</b> to <b>"+args.goal.html+"</b>.";
},
execute: function(args)
{
if(args.source.text=="")
{
displayMessage("You havent specified the source");
return;
}
else if(args.goal.text=="")
{
displayMessage("You havent specified the destination");
return;
}
else
{
Utils.openUrlInBrowser("http://maps.mapmyindia.com/?where=from:"+args.source.text+" to:"+args.goal.text+"&q=search")
}
}
});
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.