mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
refactor, tab async loading on focus
This commit is contained in:
@@ -23,8 +23,6 @@
|
||||
|
||||
|
||||
<script>
|
||||
initializeCalendar();
|
||||
loadPresenceData();
|
||||
|
||||
// Force re-render calendar on tab change
|
||||
// (bugfix for render error at left panel)
|
||||
@@ -234,6 +232,37 @@ function initializeCalendar() {
|
||||
})
|
||||
}
|
||||
|
||||
// -----------------------------------------------
|
||||
// INIT with polling for panel element visibility
|
||||
// -----------------------------------------------
|
||||
|
||||
var presencePageInitialized = false;
|
||||
|
||||
function initDevicePresencePage() {
|
||||
// Only proceed if the Presence tab is visible
|
||||
if (!$('#panPresence:visible').length) {
|
||||
return; // Exit early if nothing is visible
|
||||
}
|
||||
|
||||
// Ensure initialization only happens once
|
||||
if (presencePageInitialized) return;
|
||||
presencePageInitialized = true;
|
||||
|
||||
showSpinner();
|
||||
|
||||
initializeCalendar();
|
||||
loadPresenceData();
|
||||
}
|
||||
|
||||
// Recurring check to initialize when visible
|
||||
function devicePresencePageUpdater() {
|
||||
initDevicePresencePage();
|
||||
|
||||
setTimeout(devicePresencePageUpdater, 200);
|
||||
}
|
||||
|
||||
devicePresencePageUpdater();
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user