Skip to content

Instantly share code, notes, and snippets.

@mazexx mazexx/x
Created Nov 14, 2008

What would you like to do?
Ubiquity Command - Time table for ÖBB
/* Code largely reused from Mauro Frigerio's SBB Time table command */
name: "öbb",
author: { name: "Matthias Schlaipfer", email: ""},
license: "CC",
icon: "http://www.ö",
description: "Time table for Austrian Railways",
takes: { "Destination":noun_arb_text },
modifiers: { from:noun_arb_text },
execute: function( directObject, info ) {
var destination = directObject.text;
var currentTime = new Date();
var hours = currentTime.getHours();
var minutes = currentTime.getMinutes();
var month = currentTime.getMonth() + 1;
var day = currentTime.getDate();
var year = currentTime.getFullYear();
/* Default departure station vvvv */
var departure = info.from.text || "Graz";
var url = "{DEP}&REQ0JourneyDate={DATE}&timesel=depart&start=1&ld=oebb&image.x=47&image.y=23&Z={DEST}&time={HOUR}%3A{MINUTE}";
url = url.replace( /{DEST}/g, destination);
url = url.replace( /{DEP}/g, departure);
url = url.replace( /{DATE}/g, day+"."+month+"."+year);
url = url.replace( /{HOUR}/g, hours);
url = url.replace( /{MINUTE}/g, minutes);
Utils.openUrlInBrowser( url );
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.