diff --git a/frontend/main.ts b/frontend/main.ts index 42e84eb..d050c76 100644 --- a/frontend/main.ts +++ b/frontend/main.ts @@ -16,6 +16,7 @@ document.addEventListener('DOMContentLoaded', function() { initBoatActions(); selectBoatChange(); addRelationMagic(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 = (curSelection).length - rowers;