refactor: move reload page during extended viewing in abstracted HeadInlineJS

This commit is contained in:
Zack Spear
2025-05-05 13:06:44 -07:00
parent 2edd2b4e51
commit f5bbc6c067
2 changed files with 19 additions and 23 deletions

View File

@@ -129,29 +129,6 @@ foreach ($buttonPages as $button) {
// create page content
eval('?>'.parse_text($button['text']));
}
// Reload page every X minutes during extended viewing?
if (isset($myPage['Load']) && $myPage['Load'] > 0) {
?>
<script>
function setTimerReload() {
timers.reload = setInterval(function(){
if (nchanPaused === false && ! dialogOpen() ) {
location.reload();
}
},<?=$myPage['Load'] * 60000?>);
}
$(document).click(function(e) {
clearInterval(timers.reload);
setTimerReload();
});
function dialogOpen() {
return ($('.sweet-alert').is(':visible') || $('.swal-overlay--show-modal').is(':visible') );
}
setTimerReload();
</script>
<?php
}
?>
<?include "$docroot/plugins/dynamix.my.servers/include/myservers1.php"?>

View File

@@ -585,4 +585,23 @@ $.ajaxPrefilter(function(s, orig, xhr){
s.data += "csrf_token="+csrf_token;
}
});
<?if (isset($myPage['Load']) && $myPage['Load'] > 0):?>
// Reload page every X minutes during extended viewing?
function setTimerReload() {
timers.reload = setInterval(function(){
if (nchanPaused === false && ! dialogOpen() ) {
location.reload();
}
},<?=$myPage['Load'] * 60000?>);
}
$(document).click(function(e) {
clearInterval(timers.reload);
setTimerReload();
});
function dialogOpen() {
return ($('.sweet-alert').is(':visible') || $('.swal-overlay--show-modal').is(':visible') );
}
setTimerReload();
<?endif;?>
</script>