mirror of
https://github.com/unraid/webgui.git
synced 2026-01-06 01:29:54 -06:00
Refactor: Only reload Main/Dash on visibility if Live Updates disabled
This commit is contained in:
@@ -411,25 +411,19 @@ $('body').on('click','a,.ca_href', function(e) {
|
||||
var nchanPaused = false;
|
||||
var blurTimer = false;
|
||||
|
||||
<? if ( $display['liveUpdate'] == "no" ):?>
|
||||
$(window).focus(function() {
|
||||
nchanFocusStart();
|
||||
});
|
||||
|
||||
// Stop nchan on loss of focus
|
||||
<? if ( $display['liveUpdate'] == "no" ):?>
|
||||
$(window).blur(function() {
|
||||
blurTimer = setTimeout(function(){
|
||||
nchanFocusStop();
|
||||
},30000);
|
||||
});
|
||||
<?endif;?>
|
||||
|
||||
document.addEventListener("visibilitychange", (event) => {
|
||||
<? if ( $display['liveUpdate'] == "no" ):?>
|
||||
if (document.hidden) {
|
||||
nchanFocusStop();
|
||||
}
|
||||
<?else:?>
|
||||
if (document.hidden) {
|
||||
nchanFocusStop();
|
||||
} else {
|
||||
@@ -445,7 +439,6 @@ document.addEventListener("visibilitychange", (event) => {
|
||||
nchanFocusStart();
|
||||
<?endif;?>
|
||||
}
|
||||
<?endif;?>
|
||||
});
|
||||
|
||||
function nchanFocusStart() {
|
||||
@@ -486,4 +479,5 @@ function nchanFocusStop(banner=true) {
|
||||
}
|
||||
}
|
||||
}
|
||||
<?endif;?>
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user