Compare commits
No commits in common. "a4c68ec8014654927edcbd22ff4c8b6b9c675a01" and "b426fb304e51848ea44d37d0907889ac44ccaa3c" have entirely different histories.
a4c68ec801
...
b426fb304e
@ -11,6 +11,7 @@ TBD
|
|||||||
2. Entpacken
|
2. Entpacken
|
||||||
3. In Firefox nach `about:debugging` navigieren
|
3. In Firefox nach `about:debugging` navigieren
|
||||||
4. Add-on temporär laden
|
4. Add-on temporär laden
|
||||||
|
5. YouTube aufrufen
|
||||||
|
|
||||||
Die Installation besteht nur während der aktuellen Session.
|
Die Installation besteht nur während der aktuellen Session.
|
||||||
|
|
||||||
|
@ -6,15 +6,12 @@ function getMediaURL(path) {
|
|||||||
path = "media/" + path;
|
path = "media/" + path;
|
||||||
return chrome.runtime.getURL(path) || browser.runtime.getURL(path);
|
return chrome.runtime.getURL(path) || browser.runtime.getURL(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return train name in format "PRODUCT TRAIN_NUMER"
|
* Return train name in format "PRODUCT TRAIN_NUMER"
|
||||||
* i.e. "ICE 112", "RE 12734"
|
* i.e. "ICE 112", "RE 12734"
|
||||||
* Sometimes train name is in format "PRODUCT LINE_NUMER (TRAIN_NUMER)"
|
* Sometimes train name is in format "PRODUCT LINE_NUMER (TRAIN_NUMER)"
|
||||||
* i.e. "STB 12 (62371)"
|
* i.e. "STB 12 (62371)"
|
||||||
* Sometimes 'trains' are not trains or we can't find an unique id for them
|
* this will be cleaned up
|
||||||
* i.e. busses, ferrys, trams
|
|
||||||
* they will also be cleaned up and returned as undefined, because we can't link to them correctly
|
|
||||||
*/
|
*/
|
||||||
function bahnParseTrainName(dirty_train_name) {
|
function bahnParseTrainName(dirty_train_name) {
|
||||||
var name_list = dirty_train_name.split(" ");
|
var name_list = dirty_train_name.split(" ");
|
||||||
@ -24,11 +21,6 @@ function bahnParseTrainName(dirty_train_name) {
|
|||||||
return name_list[0] + " " + name_list[2].substring(1, name_list[2].length-1);
|
return name_list[0] + " " + name_list[2].substring(1, name_list[2].length-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exclude linking to specific products
|
|
||||||
if(["bus", "fäh", "str"].indexOf(name_list[0].toLowerCase()) !== -1) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
return dirty_train_name;
|
return dirty_train_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,9 +33,7 @@ var observer = new MutationObserver((mutations, observer) => {
|
|||||||
var products = timetable.querySelectorAll("tr.first td.products");
|
var products = timetable.querySelectorAll("tr.first td.products");
|
||||||
products.forEach((product) => {
|
products.forEach((product) => {
|
||||||
var train_name = bahnParseTrainName(product.querySelector("span a").innerText);
|
var train_name = bahnParseTrainName(product.querySelector("span a").innerText);
|
||||||
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>';
|
||||||
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>';
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
var stations = timetable.querySelectorAll("tr td.station");
|
var stations = timetable.querySelectorAll("tr td.station");
|
||||||
stations.forEach((station) => {
|
stations.forEach((station) => {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "Bahn Insight",
|
"name": "Bahn Insight",
|
||||||
"version": "0.3",
|
"version": "0.2",
|
||||||
|
|
||||||
"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