Train link to dbf
This commit is contained in:
parent
c0f50dfe3e
commit
60ae28c9d3
@ -32,6 +32,15 @@ function bahnParseTrainName(dirty_train_name) {
|
||||
return dirty_train_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns date string in format YYYYMMDDHHMM
|
||||
*
|
||||
* @param datetime Date object
|
||||
*/
|
||||
function datetimeToYYYYMMDDHHMM(datetime) {
|
||||
return datetime.getFullYear().toString().padStart(4, '0') + "" + (datetime.getMonth()+1).toString().padStart(2, '0') + "" + datetime.getDate().toString().padStart(2, '0') + "" + datetime.getHours().toString().padStart(2, '0') + "" + datetime.getMinutes().toString().padStart(2, '0')
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns HTML a as DOM object
|
||||
*
|
||||
@ -244,6 +253,9 @@ var connection_result_observer = new MutationObserver((mutations) => {
|
||||
var marudor_button = domCreateButtonMarudor("/details/" + data[i]["products"][j]["train_number"] + "/" + departure_time.getTime());
|
||||
bahn_insight_field.appendChild(marudor_button);
|
||||
|
||||
var dbf_button = domCreateButtonDbf("/_wr/" + data[i]["products"][j]["train_id"] + "/" + datetimeToYYYYMMDDHHMM(departure_time));
|
||||
bahn_insight_field.appendChild(dbf_button);
|
||||
|
||||
// Move linebreaks from link inner, after our 'bahn-insight' field
|
||||
var linebreaks = product.querySelectorAll("br");
|
||||
if(linebreaks.length != 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user