mirror of
https://github.com/unraid/webgui.git
synced 2026-02-18 06:58:47 -06:00
refactor: move reload page during extended viewing in abstracted HeadInlineJS
This commit is contained in:
@@ -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"?>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user