From c5ef9edf3169b9e2f1e082e9ca16e48a07e80070 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 25 Aug 2012 16:07:15 +0200 Subject: [PATCH] Close #704. Thanks @SlashG. --- 4chan_x.user.js | 7 ++++++- changelog | 2 ++ script.coffee | 7 ++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 3b9f3295e..e4b02eda5 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2404,6 +2404,11 @@ QR.captcha.count(captchas.length); if (!response) { err = 'No valid captcha.'; + } else { + response = response.trim(); + if (!/\s/.test(response)) { + response = "" + response + " " + response; + } } } if (err) { @@ -2435,7 +2440,7 @@ mode: 'regist', pwd: (m = d.cookie.match(/4chan_pass=([^;]+)/)) ? decodeURIComponent(m[1]) : $('input[name=pwd]').value, recaptcha_challenge_field: challenge, - recaptcha_response_field: response.replace(/^\s+/, 'a ').replace(/\s+$/, ' a') + recaptcha_response_field: response }; callbacks = { onload: function() { diff --git a/changelog b/changelog index 43ad1d398..f3ded16ca 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + One-word-captcha: you don't need to input an extra space anymore, the true word will be duplicated. 2.34.7 - Mayhem diff --git a/script.coffee b/script.coffee index 32d38b95f..b392e3e5e 100644 --- a/script.coffee +++ b/script.coffee @@ -1863,6 +1863,11 @@ QR = QR.captcha.count captchas.length unless response err = 'No valid captcha.' + else + response = response.trim() + # one-word-captcha: + # If there's only one word, duplicate it. + response = "#{response} #{response}" unless /\s/.test response if err # stop auto-posting @@ -1896,7 +1901,7 @@ QR = mode: 'regist' pwd: if m = d.cookie.match(/4chan_pass=([^;]+)/) then decodeURIComponent m[1] else $('input[name=pwd]').value recaptcha_challenge_field: challenge - recaptcha_response_field: response.replace(/^\s+/, 'a ').replace /\s+$/, ' a' + recaptcha_response_field: response callbacks = onload: ->