summaryrefslogtreecommitdiff
path: root/js/auto-reload.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/auto-reload.js')
-rw-r--r--js/auto-reload.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/js/auto-reload.js b/js/auto-reload.js
index 8a35335e..081314d8 100644
--- a/js/auto-reload.js
+++ b/js/auto-reload.js
@@ -17,6 +17,7 @@
*
*/
+
auto_reload_enabled = true; // for watch.js to interop
$(document).ready(function(){
@@ -35,6 +36,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;
@@ -182,6 +184,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);
+ }
}
});