[TASK] add basic reload functionality

This commit is contained in:
Marie Birner 2023-09-27 13:58:22 +02:00 committed by philipp
parent 885fb0f2c1
commit da19cf75c6

View File

@ -16,6 +16,7 @@ document.addEventListener('DOMContentLoaded', function() {
initBoatActions(); initBoatActions();
selectBoatChange(); selectBoatChange();
addRelationMagic(<HTMLElement>document.querySelector('body')); addRelationMagic(<HTMLElement>document.querySelector('body'));
reloadPage();
}); });
function selectBoatChange() { 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){ function setMaxAmountRowers(rowers: number){
let curSelection = choiceObjects['newrower'].getValue(true); let curSelection = choiceObjects['newrower'].getValue(true);
let amount_to_delete = (<any>curSelection).length - rowers; let amount_to_delete = (<any>curSelection).length - rowers;