From 24c98095293295bd3b46db7690ca699122327a1c Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 14 Jun 2011 20:02:03 -0700 Subject: [PATCH] don't break when noscript blocks captcha --- 4chan_x.user.js | 5 +++-- script.coffee | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index bad087399..c00dc813f 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2242,8 +2242,9 @@ el = _ref2[_i]; el.tabIndex = 1; } - recaptcha = $('#recaptcha_response_field'); - return $.bind(recaptcha, 'keydown', Recaptcha.listener); + if (recaptcha = $('#recaptcha_response_field')) { + return $.bind(recaptcha, 'keydown', Recaptcha.listener); + } }, listener: function(e) { if (e.keyCode === 8 && this.value === '') { diff --git a/script.coffee b/script.coffee index 1c50c5f45..7cecaefa3 100644 --- a/script.coffee +++ b/script.coffee @@ -1701,8 +1701,8 @@ Recaptcha = #hack to tab from comment straight to recaptcha for el in $$ '#recaptcha_table a' el.tabIndex = 1 - recaptcha = $ '#recaptcha_response_field' - $.bind recaptcha, 'keydown', Recaptcha.listener + if recaptcha = $ '#recaptcha_response_field' #NoScript + $.bind recaptcha, 'keydown', Recaptcha.listener listener: (e) -> if e.keyCode is 8 and @value is '' Recaptcha.reload()