Skip to content

Instantly share code, notes, and snippets.

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

Embed
What would you like to do?
/* Getting the train list from a given station pair any where in India. */
CmdUtils.CreateCommand({
names: ["TrainsList"],
icon: "http://www.erail.in/ico/erail.ico",
description: "Gets the train list for a given station pair any where in India, also displays weekly schedule.",
help: "<i>Type the command foll by source and destination station codes</i><br/>for example TrainList dli cstm.",
author: {name: "DexterGk", email: "dextergk@gmail.com"},
license: "GPL",
homepage: "http://dextergk.blogspot.com/",
arguments: [{role: 'source', nountype: noun_arb_text, label: 'city'},
{role: 'goal', nountype: noun_arb_text, label: 'city'}],
preview: function preview(pblock, {source, goal}) {
pblock.innerHTML = this.help;
},
execute: function({source, goal}) {
if(source.text) {
var temp = source.text;
var l = temp.indexOf(" ");
var src = temp.substr(0,l); var des = temp.substr(l+1,temp.length); }
var baseUrl = "http://erail.in?T="+src.toUpperCase()+"::"+des.toUpperCase()+":";
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.