Increase the poll_interval_delay when there are no posts

This commit is contained in:
Michael Walker 2014-05-05 19:29:19 +01:00
parent 0e18636fe6
commit 91a3016d27

View File

@ -94,9 +94,15 @@ $(document).ready(function(){
clearTimeout(poll_interval); clearTimeout(poll_interval);
// 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_delay = end_of_page
? poll_interval_mindelay_bottom ? poll_interval_mindelay_bottom
: poll_interval_mindelay_top; : poll_interval_mindelay_top;
}
poll_interval = setTimeout(poll, poll_interval_delay); poll_interval = setTimeout(poll, poll_interval_delay);
}; };