diff --git a/CHANGES.md b/CHANGES.md index 13b4d7e3..0bbaec9f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -42,6 +42,7 @@ * Update tablesorter 2.17.7 to 2.28.5 * Update jQuery 1.8.3 to 2.2.4 * Add one time run to start up that deletes troublemaking compiled files +* Fix reload of homepage after restart in some browsers [develop changelog] diff --git a/gui/slick/js/restart.js b/gui/slick/js/restart.js index 32f10bbc..a04b1fd3 100644 --- a/gui/slick/js/restart.js +++ b/gui/slick/js/restart.js @@ -15,35 +15,37 @@ $.SickGear.numRestartWaits = 0; function is_alive() { timeoutId = 0; - $.ajax({url: isAliveUrl, - type: 'GET', - dataType: 'jsonp', - success: function(data) { - var resp = data.msg.toString(); - if ('nope' == resp) { - // if initialising then just wait and try again + //noinspection JSUnusedLocalSymbols + $.ajax({ + 'url': isAliveUrl, + 'type': 'GET', + 'dataType': 'jsonp', + 'success': function(data) { + var resp = data.msg.toString(); + if ('nope' == resp) { + // if initialising then just wait and try again - $('#shut_down_message').find('.spinner,.hide-yes').removeClass(); - $('#restart_message').removeClass(); + $('#shut_down_message').find('.spinner,.hide-yes').removeClass(); + $('#restart_message').removeClass(); + setTimeout(is_alive, 100); + + } else if (/undefined/i.test($.SickGear.PID) || $.SickGear.PID == resp) { + // if this is before we've even shut down then just try again later + + setTimeout(is_alive, 100); + + } else { + // if we're ready to go then redirect to new url + + $('#restart_message').find('.spinner,.hide-yes').removeClass(); + $('#refresh_message').removeClass(); + window.location = baseUrl + '/home/'; + } + }, + 'error': function(XMLHttpRequest, textStatus, errorThrown) { setTimeout(is_alive, 100); - - } else if (/undefined/i.test($.SickGear.PID) || $.SickGear.PID == resp) { - // if this is before we've even shut down then just try again later - - setTimeout(is_alive, 100); - - } else { - // if we're ready to go then redirect to new url - - $('#restart_message').find('.spinner,.hide-yes').removeClass(); - $('#refresh_message').removeClass(); - window.location = baseUrl + '/home/'; } - }, - error: function(XMLHttpRequest, textStatus, errorThrown) { - setTimeout(is_alive, 100); - } }); } @@ -56,11 +58,14 @@ $(document).ready(function() { $.SickGear.numRestartWaits += 1; $('#shut_down_message').find('.spinner,.hide-yes').removeClass(); - $('#restart_message').removeClass(); + + var restart$ = $('#restart_message'); + restart$.removeClass(); + isAliveUrl = baseUrl + '/home/is_alive/'; - // if https is enabled or you are currently on https and the port or protocol changed just wait 5 seconds then redirect. - // This is because the ajax will fail if the cert is untrusted or the the http ajax request from https will fail because of mixed content error. + // If using https and the port or protocol changed, then wait 5 seconds before redirect because ajax calls will + // fail with untrusted certs or when a http ajax request is made from https with a mixed content error. if ($.SickGear.UseHttps || 'https:' == window.location.protocol) { if (browserUrl != baseUrl) { @@ -78,7 +83,7 @@ $(document).ready(function() { // if it is taking forever just give up if (90 < $.SickGear.numRestartWaits) { - $('#restart_message').find('.spinner,.yes,.hide-no').removeClass(); + restart$.find('.spinner,.yes,.hide-no').removeClass(); $('#restart_fail_message').removeClass(); return; }