From 72a6de370c3bbe1b9aad488b0d525eca108a9c79 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Sun, 17 Mar 2024 13:20:01 +0100 Subject: collapse.js: pass hafas parameter as-is --- public/static/js/collapse.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'public') 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); -- cgit v1.2.3