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;
},
count: function(count) {
var s;
s = count === 1 ? '' : 's';
this.input.placeholder = "Verification (" + count + " cached captcha" + s + ")";
this.input.placeholder = (function() {
switch (count) {
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;
},
reload: function(focus) {
@ -1630,7 +1637,7 @@
_ref2 = ['name', 'email', 'sub', 'com'];
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
name = _ref2[_j];
input = $("[name=" + input + "]", qr.el);
input = $("[name=" + name + "]", qr.el);
$.on(input, 'keyup', function() {
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}"
@input.value = null
count: (count) ->
s = if count is 1 then '' else 's'
@input.placeholder = "Verification (#{count} cached captcha#{s})"
@input.alt = count # For XTRM RICE.
@input.placeholder = switch count
when 0
'Verification (Shift + Enter to cache)'
when 1
'Vertification (1 cached captcha)'
else
"Verification (#{count} cached captchas)"
@input.alt = count # For XTRM RICE.
reload: (focus) ->
window.location = 'javascript:Recaptcha.reload()'
# Focus if we meant to.
@ -1202,7 +1207,7 @@ qr =
new qr.reply().select()
# save selected reply's data
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, 'change', -> qr.selected[@name] = @value
# sync between tabs