Disable auto-posting if you're writing during the last 5 seconds of the cooldown. Close #205.

This commit is contained in:
Nicolas Stepien 2012-03-06 15:29:37 +01:00
parent 1cec99ba8f
commit c696916e60
2 changed files with 10 additions and 2 deletions

View File

@ -1843,7 +1843,10 @@
for (_k = 0, _len3 = _ref3.length; _k < _len3; _k++) {
event = _ref3[_k];
$.on(input, event, function() {
return qr.selected[this.name] = this.value;
qr.selected[this.name] = this.value;
if (qr.cooldown.auto && qr.selected === qr.replies[0] && parseInt(qr.status.input.value.match(/\d+/)) < 6) {
return qr.cooldown.auto = false;
}
});
}
}

View File

@ -1491,7 +1491,12 @@ qr =
for name in ['name', 'email', 'sub', 'com']
input = $ "[name=#{name}]", qr.el
for event in ['textInput', 'keyup', 'change', 'paste']
$.on input, event, -> qr.selected[@name] = @value
$.on input, event, ->
qr.selected[@name] = @value
# Disable auto-posting if you're typing in the first reply
# during the last 5 seconds of the cooldown.
if qr.cooldown.auto and qr.selected is qr.replies[0] and parseInt(qr.status.input.value.match /\d+/) < 6
qr.cooldown.auto = false
# sync between tabs
$.sync 'qr.persona', (persona) ->
return unless qr.el.hidden