1
0

Compare commits

..

3 Commits

Author SHA1 Message Date
0d16660d97 Version 0.5 2020-09-16 15:05:31 +02:00
6789e044ed Fix linebreaks in train names 2020-09-16 15:05:04 +02:00
8cd52728c8 Button with target _blank again 2020-09-16 14:55:46 +02:00
2 changed files with 18 additions and 1 deletions

View File

@ -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());
}
} }
}); });
}); });

View File

@ -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/",