1
0

Mind multiple train names for one train

This commit is contained in:
clerie 2020-09-16 14:18:20 +02:00
parent 0c17dfc94f
commit d4d97d899d

View File

@ -40,11 +40,14 @@ var observer = new MutationObserver((mutations, observer) => {
var timetable = target.querySelector("td div.detailContainer table.result tbody"); var timetable = target.querySelector("td div.detailContainer table.result tbody");
var products = timetable.querySelectorAll("tr.first td.products"); var products = timetable.querySelectorAll("tr.first td.products");
products.forEach((product) => { products.forEach((product) => {
var train_name = bahnParseTrainName(product.querySelector("span a").innerText); var train_names = product.querySelectorAll("span a");
train_names.forEach((train) => {
var train_name = bahnParseTrainName(train.innerText);
if(typeof train_name !== 'undefined') { if(typeof train_name !== 'undefined') {
product.innerHTML = product.innerHTML + ' <a href="https://marudor.de/details/' + train_name + '" target="_blank"><img src="' + getMediaURL("marudor.svg") + '" style="height: 2em; vertical-align:middle;"></a>'; product.innerHTML = product.innerHTML + ' <a href="https://marudor.de/details/' + train_name + '" target="_blank"><img src="' + getMediaURL("marudor.svg") + '" style="height: 2em; vertical-align:middle;"></a>';
} }
}); });
});
var stations = timetable.querySelectorAll("tr td.station"); var stations = timetable.querySelectorAll("tr td.station");
stations.forEach((station) => { stations.forEach((station) => {
var station_name = station.innerText; var station_name = station.innerText;