Only allow the updater's interval value to be greater than 0.

Set it to 1 otherwise.
This commit is contained in:
Nicolas Stepien 2012-06-08 21:10:37 +02:00
parent 4ea03ae491
commit d1cfa987ae
2 changed files with 12 additions and 7 deletions

View File

@ -2447,10 +2447,7 @@
Conf[input.name] = input.checked;
}
} else if (input.name === 'Interval') {
$.on(input, 'input', function() {
this.value = parseInt(this.value, 10) || Conf['Interval'];
return $.cb.value.call(this);
});
$.on(input, 'input', this.cb.interval);
} else if (input.type === 'button') {
$.on(input, 'click', this.update);
}
@ -2460,6 +2457,12 @@
return this.lastModified = 0;
},
cb: {
interval: function() {
var val;
val = parseInt(this.value, 10);
this.value = val > 0 ? val : 1;
return $.cb.value.call(this);
},
verbose: function() {
if (Conf['Verbose']) {
Updater.count.textContent = '+0';

View File

@ -1907,9 +1907,7 @@ Updater =
# Required for the QR's update after posting.
Conf[input.name] = input.checked
else if input.name is 'Interval'
$.on input, 'input', ->
@value = parseInt(@value, 10) or Conf['Interval']
$.cb.value.call @
$.on input, 'input', @cb.interval
else if input.type is 'button'
$.on input, 'click', @update
@ -1919,6 +1917,10 @@ Updater =
@lastModified = 0
cb:
interval: ->
val = parseInt @value, 10
@value = if val > 0 then val else 1
$.cb.value.call @
verbose: ->
if Conf['Verbose']
Updater.count.textContent = '+0'