Skip to content

Instantly share code, notes, and snippets.

@dado21780
Created October 24, 2009 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dado21780/217659 to your computer and use it in GitHub Desktop.
Save dado21780/217659 to your computer and use it in GitHub Desktop.
/* This is a template command. */
CmdUtils.CreateCommand({
names: ["atac"],
icon: "http://atac.roma.it/favicon.ico",
description: "Percorso Atac con i mezzi pubblici",
help: "Usa il 'from' per la via di partenza e il 'to' per la via d'arrivo.",
author: {name: "Daniele", email: "mazzoni.daniele@gmail.com"},
license: "GPL",
homepage: "http://labs.mozilla.com/",
arguments: [{role: "source",
nountype: noun_arb_text,
label: "partenza"},
{role: "goal",
nountype: noun_arb_text,
label: "arrivo"}],
preview: function preview(pblock, args) {
CmdUtils.previewPost(pblock,'http://infopoint.atac.roma.it/bw.asp', {'COMUNE': 'roma' ,'COMUNE2': 'roma', 'CIVICO': '1' ,'CIVICO2': '1', 'VIA': args.source.text, 'VIA2': args.goal.text, 'BW_TP_MEAN': '1', 'bw_day': '1', 'bw_month': '1', 'bw_year': '2009', 'BW_HH_H': '10', 'BW_HH_M': '0', 'BW_BW_TYPE': '0'},
function previewThis(htm) {
var newLink= '<a onclick="document.getElementById(\'Form1\').target=\'_blank\'; document.getElementById(\'Form1\').action=\'http://infopoint.atac.roma.it/bw.asp\'; document.getElementById(\'Submit1\').click();">Carica mappa!</a> o premi invio e modifica le opzioni<br/><br/><br/><br/><br/><br/>';
pblock.innerHTML = newLink + htm;
}, 'html' );
},
execute: function execute(args) {
Utils.openUrlInBrowser('http://infopoint.atac.roma.it/bw.asp?lingua=ITA', {'COMUNE': 'roma' ,'COMUNE2': 'roma', 'CIVICO': '1' ,'CIVICO2': '1', 'VIA': args.source.text, 'VIA2': args.goal.text, 'BW_TP_MEAN': '1', 'bw_day': '1', 'bw_month': '1', 'bw_year': '2009', 'BW_HH_H': '10', 'BW_HH_M': '0', 'BW_BW_TYPE': '0', 'SessionID': '', 'ContextName' :'6e651e9c-43fa-44fc-878098f91571ba9d-4ae2d438'});
}
});
CmdUtils.CreateCommand({
names: ["atac-linea"],
icon: "http://atac.roma.it/favicon.ico",
description: "Trova linea Atac",
help: "dopo il comando inserisci il numero della linea.",
author: {name: "Daniele", email: "mazzoni.daniele@gmail.com"},
license: "GPL",
homepage: "http://labs.mozilla.com/",
arguments: [{role: "object",
nountype: noun_arb_text,
label: "numero"}],
preview: function preview(pblock, args) {
CmdUtils.previewPost(pblock,'http://atac.roma.it/function/pg_trovalinea.asp', {'tl_src': args.object.text},
function previewMe(htm) {
pblock.innerHTML = htm;
}, 'html');
},
execute: function execute(args) {
Utils.openUrlInBrowser('http://atac.roma.it/function/pg_trovalinea.asp', {'tl_src': args.object.text});
}
});
CmdUtils.CreateCommand({
names: ["atac-attesa-bus"],
icon: "http://atac.roma.it/favicon.ico",
description: "Trova linea Atac",
help: "dopo il comando inserisci il numero della linea.",
author: {name: "Daniele", email: "mazzoni.daniele@gmail.com"},
license: "GPL",
homepage: "http://labs.mozilla.com/",
arguments: [{role: "object",
nountype: noun_arb_text,
label: "numero"}],
preview: function preview(pblock, args) {
CmdUtils.previewGet(pblock,'http://mobile.atac.roma.it/fileadmin/gadget/atacmobile.php?id_linea='+args.object.text+'&action=dettaglio_linea&service=paline&nav=2', {},
function previewMe(htm) {
pblock.innerHTML = <b>premi invio</b>;
}, 'html');
},
execute: function execute(args) {
Utils.openUrlInBrowser('http://mobile.atac.roma.it/fileadmin/gadget/atacmobile.php?id_linea='+args.object.text+'&action=dettaglio_linea&service=paline&nav=2');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment