From 91a3016d27ab3644d677333d0130366f3b0d68a6 Mon Sep 17 00:00:00 2001 From: Michael Walker Date: Mon, 5 May 2014 19:29:19 +0100 Subject: [PATCH] Increase the poll_interval_delay when there are no posts --- js/auto-reload.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/js/auto-reload.js b/js/auto-reload.js index 40fa58a6..2cbdd7e8 100644 --- a/js/auto-reload.js +++ b/js/auto-reload.js @@ -94,9 +94,15 @@ $(document).ready(function(){ clearTimeout(poll_interval); - poll_interval_delay = end_of_page - ? poll_interval_mindelay_bottom - : poll_interval_mindelay_top; + // If there are no new posts, double the delay. Otherwise set it to the min. + if(new_posts == 0) { + poll_interval_delay *= 2; + } else { + poll_interval_delay = end_of_page + ? poll_interval_mindelay_bottom + : poll_interval_mindelay_top; + } + poll_interval = setTimeout(poll, poll_interval_delay); };