1
0

Comment functions

This commit is contained in:
clerie 2020-09-19 20:17:36 +02:00
parent 4efc000794
commit 60c24d8a5e

View File

@ -32,23 +32,42 @@ function bahnParseTrainName(dirty_train_name) {
return dirty_train_name;
}
/**
* Returns HTML a as DOM object
*
* @param href URI as string
*/
function domCreateLink(href) {
var link = document.createElement("a");
link.setAttribute("href", href);
return link;
}
/**
* Returns HTML img as DOM object
*
* @param src Image URI as string
*/
function domCreateImage(src) {
var image = document.createElement("img");
image.setAttribute("src", src);
return image;
}
/**
* Returns HTML br as DOM object
*/
function domCreateLinebreak() {
var linebreak = document.createElement("br");
return linebreak;
}
/**
* Returns an 'image button' like construct as DOM object
*
* @param href URI as string
* @param image_src Image URI as string
*/
function domCreateButton(href, image_src) {
var link = domCreateLink(href);
link.setAttribute("target", "_blank");
@ -58,6 +77,11 @@ function domCreateButton(href, image_src) {
return link;
}
/**
* Returns an 'image buttom' to specifically link to marudor.de
*
* @param path URL path part after https://marudor.de
*/
function domCreateButtonMarudor(path) {
var button = domCreateButton("https://marudor.de" + path, getMediaURL("marudor.svg"));
return button;