Compare commits
3 Commits
6c9bd60235
...
0d16660d97
Author | SHA1 | Date | |
---|---|---|---|
0d16660d97 | |||
6789e044ed | |||
8cd52728c8 |
@ -44,8 +44,14 @@ function domCreateImage(src) {
|
|||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function domCreateLinebreak() {
|
||||||
|
var linebreak = document.createElement("br");
|
||||||
|
return linebreak;
|
||||||
|
}
|
||||||
|
|
||||||
function domCreateButton(href, image_src) {
|
function domCreateButton(href, image_src) {
|
||||||
var link = domCreateLink(href);
|
var link = domCreateLink(href);
|
||||||
|
link.setAttribute("target", "_blank");
|
||||||
var image = domCreateImage(image_src);
|
var image = domCreateImage(image_src);
|
||||||
image.setAttribute("style", "height: 2em; vertical-align:middle;")
|
image.setAttribute("style", "height: 2em; vertical-align:middle;")
|
||||||
link.append(image);
|
link.append(image);
|
||||||
@ -72,6 +78,17 @@ var connection_result_observer = new MutationObserver((mutations) => {
|
|||||||
if(typeof train_name_text !== 'undefined') {
|
if(typeof train_name_text !== 'undefined') {
|
||||||
var marudor_button = domCreateButtonMarudor("/details/" + train_name_text);
|
var marudor_button = domCreateButtonMarudor("/details/" + train_name_text);
|
||||||
train_name.after(marudor_button);
|
train_name.after(marudor_button);
|
||||||
|
|
||||||
|
// Move linebreaks from link inner, after our button
|
||||||
|
linebreaks = train_name.querySelectorAll("br");
|
||||||
|
if(linebreaks.length != 0) {
|
||||||
|
linebreaks.forEach((linebreak) => {
|
||||||
|
train_name.removeChild(linebreak);
|
||||||
|
});
|
||||||
|
|
||||||
|
marudor_button.after(domCreateLinebreak());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "Bahn Insight",
|
"name": "Bahn Insight",
|
||||||
"version": "0.4",
|
"version": "0.5",
|
||||||
|
|
||||||
"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