diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-03-17 13:20:01 +0100 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-03-17 13:20:01 +0100 |
commit | 72a6de370c3bbe1b9aad488b0d525eca108a9c79 (patch) | |
tree | d833387e41f8c5682c8d3ca7e5acbeed26a3a390 | |
parent | 342b90110040fd39dd3b3f7093bae949a6fe9085 (diff) |
collapse.js: pass hafas parameter as-is
-rw-r--r-- | public/static/js/collapse.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/public/static/js/collapse.js b/public/static/js/collapse.js index 4c078f0..2db1089 100644 --- a/public/static/js/collapse.js +++ b/public/static/js/collapse.js @@ -107,21 +107,22 @@ function dbf_reg_handlers() { $('div.app > ul > li').click(function(event) { const trainElem = $(this); const station = $('div.app').data('station'); + const param = new URLSearchParams(window.location.search); event.preventDefault(); var suffix = '?'; - if (window.location.href.includes('detailed=1')) { + if (param.get('detailed')) { suffix += '&detailed=1'; } - if (window.location.href.includes('hafas=1')) { - suffix += '&hafas=1&highlight=' + trainElem.data('station'); + if (param.get('hafas')) { + suffix += '&hafas=' + param.get('hafas') + '&highlight=' + trainElem.data('station'); } - if (window.location.href.includes('past=1')) { + if (param.get('past')) { suffix += '&past=1'; } - if (window.location.href.includes('rt=1') || window.location.href.includes('show_realtime=1')) { + if (param.get('rt') || param.get('show_realtime')) { suffix += '&rt=1'; } - if (window.location.href.includes('hafas=1')) { + if (param.get('hafas')) { 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); |