Implement 'Use Recaptcha v2 in Reports' option.
This commit is contained in:
parent
4178aad3ec
commit
8cd3218616
@ -396,7 +396,7 @@ Config =
|
|||||||
'Label each post from a new IP with the thread\'s current IP count.'
|
'Label each post from a new IP with the thread\'s current IP count.'
|
||||||
]
|
]
|
||||||
|
|
||||||
'Posting':
|
'Posting and Captchas':
|
||||||
'Quick Reply': [
|
'Quick Reply': [
|
||||||
true
|
true
|
||||||
'All-in-one form to reply, create threads, automate dumping and more.'
|
'All-in-one form to reply, create threads, automate dumping and more.'
|
||||||
@ -485,6 +485,10 @@ Config =
|
|||||||
true
|
true
|
||||||
'Make captcha easier to use, especially with the keyboard.'
|
'Make captcha easier to use, especially with the keyboard.'
|
||||||
]
|
]
|
||||||
|
'Use Recaptcha v2 in Reports': [
|
||||||
|
false
|
||||||
|
'Use the image selection captcha in the report window.'
|
||||||
|
]
|
||||||
|
|
||||||
'Quote Links':
|
'Quote Links':
|
||||||
'Quote Backlinks': [
|
'Quote Backlinks': [
|
||||||
|
|||||||
@ -10,7 +10,9 @@ Report =
|
|||||||
ready: ->
|
ready: ->
|
||||||
$.addStyle Report.css
|
$.addStyle Report.css
|
||||||
Report.archive() if Conf['Archive Report']
|
Report.archive() if Conf['Archive Report']
|
||||||
if $.hasClass doc, 'js-enabled'
|
if Conf['Use Recaptcha v2 in Reports']
|
||||||
|
Report.captchaV2()
|
||||||
|
if Conf['Use Recaptcha v2 in Reports'] and $.hasClass doc, 'js-enabled'
|
||||||
new MutationObserver(-> Report.fit '.gc-bubbleDefault').observe d.body,
|
new MutationObserver(-> Report.fit '.gc-bubbleDefault').observe d.body,
|
||||||
childList: true
|
childList: true
|
||||||
attributes: true
|
attributes: true
|
||||||
@ -18,6 +20,19 @@ Report =
|
|||||||
else
|
else
|
||||||
Report.fit 'body'
|
Report.fit 'body'
|
||||||
|
|
||||||
|
captchaV2: ->
|
||||||
|
return unless old = $.id 'captchaContainerAlt'
|
||||||
|
container = $.el 'div',
|
||||||
|
className: 'g-recaptcha'
|
||||||
|
container.dataset.sitekey = '<%= meta.recaptchaKey %>'
|
||||||
|
$.replace old, container
|
||||||
|
url = 'https://www.google.com/recaptcha/api.js'
|
||||||
|
if lang = Conf['captchaLanguage'].trim()
|
||||||
|
url += "?hl=#{encodeURIComponent lang}"
|
||||||
|
script = $.el 'script',
|
||||||
|
src: url
|
||||||
|
$.add d.head, script
|
||||||
|
|
||||||
fit: (selector) ->
|
fit: (selector) ->
|
||||||
return unless el = $ selector, doc
|
return unless el = $ selector, doc
|
||||||
dy = el.getBoundingClientRect().bottom - doc.clientHeight + 8
|
dy = el.getBoundingClientRect().bottom - doc.clientHeight + 8
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user