diff --git a/js/auto-reload.js b/js/auto-reload.js index 8543b703..1137829a 100644 --- a/js/auto-reload.js +++ b/js/auto-reload.js @@ -43,6 +43,7 @@ $(document).ready(function(){ var settings = new script_settings('auto-reload'); var poll_interval_mindelay = settings.get('min_delay_bottom', 5000); var poll_interval_maxdelay = settings.get('max_delay', 600000); + var poll_interval_errordelay = settings.get('error_delay', 30000); // number of ms to wait before reloading var poll_interval_delay = poll_interval_mindelay; @@ -191,6 +192,28 @@ $(document).ready(function(){ else $('#update_secs').text("No new posts found"); } + }, + error: function(xhr, status_text, error_text) { + if (status_text == "error") { + if (error_text == "Not Found") { + $('#update_secs').text("Thread deleted or pruned"); + $('#auto_update_status').prop('checked', false); + $('#auto_update_status').prop('disabled', true); // disable updates if thread is deleted + return; + } else { + $('#update_secs').text("Error: "+error_text); + } + } else if (status_text) { + $('#update_secs').text("Error: "+status_text); + } else { + $('#update_secs').text("Unknown error"); + } + + // Keep trying to update + if ($('#auto_update_status').is(':checked')) { + poll_interval_delay = poll_interval_errordelay; + auto_update(poll_interval_delay); + } } }); diff --git a/js/settings.js b/js/settings.js index fcc8f508..81e88f7a 100644 --- a/js/settings.js +++ b/js/settings.js @@ -58,6 +58,8 @@ tb_settings['auto-reload'] = { min_delay_bottom: 5000, // Maximum delay before reloading the page max_delay: 600000, + // Delay if there was an error + error_delay: 30000, // Reset the delay to the minimum upon focussing the window. reset_focus: true }; diff --git a/templates/themes/catalog/catalog.html b/templates/themes/catalog/catalog.html index 4a7e6f3b..3a858e1c 100644 --- a/templates/themes/catalog/catalog.html +++ b/templates/themes/catalog/catalog.html @@ -48,7 +48,7 @@