Remove remaining obsolete noscript captcha code.

This commit is contained in:
ccd0 2015-06-20 22:16:17 -07:00
parent 43ae6354f3
commit 26e38c17b1
4 changed files with 7 additions and 22 deletions

View File

@ -2,7 +2,7 @@ Main =
init: ->
if location.hostname is 'www.google.com'
if location.pathname is '/recaptcha/api/fallback'
$.ready -> Captcha.noscript.initFrame()
$.ready -> Captcha.v2.initFrame()
$.get 'Captcha Fixes', true, ({'Captcha Fixes': enabled}) ->
if enabled
$.ready -> Captcha.fixes.init()

View File

@ -1,5 +1,5 @@
class Connection
constructor: (@target, @origin, @cb) ->
constructor: (@target, @origin, @cb={}) ->
$.on window, 'message', @onMessage
send: (data) =>

View File

@ -1,20 +0,0 @@
Captcha.noscript =
initFrame: ->
conn = new Connection window.parent, "#{location.protocol}//boards.4chan.org",
response: (response) ->
$.id('response').value = response
$('.fbc-challenge > form').submit()
conn.send
token: $('.fbc-verification-token > textarea')?.value
error: $('.fbc-error')?.textContent
return unless img = $ '.fbc-payload > img'
cb = ->
canvas = $.el 'canvas'
canvas.width = img.width
canvas.height = img.height
canvas.getContext('2d').drawImage(img, 0, 0)
conn.send {challenge: canvas.toDataURL()}
if img.complete
cb()
else
$.on img, 'load', cb

View File

@ -29,6 +29,11 @@ Captcha.v2 =
# XXX Greasemonkey 1.x workaround to gain access to GM_* functions.
$.queueTask => @save false
initFrame: ->
if token = $('.fbc-verification-token > textarea')?.value
conn = new Connection window.parent, "#{location.protocol}//boards.4chan.org"
conn.send {token}
shouldFocus: false
timeouts: {}
postsCount: 0