-
-
Save dextergk/207772 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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