Skip to content

Instantly share code, notes, and snippets.

@tosch
Last active August 29, 2015 21:34
Show Gist options
  • Save tosch/47986 to your computer and use it in GitHub Desktop.
Save tosch/47986 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand({
names: ["lvb"],
description: "Reiseplanung der Nahverkehrsagentur Sachsen-Anhalt. Achtung: Umlaute funktionieren noch nicht so recht...",
help: "lvb starthaltestelle to endhaltestelle at zeit on datum",
arguments: [
{
role: 'source',
nountype: noun_arb_text,
label: 'Starthaltestelle'
},
{
role: 'goal',
nountype: noun_arb_text,
label: 'Endhaltestelle'
},
{
role: 'time',
nountype: noun_type_time
}
],
execute: function(args) {
var url;
var data;
url = "http://reiseauskunft.insa.de/bin/query.exe/dn";
var options;
options = {
'MDV': 'MDV',
'queryPageDisplayed': 'no',
'REQ0JourneyStopsS0A': '23', // Typ from
'REQ0JourneyStopsS0G': Utils.convertFromUnicode('iso-8859-1', args.source.text), // from
'REQ0JourneyStopsS0ID': '',
'REQ0JourneyStopsZ0A': '23', // Typ to
'REQ0JourneyStopsZ0G': Utils.convertFromUnicode('iso-8859-1', args.goal.text), // to
'REQ0JourneyStopsZ0ID': '',
'iER': 'no',
'REQ0JourneyStopsS0B=5&REQ0JourneyStopsZ0B=5&iER': 'no',
'REQ0JourneyDate': args.time.data.toString('dd.MM.yyyy'), // date
'wDayExt0': 'Mo|Di|Mi|Do|Fr|Sa|So',
'REQ0JourneyTime': args.time.data.toString('HH:mm'), // time
'REQ0HafasSearchForw': '1', // Abfahrt, 0 waere Ankunft
'REQ0JourneyProduct_prod_list': '',
'start': 'submit'
};
Utils.openUrlInBrowser(url, options);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment