1
0

Compare commits

..

No commits in common. "60ae28c9d3ba0947a91904bdafdf6e6776f0a975" and "68301c44d452e92c94e01bbec8f058262641c2d8" have entirely different histories.

View File

@ -32,15 +32,6 @@ function bahnParseTrainName(dirty_train_name) {
return dirty_train_name;
}
/**
* Returns date string in format YYYYMMDDHHMM
*
* @param datetime Date object
*/
function datetimeToYYYYMMDDHHMM(datetime) {
return datetime.getFullYear().toString().padStart(4, '0') + "" + (datetime.getMonth()+1).toString().padStart(2, '0') + "" + datetime.getDate().toString().padStart(2, '0') + "" + datetime.getHours().toString().padStart(2, '0') + "" + datetime.getMinutes().toString().padStart(2, '0')
}
/**
* Returns HTML a as DOM object
*
@ -202,7 +193,6 @@ var connection_result_observer = new MutationObserver((mutations) => {
// Prodcut details
data[i]["products"][j]["product"] = null;
data[i]["products"][j]["train_id"] = null;
data[i]["products"][j]["train_number"] = null;
data[i]["products"][j]["line_name"] = null;
@ -211,15 +201,14 @@ var connection_result_observer = new MutationObserver((mutations) => {
// Product name in format "STB 12 (23561)"
if(name_list.length == 3 && name_list[2].charAt(0) == '(' && name_list[2].charAt(name_list[2].length-1) == ')') {
data[i]["products"][j]["product"] = name_list[0];
data[i]["products"][j]["train_id"] = name_list[2].substring(1, name_list[2].length-1)
data[i]["products"][j]["train_number"] = name_list[0] + " " + name_list[2].substring(1, name_list[2].length-1);
data[i]["products"][j]["line_name"] = name_list[0] + " " + name_list[1];
}
// Product name in format "ICE 234"
else {
data[i]["products"][j]["product"] = name_list[0];
data[i]["products"][j]["train_id"] = name_list[1];
data[i]["products"][j]["train_number"] = name_list[0] + " " + name_list[1];
}
data[i]["products"][j]["train_number"] = data[i]["products"][j]["product"] + " " + data[i]["products"][j]["train_id"];
});
// Travel information
@ -247,15 +236,10 @@ var connection_result_observer = new MutationObserver((mutations) => {
var bahn_insight_field = domCreateBahnInsightField();
product.after(bahn_insight_field);
var departure_time = new Date(Date.parse(connection_result_date + " " + data[i]["from"]["time"]));
// Button linking to marudor.de
var marudor_button = domCreateButtonMarudor("/details/" + data[i]["products"][j]["train_number"] + "/" + departure_time.getTime());
var marudor_button = domCreateButtonMarudor("/details/" + data[i]["products"][j]["train_number"]);
bahn_insight_field.appendChild(marudor_button);
var dbf_button = domCreateButtonDbf("/_wr/" + data[i]["products"][j]["train_id"] + "/" + datetimeToYYYYMMDDHHMM(departure_time));
bahn_insight_field.appendChild(dbf_button);
// Move linebreaks from link inner, after our 'bahn-insight' field
var linebreaks = product.querySelectorAll("br");
if(linebreaks.length != 0) {
@ -298,9 +282,6 @@ var connection_result_observer = new MutationObserver((mutations) => {
var target = document.getElementById('resultsOverview');
if(typeof target !== 'undefined') {
var connection_result_date = document.querySelector("html body div div div.resultContentHolder form div h2 span").innerText.replace(/(\d{2})\.(\d{2})\.(\d{2})/,'20$3-$2-$1');
connection_result_observer.observe(target, {
subtree: true,
childList: true