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;
|
var target = mutation.target;
|
||||||
if (target.tagName === 'TD') {
|
if (target.tagName === 'TD') {
|
||||||
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");
|
|
||||||
products.forEach((product) => {
|
var trains = timetable.querySelectorAll("tr.first td.products");
|
||||||
var train_names = product.querySelectorAll("span a");
|
trains.forEach((train) => {
|
||||||
train_names.forEach((train) => {
|
var train_names = train.querySelectorAll("span a");
|
||||||
var train_name = bahnParseTrainName(train.innerText);
|
train_names.forEach((train_name) => {
|
||||||
|
train_name = bahnParseTrainName(train_name.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>';
|
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");
|
var stations = timetable.querySelectorAll("tr td.station");
|
||||||
stations.forEach((station) => {
|
stations.forEach((station) => {
|
||||||
var station_name = station.innerText;
|
var station_name = station.innerText;
|
||||||
|
Loading…
Reference in New Issue
Block a user