Make updater interval increase optional

This commit is contained in:
Zixaphir 2013-03-15 16:18:40 -07:00
parent fbdc001519
commit 7e3324480a
3 changed files with 14 additions and 5 deletions

View File

@ -183,7 +183,8 @@
'Auto Scroll': [false, 'Scroll updated posts into view. Only enabled at bottom of page.'],
'Bottom Scroll': [false, 'Always scroll to the bottom, not the first new post. Useful for event threads.'],
'Scroll BG': [false, 'Auto-scroll background tabs.'],
'Auto Update': [true, 'Automatically fetch new posts.']
'Auto Update': [true, 'Automatically fetch new posts.'],
'Optional Increase': [false, 'Increase the intervals between updates on threads without new posts.']
},
'Interval': 30
}
@ -5648,7 +5649,7 @@
},
interval: function() {
var val;
val = Math.max(5, parseInt(this.value, 10));
val = parseInt(this.value, 10);
ThreadUpdater.interval = this.value = val;
return $.cb.value.call(this);
},
@ -5695,7 +5696,7 @@
if (!d.hidden) {
j = Math.min(j, 7);
}
return ThreadUpdater.seconds = Math.max(i, [0, 5, 10, 15, 20, 30, 60, 90, 120, 240, 300][j]);
return ThreadUpdater.seconds = Conf['Optional Increase'] ? Math.max(i, [0, 5, 10, 15, 20, 30, 60, 90, 120, 240, 300][j]) : i;
},
set: function(name, text, klass) {
var el, node;

View File

@ -465,4 +465,8 @@ http://www.google.com/searchbyimage?image_url=%turl
true
'Automatically fetch new posts.'
]
'Optional Increase': [
false
'Increase the intervals between updates on threads without new posts.'
]
'Interval': 30

View File

@ -3815,7 +3815,7 @@ ThreadUpdater =
else
clearTimeout ThreadUpdater.timeoutID
interval: ->
val = Math.max 5, parseInt @value, 10
val = parseInt @value, 10
ThreadUpdater.interval = @value = val
$.cb.value.call @
load: ->
@ -3857,7 +3857,11 @@ ThreadUpdater =
unless d.hidden
# Lower the max refresh rate limit on visible tabs.
j = Math.min j, 7
ThreadUpdater.seconds = Math.max i, [0, 5, 10, 15, 20, 30, 60, 90, 120, 240, 300][j]
ThreadUpdater.seconds =
if Conf['Optional Increase']
Math.max i, [0, 5, 10, 15, 20, 30, 60, 90, 120, 240, 300][j]
else
i
set: (name, text, klass) ->
el = ThreadUpdater[name]