diff options
author | Daniel Friesel <derf@finalrewind.org> | 2023-01-29 17:40:27 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2023-01-29 17:40:27 +0100 |
commit | 6526ae6a64c14f9d64a791b778b157f502a5aa0a (patch) | |
tree | 1d31b11010b2e3ae8d6f0fdc24315888cefbf692 /public | |
parent | a32109701fc567defbd6673e9cdf6bdf10b83ec7 (diff) |
add hafas (bus, ubahn, tram) support
Diffstat (limited to 'public')
-rw-r--r-- | public/static/js/collapse.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/public/static/js/collapse.js b/public/static/js/collapse.js index 82420c7..0c4178f 100644 --- a/public/static/js/collapse.js +++ b/public/static/js/collapse.js @@ -29,7 +29,7 @@ function dbf_show_moreinfo(trainElem, keep_old) { $('.moreinfo').each(function() { const infoElem = $(this); if (!keep_old) { - $('.moreinfo .train-line').removeClass('bahn sbahn fern ext').addClass(trainElem.data('linetype')); + $('.moreinfo .train-line').removeClass('sbahn fern ext ubahn bus tram').addClass(trainElem.data('linetype')); $('.moreinfo .train-line').text(trainElem.data('line')); $('.moreinfo .train-no').text(trainElem.data('no')); $('.moreinfo .train-origin').text(trainElem.data('from')); @@ -80,7 +80,7 @@ function dbf_show_moreinfo(trainElem, keep_old) { } $('.moreinfo .mfooter').append('Fahrtverlauf: <ul class="mroute">' + routebuf + '</ul>'); } - $.get(window.location.href, {train: trainElem.data('train'), ajax: 1}, function(data) { + $.get(window.location.href, {train: trainElem.data('train'), jid: trainElem.data('jid'), ajax: 1}, function(data) { $('.moreinfo').html(data); }).fail(function() { $('.moreinfo .mfooter').append('Der Zug ist abgefahren (Zug nicht gefunden)'); @@ -99,13 +99,20 @@ function dbf_reg_handlers() { if (window.location.href.includes('detailed=1')) { suffix += '&detailed=1'; } + if (window.location.href.includes('hafas=1')) { + suffix += '&hafas=1&highlight=' + trainElem.data('station'); + } if (window.location.href.includes('past=1')) { suffix += '&past=1'; } if (window.location.href.includes('rt=1') || window.location.href.includes('show_realtime=1')) { suffix += '&rt=1'; } - history.pushState({'page':'traindetail','station':station,'train':trainElem.data('no')}, 'test', '/z/' + trainElem.data('train') + '/' + trainElem.data('station') + suffix); + if (window.location.href.includes('hafas=1')) { + history.pushState({'page':'traindetail','jid':trainElem.data('jid')}, 'test', '/z/' + trainElem.data('jid') + suffix); + } else { + history.pushState({'page':'traindetail','station':station,'train':trainElem.data('no')}, 'test', '/z/' + trainElem.data('train') + '/' + trainElem.data('station') + suffix); + } dbf_show_moreinfo(trainElem, false); }); const trainid = $(location).attr('hash').substr(1); |