Support selecting images in the image captcha with the space bar in addition to the enter key.

This commit is contained in:
ccd0 2015-06-05 15:09:19 -07:00
parent d7b84817b0
commit 905f6173c1

View File

@ -53,10 +53,14 @@ Captcha.fixes =
if x < 0
return unless $('.rc-controls').contains d.activeElement
x = if d.activeElement is verify then 11 else 9
return unless dx = {38: 9, 40: 3, 37: 11, 39: 1, 73: 9, 75: 3, 74: 11, 76: 1}[e.keyCode] # Up, Down, Left, Right, I, K, J, L
x = (x + dx) % 12
if x is 10
x = if dx is 11 then 9 else 11
(@images[x] or {9: reload, 11: verify}[x]).focus()
e.preventDefault()
e.stopPropagation()
if e.keyCode is 32 and x < 9 # space on image
@images[x].click()
e.preventDefault()
e.stopPropagation()
else if dx = {38: 9, 40: 3, 37: 11, 39: 1, 73: 9, 75: 3, 74: 11, 76: 1}[e.keyCode] # Up, Down, Left, Right, I, K, J, L
x = (x + dx) % 12
if x is 10
x = if dx is 11 then 9 else 11
(@images[x] or {9: reload, 11: verify}[x]).focus()
e.preventDefault()
e.stopPropagation()