1
0

Fix linebreaks in train names

This commit is contained in:
clerie 2020-09-16 15:05:04 +02:00
parent 8cd52728c8
commit 6789e044ed

View File

@ -44,6 +44,11 @@ function domCreateImage(src) {
return image;
}
function domCreateLinebreak() {
var linebreak = document.createElement("br");
return linebreak;
}
function domCreateButton(href, image_src) {
var link = domCreateLink(href);
link.setAttribute("target", "_blank");
@ -73,6 +78,17 @@ var connection_result_observer = new MutationObserver((mutations) => {
if(typeof train_name_text !== 'undefined') {
var marudor_button = domCreateButtonMarudor("/details/" + train_name_text);
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());
}
}
});
});