function log(msg) { console.log("[Bahn Insight] " + msg); } function getMediaURL(path) { path = "media/" + path; return chrome.runtime.getURL(path) || browser.runtime.getURL(path); } var observer = new MutationObserver((mutations, observer) => { mutations.forEach((mutation) => { if (mutation.type === 'childList') { 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_name = product.querySelector("span a").innerText; product.innerHTML = product.innerHTML + ' '; }); var stations = timetable.querySelectorAll("tr td.station"); stations.forEach((station) => { var station_name = station.innerText; station.innerHTML = station.innerHTML + ' '; }); } } }); }); var target = document.getElementById('resultsOverview'); if(typeof target !== 'undefined') { observer.observe(target, { subtree: true, childList: true }); }