Change product naming scheme to match marudor
This commit is contained in:
parent
a216984bb4
commit
7b3e750513
@ -201,25 +201,25 @@ var connection_result_observer = new MutationObserver((mutations) => {
|
|||||||
data[i]["products"][j] = {};
|
data[i]["products"][j] = {};
|
||||||
|
|
||||||
// Prodcut details
|
// Prodcut details
|
||||||
data[i]["products"][j]["product"] = null;
|
data[i]["products"][j]["type"] = null;
|
||||||
data[i]["products"][j]["train_id"] = null;
|
|
||||||
data[i]["products"][j]["train_number"] = null;
|
data[i]["products"][j]["train_number"] = null;
|
||||||
|
data[i]["products"][j]["train_name"] = null;
|
||||||
data[i]["products"][j]["line_name"] = null;
|
data[i]["products"][j]["line_name"] = null;
|
||||||
|
|
||||||
var name_list = train.innerText.trim().replace(/ +/g, ' ').split(" ");
|
var name_list = train.innerText.trim().replace(/ +/g, ' ').split(" ");
|
||||||
|
|
||||||
// Product name in format "STB 12 (23561)"
|
// 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) == ')') {
|
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]["type"] = 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[2].substring(1, name_list[2].length-1)
|
||||||
data[i]["products"][j]["line_name"] = name_list[0] + " " + name_list[1];
|
data[i]["products"][j]["line_name"] = name_list[0] + " " + name_list[1];
|
||||||
}
|
}
|
||||||
// Product name in format "ICE 234"
|
// Product name in format "ICE 234"
|
||||||
else {
|
else {
|
||||||
data[i]["products"][j]["product"] = name_list[0];
|
data[i]["products"][j]["type"] = name_list[0];
|
||||||
data[i]["products"][j]["train_id"] = name_list[1];
|
data[i]["products"][j]["train_number"] = name_list[1];
|
||||||
}
|
}
|
||||||
data[i]["products"][j]["train_number"] = data[i]["products"][j]["product"] + " " + data[i]["products"][j]["train_id"];
|
data[i]["products"][j]["train_name"] = data[i]["products"][j]["type"] + " " + data[i]["products"][j]["train_number"];
|
||||||
});
|
});
|
||||||
|
|
||||||
// Travel information
|
// Travel information
|
||||||
@ -250,10 +250,10 @@ var connection_result_observer = new MutationObserver((mutations) => {
|
|||||||
var departure_time = new Date(Date.parse(connection_result_date + " " + data[i]["from"]["time"]));
|
var departure_time = new Date(Date.parse(connection_result_date + " " + data[i]["from"]["time"]));
|
||||||
|
|
||||||
// Button linking to marudor.de
|
// 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_name"] + "/" + departure_time.getTime());
|
||||||
bahn_insight_field.appendChild(marudor_button);
|
bahn_insight_field.appendChild(marudor_button);
|
||||||
|
|
||||||
var dbf_button = domCreateButtonDbf("/_wr/" + data[i]["products"][j]["train_id"] + "/" + datetimeToYYYYMMDDHHMM(departure_time));
|
var dbf_button = domCreateButtonDbf("/_wr/" + data[i]["products"][j]["train_number"] + "/" + datetimeToYYYYMMDDHHMM(departure_time));
|
||||||
bahn_insight_field.appendChild(dbf_button);
|
bahn_insight_field.appendChild(dbf_button);
|
||||||
|
|
||||||
// Move linebreaks from link inner, after our 'bahn-insight' field
|
// Move linebreaks from link inner, after our 'bahn-insight' field
|
||||||
|
Loading…
Reference in New Issue
Block a user