Refactor: Only reload Main/Dash on visibility if Live Updates disabled

This commit is contained in:
Squidly271
2025-04-30 22:07:27 -04:00
committed by GitHub
parent e0e86710c9
commit d27786548a

View File

@@ -1292,25 +1292,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 {
@@ -1326,7 +1320,6 @@ document.addEventListener("visibilitychange", (event) => {
nchanFocusStart();
<?endif;?>
}
<?endif;?>
});
function nchanFocusStart() {
@@ -1367,6 +1360,7 @@ function nchanFocusStop(banner=true) {
}
}
}
<?endif;?>
</script>
</body>
</html>