summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorMichael Walker <mike@barrucadu.co.uk>2014-05-05 19:29:19 +0100
committerMichael Walker <mike@barrucadu.co.uk>2014-05-05 19:33:57 +0100
commit91a3016d27ab3644d677333d0130366f3b0d68a6 (patch)
tree79ed4aac7595bb881bfce67f8d1af27332c3ffa0 /js
parent0e18636fe6302f134312c4dcc82d6768626d4d32 (diff)
Increase the poll_interval_delay when there are no posts
Diffstat (limited to 'js')
-rw-r--r--js/auto-reload.js12
1 files 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);
};