Implement all platforms display
This commit is contained in:
parent
813e5bc0f9
commit
6f7f778312
|
@ -182,7 +182,11 @@ def latest():
|
||||||
result = {}
|
result = {}
|
||||||
result['time_offset'] = timenow.utcoffset().total_seconds()
|
result['time_offset'] = timenow.utcoffset().total_seconds()
|
||||||
|
|
||||||
departures = do_request('/v3/departures/route_type/{}/stop/{}'.format(ROUTE_TYPE, flask.request.args['stop_id']), {'platform_numbers': flask.request.args['plat_id'], 'max_results': '5', 'expand': 'all'}, cachetime=60)
|
args = {'max_results': '5', 'expand': 'all'}
|
||||||
|
if flask.request.args['plat_id'] != '0':
|
||||||
|
args['platform_numbers'] = flask.request.args['plat_id']
|
||||||
|
|
||||||
|
departures = do_request('/v3/departures/route_type/{}/stop/{}'.format(ROUTE_TYPE, flask.request.args['stop_id']), args, cachetime=60)
|
||||||
departures['departures'].sort(key=lambda x: x['scheduled_departure_utc'])
|
departures['departures'].sort(key=lambda x: x['scheduled_departure_utc'])
|
||||||
|
|
||||||
if len(departures['departures']) == 0:
|
if len(departures['departures']) == 0:
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="topbar">Stop <span id="stopinfo">?</span> [<a href="stations">change</a>] Platform <span id="platinfo">?</span> [<a href="#" onclick="return changePlatform();">change</a>] Style <span id="styleinfo">?</span> [change: <a href="#" onclick="return changeStyle(1);">1</a>, <a href="#" onclick="return changeStyle(2);">2</a>]</div>
|
<div id="topbar">Stop <span id="stopinfo">?</span> [<a href="stations">change</a>] <span id="platinfo">Platform ?</span> [<a href="#" onclick="return changePlatform();">change</a>] Style <span id="styleinfo">?</span> [change: <a href="#" onclick="return changeStyle(1);">1</a>, <a href="#" onclick="return changeStyle(2);">2</a>]</div>
|
||||||
<div id="botbar">By RunasSudo · AGPLv3 · <a href="https://gitlab.com/RunasSudo/virtual-metro">Source Code</a> · Data from PTV licensed under CC BY 4.0</div>
|
<div id="botbar">By RunasSudo · AGPLv3 · <a href="https://gitlab.com/RunasSudo/virtual-metro">Source Code</a> · Data from PTV licensed under CC BY 4.0</div>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/nunjucks/3.0.1/nunjucks.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/nunjucks/3.0.1/nunjucks.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
var template_id = parseInt(getQueryVariable("template_id", 1));
|
var template_id = parseInt(getQueryVariable("template_id", 1));
|
||||||
|
|
||||||
document.getElementById("stopinfo").innerText = stop_id;
|
document.getElementById("stopinfo").innerText = stop_id;
|
||||||
document.getElementById("platinfo").innerText = plat_id;
|
document.getElementById("platinfo").innerText = (plat_id == 0) ? "All Platforms" : ("Platform " + plat_id);
|
||||||
document.getElementById("styleinfo").innerText = template_id;
|
document.getElementById("styleinfo").innerText = template_id;
|
||||||
|
|
||||||
var svg = null;
|
var svg = null;
|
||||||
|
@ -107,10 +107,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function changePlatform() {
|
function changePlatform() {
|
||||||
var new_plat = parseInt(window.prompt("Enter new platform number:", plat_id));
|
var new_plat = window.prompt("Enter new platform number, or 0 for all platforms:", plat_id);
|
||||||
|
if (new_plat !== null) {
|
||||||
|
new_plat = parseInt(new_plat);
|
||||||
window.location = "?stop_id=" + stop_id + "&plat_id=" + new_plat + "&template_id=" + template_id;
|
window.location = "?stop_id=" + stop_id + "&plat_id=" + new_plat + "&template_id=" + template_id;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function changeStyle(new_style) {
|
function changeStyle(new_style) {
|
||||||
window.location = "?stop_id=" + stop_id + "&plat_id=" + plat_id + "&template_id=" + new_style;
|
window.location = "?stop_id=" + stop_id + "&plat_id=" + plat_id + "&template_id=" + new_style;
|
||||||
|
|
Loading…
Reference in New Issue