-
-
Save dextergk/206899 to your computer and use it in GitHub Desktop.
India: Train Running Status
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
/* 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