Fix linebreaks in train names
This commit is contained in:
parent
8cd52728c8
commit
6789e044ed
@ -44,6 +44,11 @@ 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");
|
link.setAttribute("target", "_blank");
|
||||||
@ -73,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());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user