Fix #165. Fix selector.

This commit is contained in:
Nicolas Stepien 2012-02-02 20:11:36 +01:00
parent a0b8006250
commit f1eca3da2e
2 changed files with 20 additions and 8 deletions

View File

@ -1539,9 +1539,16 @@
return this.input.value = null; return this.input.value = null;
}, },
count: function(count) { count: function(count) {
var s; this.input.placeholder = (function() {
s = count === 1 ? '' : 's'; switch (count) {
this.input.placeholder = "Verification (" + count + " cached captcha" + s + ")"; case 0:
return 'Verification (Shift + Enter to cache)';
case 1:
return 'Vertification (1 cached captcha)';
default:
return "Verification (" + count + " cached captchas)";
}
})();
return this.input.alt = count; return this.input.alt = count;
}, },
reload: function(focus) { reload: function(focus) {
@ -1630,7 +1637,7 @@
_ref2 = ['name', 'email', 'sub', 'com']; _ref2 = ['name', 'email', 'sub', 'com'];
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
name = _ref2[_j]; name = _ref2[_j];
input = $("[name=" + input + "]", qr.el); input = $("[name=" + name + "]", qr.el);
$.on(input, 'keyup', function() { $.on(input, 'keyup', function() {
return qr.selected[this.name] = this.value; return qr.selected[this.name] = this.value;
}); });

View File

@ -1130,9 +1130,14 @@ qr =
@img.src = "http://www.google.com/recaptcha/api/image?c=#{challenge}" @img.src = "http://www.google.com/recaptcha/api/image?c=#{challenge}"
@input.value = null @input.value = null
count: (count) -> count: (count) ->
s = if count is 1 then '' else 's' @input.placeholder = switch count
@input.placeholder = "Verification (#{count} cached captcha#{s})" when 0
@input.alt = count # For XTRM RICE. 'Verification (Shift + Enter to cache)'
when 1
'Vertification (1 cached captcha)'
else
"Verification (#{count} cached captchas)"
@input.alt = count # For XTRM RICE.
reload: (focus) -> reload: (focus) ->
window.location = 'javascript:Recaptcha.reload()' window.location = 'javascript:Recaptcha.reload()'
# Focus if we meant to. # Focus if we meant to.
@ -1202,7 +1207,7 @@ qr =
new qr.reply().select() new qr.reply().select()
# save selected reply's data # save selected reply's data
for name in ['name', 'email', 'sub', 'com'] for name in ['name', 'email', 'sub', 'com']
input = $ "[name=#{input}]", qr.el input = $ "[name=#{name}]", qr.el
$.on input, 'keyup', -> qr.selected[@name] = @value $.on input, 'keyup', -> qr.selected[@name] = @value
$.on input, 'change', -> qr.selected[@name] = @value $.on input, 'change', -> qr.selected[@name] = @value
# sync between tabs # sync between tabs