Compare commits
No commits in common. "0ec0d9164eaedc7deeba74895e6978fd417ed31a" and "7df84bca5c8d402c0d66414e98898786892e887b" have entirely different histories.
0ec0d9164e
...
7df84bca5c
@ -151,10 +151,6 @@ var connection_result_observer = new MutationObserver((mutations) => {
|
|||||||
var relations = timetable.querySelectorAll("tr.first");
|
var relations = timetable.querySelectorAll("tr.first");
|
||||||
relations.forEach((relation, i) => {
|
relations.forEach((relation, i) => {
|
||||||
var relationend = relation.nextElementSibling;
|
var relationend = relation.nextElementSibling;
|
||||||
while(relationend.querySelector("td.station") == null) {
|
|
||||||
relationend = relationend.nextElementSibling;
|
|
||||||
}
|
|
||||||
|
|
||||||
data[i] = {};
|
data[i] = {};
|
||||||
data[i]["from"] = {}
|
data[i]["from"] = {}
|
||||||
data[i]["to"] = {}
|
data[i]["to"] = {}
|
||||||
@ -205,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]["type"] = null;
|
data[i]["products"][j]["product"] = 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]["type"] = name_list[0];
|
data[i]["products"][j]["product"] = name_list[0];
|
||||||
data[i]["products"][j]["train_number"] = name_list[2].substring(1, name_list[2].length-1)
|
data[i]["products"][j]["train_id"] = 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]["type"] = name_list[0];
|
data[i]["products"][j]["product"] = name_list[0];
|
||||||
data[i]["products"][j]["train_number"] = name_list[1];
|
data[i]["products"][j]["train_id"] = name_list[1];
|
||||||
}
|
}
|
||||||
data[i]["products"][j]["train_name"] = data[i]["products"][j]["type"] + " " + data[i]["products"][j]["train_number"];
|
data[i]["products"][j]["train_number"] = data[i]["products"][j]["product"] + " " + data[i]["products"][j]["train_id"];
|
||||||
});
|
});
|
||||||
|
|
||||||
// Travel information
|
// Travel information
|
||||||
@ -244,9 +240,6 @@ var connection_result_observer = new MutationObserver((mutations) => {
|
|||||||
var relations = timetable.querySelectorAll("tr.first");
|
var relations = timetable.querySelectorAll("tr.first");
|
||||||
relations.forEach((relation, i) => {
|
relations.forEach((relation, i) => {
|
||||||
var relationend = relation.nextElementSibling;
|
var relationend = relation.nextElementSibling;
|
||||||
while(relationend.querySelector("td.station") == null) {
|
|
||||||
relationend = relationend.nextElementSibling;
|
|
||||||
}
|
|
||||||
|
|
||||||
var products = relation.querySelectorAll("td.products span a");
|
var products = relation.querySelectorAll("td.products span a");
|
||||||
products.forEach((product, j) => {
|
products.forEach((product, j) => {
|
||||||
@ -257,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_name"] + "/" + departure_time.getTime());
|
var marudor_button = domCreateButtonMarudor("/details/" + data[i]["products"][j]["train_number"] + "/" + 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_number"] + "/" + datetimeToYYYYMMDDHHMM(departure_time));
|
var dbf_button = domCreateButtonDbf("/_wr/" + data[i]["products"][j]["train_id"] + "/" + 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
|
||||||
@ -273,7 +266,6 @@ var connection_result_observer = new MutationObserver((mutations) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Linking to station
|
|
||||||
var from = relation.querySelector("td.station");
|
var from = relation.querySelector("td.station");
|
||||||
var bahn_insight_field = domCreateBahnInsightField();
|
var bahn_insight_field = domCreateBahnInsightField();
|
||||||
from.appendChild(bahn_insight_field);
|
from.appendChild(bahn_insight_field);
|
||||||
@ -284,7 +276,6 @@ var connection_result_observer = new MutationObserver((mutations) => {
|
|||||||
var dbf_button = domCreateButtonDbf("/" + data[i]["from"]["station"]);
|
var dbf_button = domCreateButtonDbf("/" + data[i]["from"]["station"]);
|
||||||
bahn_insight_field.appendChild(dbf_button);
|
bahn_insight_field.appendChild(dbf_button);
|
||||||
|
|
||||||
// Linking to station
|
|
||||||
var to = relationend.querySelector("td.station");
|
var to = relationend.querySelector("td.station");
|
||||||
var bahn_insight_field = domCreateBahnInsightField();
|
var bahn_insight_field = domCreateBahnInsightField();
|
||||||
to.appendChild(bahn_insight_field);
|
to.appendChild(bahn_insight_field);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "Bahn Insight",
|
"name": "Bahn Insight",
|
||||||
"version": "0.7",
|
"version": "0.6",
|
||||||
|
|
||||||
"description": "Extends the booking portal of bahn.de with linking to useful information.",
|
"description": "Extends the booking portal of bahn.de with linking to useful information.",
|
||||||
"homepage_url": "https://git.clerie.de/clerie/bahn-insight/",
|
"homepage_url": "https://git.clerie.de/clerie/bahn-insight/",
|
||||||
|
Loading…
Reference in New Issue
Block a user