From 69cf03df4d2c90f8e44c7aee7e24df39ae3693d1 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Tue, 23 Dec 2014 00:52:23 -0800 Subject: [PATCH] Remove unused queryChallenge code. --- src/Posting/Captcha.noscript.coffee | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/Posting/Captcha.noscript.coffee b/src/Posting/Captcha.noscript.coffee index 2421b8d7f..c0dd47516 100644 --- a/src/Posting/Captcha.noscript.coffee +++ b/src/Posting/Captcha.noscript.coffee @@ -39,27 +39,24 @@ Captcha.noscript = @setup() initFrame: -> - 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()} - sendChallenge = -> - if img.complete - cb() - else - $.on img, 'load', cb conn = new Connection window.top, "#{location.protocol}//boards.4chan.org", - queryChallenge: sendChallenge response: (response) -> $.id('response').value = response $('.fbc-challenge > form').submit() conn.send token: $('.fbc-verification-token > textarea')?.value error: $('.fbc-error')?.textContent - sendChallenge() if img + 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 timers: {}