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

View File

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