Refactor code and renaming vars
This commit is contained in:
parent
83feb9af10
commit
d3d1aeecd8
@ -38,16 +38,18 @@ var connection_result_observer = new MutationObserver((mutations) => {
|
||||
var target = mutation.target;
|
||||
if (target.tagName === 'TD') {
|
||||
var timetable = target.querySelector("td div.detailContainer table.result tbody");
|
||||
var products = timetable.querySelectorAll("tr.first td.products");
|
||||
products.forEach((product) => {
|
||||
var train_names = product.querySelectorAll("span a");
|
||||
train_names.forEach((train) => {
|
||||
var train_name = bahnParseTrainName(train.innerText);
|
||||
|
||||
var trains = timetable.querySelectorAll("tr.first td.products");
|
||||
trains.forEach((train) => {
|
||||
var train_names = train.querySelectorAll("span a");
|
||||
train_names.forEach((train_name) => {
|
||||
train_name = bahnParseTrainName(train_name.innerText);
|
||||
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>';
|
||||
train.innerHTML = train.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");
|
||||
stations.forEach((station) => {
|
||||
var station_name = station.innerText;
|
||||
|
Loading…
Reference in New Issue
Block a user