[TASK] add basic reload functionality

This commit is contained in:
Marie Birner 2023-09-27 13:58:22 +02:00
parent 74c0db4e75
commit b6a91f1017

View File

@ -16,6 +16,7 @@ document.addEventListener('DOMContentLoaded', function() {
initBoatActions();
selectBoatChange();
addRelationMagic(<HTMLElement>document.querySelector('body'));
reloadPage();
});
function selectBoatChange() {
@ -67,6 +68,22 @@ function selectBoatChange() {
}
}
function reloadPage() {
let pageTitle = document.title;
let attentionMessage = 'Riemen- und Dollenbruch';
document.addEventListener('visibilitychange', function() {
let isPageActive = !document.hidden;
if(!isPageActive){
document.title = attentionMessage;
}else {
document.title = pageTitle;
location.reload();
}
});
}
function setMaxAmountRowers(rowers: number){
let curSelection = choiceObjects['newrower'].getValue(true);
let amount_to_delete = (<any>curSelection).length - rowers;