mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 07:46:07 -07:00
Auto redirect if available before countdown on state change
This commit is contained in:
parent
27183483a9
commit
d47daba8c1
2 changed files with 46 additions and 15 deletions
|
@ -35,19 +35,50 @@
|
|||
</div>
|
||||
</div>
|
||||
</%def>
|
||||
<%def name="javascriptIncludes()">
|
||||
<script>
|
||||
// Use p.countdown as container, pass redirect, duration, and optional message
|
||||
$(".countdown").countdown(reloadPage, ${timer}, "");
|
||||
$('#state-change-modal').modal({
|
||||
keyboard: false
|
||||
})
|
||||
// Make modal visible
|
||||
$('#state-change-modal').modal('show')
|
||||
|
||||
// Redirect to home page after countdown.
|
||||
function reloadPage() {
|
||||
window.location.href = "${new_http_root}index";
|
||||
}
|
||||
</script>
|
||||
<%def name="javascriptIncludes()">
|
||||
<script>
|
||||
// Use p.countdown as container, pass redirect, duration, and optional message
|
||||
$(".countdown").countdown(reloadPage, ${timer}, "");
|
||||
$('#state-change-modal').modal({
|
||||
keyboard: false
|
||||
})
|
||||
// Make modal visible
|
||||
$('#state-change-modal').modal('show')
|
||||
|
||||
// Redirect to home page after countdown.
|
||||
function reloadPage() {
|
||||
window.location.href = "${new_http_root}index";
|
||||
}
|
||||
|
||||
// Redirect to home page if page is available.
|
||||
var checkOnline = setInterval(checkPageOffline, 1000);
|
||||
|
||||
function checkPageOffline() {
|
||||
$.ajax({
|
||||
type: 'HEAD',
|
||||
url: 'index',
|
||||
timeout: 1000,
|
||||
error: function () {
|
||||
% if signal != 'shutdown':
|
||||
clearInterval(checkOnline);
|
||||
setInterval(checkPageOnline, 1000);
|
||||
% else:
|
||||
reloadPage();
|
||||
% endif
|
||||
}
|
||||
});
|
||||
}
|
||||
function checkPageOnline() {
|
||||
$.ajax({
|
||||
type: 'HEAD',
|
||||
url: 'index',
|
||||
timeout: 1000,
|
||||
success: function () {
|
||||
reloadPage();
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
</%def>
|
||||
|
|
|
@ -3324,7 +3324,7 @@ class WebInterface(object):
|
|||
else:
|
||||
new_http_root = '/'
|
||||
|
||||
return serve_template(templatename="shutdown.html", title=title,
|
||||
return serve_template(templatename="shutdown.html", signal=signal, title=title,
|
||||
new_http_root=new_http_root, message=message, timer=timer, quote=quote)
|
||||
|
||||
@cherrypy.expose
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue