mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-02-04 09:14:30 +00:00
Reload spots/alerts on visibility change. Closes #89
This commit is contained in:
@@ -63,7 +63,7 @@
|
|||||||
<p>This software is dedicated to the memory of Tom G1PJB, SK, a friend and colleague who sadly passed away around the time I started writing it in Autumn 2025. I was looking forward to showing it to you when it was done.</p>
|
<p>This software is dedicated to the memory of Tom G1PJB, SK, a friend and colleague who sadly passed away around the time I started writing it in Autumn 2025. I was looking forward to showing it to you when it was done.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/js/common.js?v=2"></script>
|
<script src="/js/common.js?v=3"></script>
|
||||||
<script>$(document).ready(function() { $("#nav-link-about").addClass("active"); }); <!-- highlight active page in nav --></script>
|
<script>$(document).ready(function() { $("#nav-link-about").addClass("active"); }); <!-- highlight active page in nav --></script>
|
||||||
|
|
||||||
{% end %}
|
{% end %}
|
||||||
@@ -69,8 +69,8 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/js/common.js?v=2"></script>
|
<script src="/js/common.js?v=3"></script>
|
||||||
<script src="/js/add-spot.js?v=2"></script>
|
<script src="/js/add-spot.js?v=3"></script>
|
||||||
<script>$(document).ready(function() { $("#nav-link-add-spot").addClass("active"); }); <!-- highlight active page in nav --></script>
|
<script>$(document).ready(function() { $("#nav-link-add-spot").addClass("active"); }); <!-- highlight active page in nav --></script>
|
||||||
|
|
||||||
{% end %}
|
{% end %}
|
||||||
@@ -168,8 +168,8 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/js/common.js?v=2"></script>
|
<script src="/js/common.js?v=3"></script>
|
||||||
<script src="/js/alerts.js?v=2"></script>
|
<script src="/js/alerts.js?v=3"></script>
|
||||||
<script>$(document).ready(function() { $("#nav-link-alerts").addClass("active"); }); <!-- highlight active page in nav --></script>
|
<script>$(document).ready(function() { $("#nav-link-alerts").addClass("active"); }); <!-- highlight active page in nav --></script>
|
||||||
|
|
||||||
{% end %}
|
{% end %}
|
||||||
@@ -129,9 +129,9 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/js/common.js?v=2"></script>
|
<script src="/js/common.js?v=3"></script>
|
||||||
<script src="/js/spotsbandsandmap.js?v=2"></script>
|
<script src="/js/spotsbandsandmap.js?v=3"></script>
|
||||||
<script src="/js/bands.js?v=2"></script>
|
<script src="/js/bands.js?v=3"></script>
|
||||||
<script>$(document).ready(function() { $("#nav-link-bands").addClass("active"); }); <!-- highlight active page in nav --></script>
|
<script>$(document).ready(function() { $("#nav-link-bands").addClass("active"); }); <!-- highlight active page in nav --></script>
|
||||||
|
|
||||||
{% end %}
|
{% end %}
|
||||||
@@ -147,9 +147,9 @@
|
|||||||
<script src="https://cdn.jsdelivr.net/npm/leaflet.geodesic"></script>
|
<script src="https://cdn.jsdelivr.net/npm/leaflet.geodesic"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/@joergdietrich/leaflet.terminator@1.1.0/L.Terminator.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/@joergdietrich/leaflet.terminator@1.1.0/L.Terminator.min.js"></script>
|
||||||
|
|
||||||
<script src="/js/common.js?v=2"></script>
|
<script src="/js/common.js?v=3"></script>
|
||||||
<script src="/js/spotsbandsandmap.js?v=2"></script>
|
<script src="/js/spotsbandsandmap.js?v=3"></script>
|
||||||
<script src="/js/map.js?v=2"></script>
|
<script src="/js/map.js?v=3"></script>
|
||||||
<script>$(document).ready(function() { $("#nav-link-map").addClass("active"); }); <!-- highlight active page in nav --></script>
|
<script>$(document).ready(function() { $("#nav-link-map").addClass("active"); }); <!-- highlight active page in nav --></script>
|
||||||
|
|
||||||
{% end %}
|
{% end %}
|
||||||
@@ -218,9 +218,9 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/js/common.js?v=2"></script>
|
<script src="/js/common.js?v=3"></script>
|
||||||
<script src="/js/spotsbandsandmap.js?v=2"></script>
|
<script src="/js/spotsbandsandmap.js?v=3"></script>
|
||||||
<script src="/js/spots.js?v=2"></script>
|
<script src="/js/spots.js?v=3"></script>
|
||||||
<script>$(document).ready(function() { $("#nav-link-spots").addClass("active"); }); <!-- highlight active page in nav --></script>
|
<script>$(document).ready(function() { $("#nav-link-spots").addClass("active"); }); <!-- highlight active page in nav --></script>
|
||||||
|
|
||||||
{% end %}
|
{% end %}
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
<div id="status-container" class="row row-cols-1 row-cols-md-4 g-4 mt-4"></div>
|
<div id="status-container" class="row row-cols-1 row-cols-md-4 g-4 mt-4"></div>
|
||||||
|
|
||||||
<script src="/js/common.js?v=2"></script>
|
<script src="/js/common.js?v=3"></script>
|
||||||
<script src="/js/status.js?v=2"></script>
|
<script src="/js/status.js?v=3"></script>
|
||||||
<script>$(document).ready(function() { $("#nav-link-status").addClass("active"); }); <!-- highlight active page in nav --></script>
|
<script>$(document).ready(function() { $("#nav-link-status").addClass("active"); }); <!-- highlight active page in nav --></script>
|
||||||
|
|
||||||
{% end %}
|
{% end %}
|
||||||
@@ -352,3 +352,11 @@ $(document).ready(function() {
|
|||||||
// Update the refresh timing display every second
|
// Update the refresh timing display every second
|
||||||
setInterval(updateRefreshDisplay, 1000);
|
setInterval(updateRefreshDisplay, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Reload alerts on becoming visible. This forces a refresh when used as a PWA and the user switches back to the PWA
|
||||||
|
// after some time has passed with it in the background.
|
||||||
|
addEventListener("visibilitychange", (event) => {
|
||||||
|
if (!document.hidden) {
|
||||||
|
loadAlerts();
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -50,3 +50,11 @@ function toggleDarkMode() {
|
|||||||
enableDarkMode($("#darkMode")[0].checked);
|
enableDarkMode($("#darkMode")[0].checked);
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reload spots on becoming visible. This forces a refresh when used as a PWA and the user switches back to the PWA
|
||||||
|
// after some time has passed with it in the background.
|
||||||
|
addEventListener("visibilitychange", (event) => {
|
||||||
|
if (!document.hidden) {
|
||||||
|
loadSpots();
|
||||||
|
}
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user