Skip to content

Instantly share code, notes, and snippets.

@dextergk dextergk/x.js
Created Oct 10, 2009

Embed
What would you like to do?
India: Train Running Status
/* This is my first ubiq command. */
CmdUtils.CreateCommand({
names: ["TrainRunStat"],
icon: "http://www.erail.in/ico/erail.ico",
description: "Finds Train Running Status for Today.",
help: "<i>Type the command foll by train number</i><br/>for example TrainRunStat 2341.",
author: {name: "DexterGk", email: "dextergk@gmail.com"},
license: "GPL",
homepage: "http://dextergk.blogspot.com/",
arguments: [{role: 'object', nountype: noun_arb_text, label: 'train code'}],
preview: function preview(pblock, args) {
pblock.innerHTML = this.help;
},
execute: function(arguments) {
if(Utils.trim(arguments.object.text).length<4)
return;
var arg = Utils.trim(arguments.object.text);
var today = new Date();
var month = today.getMonth() + 1;
var sep = "%2f0";
if(month > 9)
sep = "%2f";
var date =
today.getDate() + sep +
month + "%2f" +
today.getFullYear();
var baseUrl = "http://www.trainenquiry.com/RunningTT_Display.aspx?drop_sel="+arg+"&date="+date;
Utils.openUrlInBrowser(baseUrl);
}
});
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.