Focus on checkbox when captcha is tabbed into. #250, #333

This commit is contained in:
ccd0 2015-02-21 11:17:29 -08:00
parent d22bca1a33
commit 83309cc28c
3 changed files with 9 additions and 1 deletions

View File

@ -19,6 +19,7 @@
"*://sys.4chan.org/*",
"*://a.4cdn.org/*",
"*://i.4cdn.org/*",
"https://www.google.com/recaptcha/api2/anchor?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc*",
"*://www.google.com/recaptcha/api/fallback?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc"
],
"suffix": {

View File

@ -1,7 +1,8 @@
Main =
init: ->
if location.hostname is 'www.google.com'
return $.ready -> Captcha.noscript.initFrame()
type = if location.pathname is '/recaptcha/api/fallback' then 'noscript' else 'v2'
return $.ready -> Captcha[type].initFrame()
g.threads = new SimpleDict()
g.posts = new SimpleDict()

View File

@ -25,6 +25,12 @@ Captcha.v2 =
# XXX Greasemonkey 1.x workaround to gain access to GM_* functions.
$.queueTask => @save false
initFrame: ->
$.on window, 'focus', ->
$.queueTask ->
return unless checkbox = $.id 'recaptcha-anchor'
checkbox.focus() unless d.activeElement is checkbox
shouldFocus: false
timeouts: {}
postsCount: 0