summaryrefslogtreecommitdiff
path: root/public/static/js/collapse.js
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-10-15 18:41:57 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2019-10-15 18:41:57 +0200
commit4412dc8cf30d7ac812178d91ce5674c9c773902e (patch)
tree17b36debc5655e86a11222d95fb4c9858e3ffef2 /public/static/js/collapse.js
parent7a11b1366d4748b8708d52f09ec3d3dfb650168a (diff)
prepare more detailed traininfo view when offline / on slow network
Diffstat (limited to 'public/static/js/collapse.js')
-rw-r--r--public/static/js/collapse.js29
1 files changed, 28 insertions, 1 deletions
diff --git a/public/static/js/collapse.js b/public/static/js/collapse.js
index e7d0fe0..bd0b02f 100644
--- a/public/static/js/collapse.js
+++ b/public/static/js/collapse.js
@@ -11,6 +11,8 @@ function reload_app() {
function dbf_reg_handlers() {
$('div.app > ul > li').click(function() {
var trainElem = $(this);
+ var routeprev = trainElem.data('routeprev').split('|');
+ var routenext = trainElem.data('routenext').split('|');
$('.moreinfo').each(function() {
var infoElem = $(this);
$('.moreinfo .train-line').removeClass('bahn sbahn fern ext').addClass(trainElem.data('linetype'));
@@ -23,10 +25,35 @@ function dbf_reg_handlers() {
$('.moreinfo .verbose').html('');
$('.moreinfo .mroute').html('');
$('.moreinfo ul').html('');
+ if (trainElem.data('platform').length > 0) {
+ $('.moreinfo .mfooter').append('<div class="platforminfo">Gleis ' + trainElem.data('platform') + '</div>')
+ }
+ var timebuf = '';
+ if (trainElem.data('arrival').length > 0) {
+ timebuf += 'Ankunft: ' + trainElem.data('arrival') + '<br/>';
+ }
+ if (trainElem.data('departure').length > 0) {
+ timebuf += 'Abfahrt: ' + trainElem.data('departure');
+ }
+ $('.moreinfo .mfooter').append('<div class="timeinfo">' + timebuf + '</div>');
+ if (trainElem.data('routeprev').length > 0) {
+ var routebuf = '';
+ for (var key in routeprev) {
+ routebuf += '<li>' + routeprev[key] + '</li>';
+ }
+ $('.moreinfo .mfooter').append('Von: <ul class="mroute">' + routebuf + '</ul>');
+ }
+ if (trainElem.data('routenext').length > 0) {
+ var routebuf = '';
+ for (var key in routenext) {
+ routebuf += '<li>' + routenext[key] + '</li>';
+ }
+ $('.moreinfo .mfooter').append('Nach: <ul class="mroute">' + routebuf + '</ul>');
+ }
$.get(window.location.href, {train: trainElem.data('train'), ajax: 1}, function(data) {
$('.moreinfo').html(data);
}).fail(function() {
- $('.moreinfo .mfooter').html('Der Zug ist abgefahren (Zug nicht gefunden)');
+ $('.moreinfo .mfooter').append('Der Zug ist abgefahren (Zug nicht gefunden)');
});
infoElem.removeClass('collapsed-moreinfo');
infoElem.addClass('expanded-moreinfo');