From f1eca3da2e37d2da9c3300816aaf8883a7b0dc5a Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 2 Feb 2012 20:11:36 +0100 Subject: [PATCH] Fix #165. Fix selector. --- 4chan_x.user.js | 15 +++++++++++---- script.coffee | 13 +++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 61537f442..e72cde4b2 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -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; }); diff --git a/script.coffee b/script.coffee index 7a713487b..562cf7f5c 100644 --- a/script.coffee +++ b/script.coffee @@ -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