Add Mistyped Captcha Errors option

This commit is contained in:
Jordan Bates 2013-05-15 03:38:31 -07:00
parent 68678e671a
commit 61813b28d7
6 changed files with 75 additions and 13 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -293,6 +293,10 @@ Config =
true
'Show notifications on successful post creation or file uploading.'
]
'Mistyped Captcha Errors': [
true
'When disabled, shows a red border on the CAPTCHA input until a key is pressed instead of a notification.'
]
'Quote Links':
'Quote Backlinks': [

View File

@ -738,6 +738,9 @@ input.field.tripped:not(:hover):not(:focus) {
width: 100%;
margin: 1px 0 0;
}
.captcha-input.error:focus {
border-color: rgb(255,0,0) !important;
}
.field {
-moz-box-sizing: border-box;
margin: 0px;

View File

@ -93,6 +93,8 @@ QR =
QR.cleanNotifications()
d.activeElement.blur()
$.rmClass QR.nodes.el, 'dump'
unless Conf['Mistyped Captcha Errors']
$.rmClass QR.captcha.nodes.input, 'error'
if Conf['QR Shortcut']
$.toggleClass $('.qr-shortcut'), 'disabled'
for i in QR.posts
@ -126,8 +128,19 @@ QR =
if QR.captcha.isEnabled and /captcha|verification/i.test el.textContent
# Focus the captcha input on captcha error.
QR.captcha.nodes.input.focus()
if Conf['Mistyped Captcha Errors']
QR.notifications.push new Notification 'warning', el
else
$.addClass QR.captcha.nodes.input, 'error'
$.on QR.captcha.nodes.input, 'keydown', ->
$.rmClass QR.captcha.nodes.input, 'error'
else
QR.notifications.push new Notification 'warning', el
alert el.textContent if d.hidden
QR.notifications.push new Notification 'warning', el
clearError: ->
notifications: []
cleanNotifications: ->
for notification in QR.notifications