Implement replacement of captchas with v1 everywhere.
This commit is contained in:
parent
7ea5bf79a1
commit
244d40cd93
@ -456,11 +456,6 @@ Config =
|
|||||||
'Show notifications on successful post creation or file uploading.'
|
'Show notifications on successful post creation or file uploading.'
|
||||||
1
|
1
|
||||||
]
|
]
|
||||||
'Use Recaptcha v1': [
|
|
||||||
false
|
|
||||||
'Use the old text version of Recaptcha.'
|
|
||||||
1
|
|
||||||
]
|
|
||||||
'Force Noscript Captcha': [
|
'Force Noscript Captcha': [
|
||||||
false
|
false
|
||||||
'Use the non-Javascript fallback captcha in the QR even if Javascript is enabled.'
|
'Use the non-Javascript fallback captcha in the QR even if Javascript is enabled.'
|
||||||
@ -485,6 +480,10 @@ Config =
|
|||||||
true
|
true
|
||||||
'Make captcha easier to use, especially with the keyboard.'
|
'Make captcha easier to use, especially with the keyboard.'
|
||||||
]
|
]
|
||||||
|
'Use Recaptcha v1': [
|
||||||
|
false
|
||||||
|
'Use the old text version of Recaptcha.'
|
||||||
|
]
|
||||||
'Use Recaptcha v2 in Reports': [
|
'Use Recaptcha v2 in Reports': [
|
||||||
false
|
false
|
||||||
'Use the image selection captcha in the report window.'
|
'Use the image selection captcha in the report window.'
|
||||||
|
|||||||
@ -59,7 +59,7 @@ Main =
|
|||||||
$.onExists doc, 'body', false, Main.initStyle
|
$.onExists doc, 'body', false, Main.initStyle
|
||||||
|
|
||||||
initFeatures: ->
|
initFeatures: ->
|
||||||
if location.hostname in ['boards.4chan.org', 'sys.4chan.org']
|
if location.hostname in ['boards.4chan.org', 'sys.4chan.org', 'www.4chan.org']
|
||||||
$.globalEval 'document.documentElement.classList.add("js-enabled");'
|
$.globalEval 'document.documentElement.classList.add("js-enabled");'
|
||||||
|
|
||||||
switch location.hostname
|
switch location.hostname
|
||||||
|
|||||||
@ -3,7 +3,7 @@ Captcha.noscript =
|
|||||||
|
|
||||||
init: ->
|
init: ->
|
||||||
return if d.cookie.indexOf('pass_enabled=1') >= 0
|
return if d.cookie.indexOf('pass_enabled=1') >= 0
|
||||||
return unless @isEnabled = !!$.id 'g-recaptcha'
|
return unless @isEnabled = !!$ '#g-recaptcha, #captchaContainerAlt'
|
||||||
|
|
||||||
container = $.el 'div',
|
container = $.el 'div',
|
||||||
className: 'captcha-img'
|
className: 'captcha-img'
|
||||||
|
|||||||
@ -3,16 +3,33 @@ Captcha.replace =
|
|||||||
return unless d.cookie.indexOf('pass_enabled=1') < 0
|
return unless d.cookie.indexOf('pass_enabled=1') < 0
|
||||||
return if location.hostname is 'boards.4chan.org' and Conf['Hide Original Post Form']
|
return if location.hostname is 'boards.4chan.org' and Conf['Hide Original Post Form']
|
||||||
|
|
||||||
if location.hostname is 'sys.4chan.org' and Conf['Use Recaptcha v2 in Reports']
|
jsEnabled = $.hasClass doc, 'js-enabled'
|
||||||
|
|
||||||
|
if location.hostname is 'sys.4chan.org' and Conf['Use Recaptcha v2 in Reports'] and jsEnabled
|
||||||
$.ready Captcha.replace.v2
|
$.ready Captcha.replace.v2
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if Conf['Use Recaptcha v1'] and jsEnabled
|
||||||
|
$.ready Captcha.replace.v1
|
||||||
|
return
|
||||||
|
|
||||||
if Conf['captchaLanguage'].trim()
|
if Conf['captchaLanguage'].trim()
|
||||||
if location.hostname is 'boards.4chan.org'
|
if location.hostname is 'boards.4chan.org'
|
||||||
$.onExists doc, '#captchaFormPart', true, (node) -> $.onExists node, 'iframe', true, Captcha.replace.iframe
|
$.onExists doc, '#captchaFormPart', true, (node) -> $.onExists node, 'iframe', true, Captcha.replace.iframe
|
||||||
else
|
else
|
||||||
$.onExists doc, 'iframe', true, Captcha.replace.iframe
|
$.onExists doc, 'iframe', true, Captcha.replace.iframe
|
||||||
|
|
||||||
|
v1: ->
|
||||||
|
return unless old = $.id 'g-recaptcha'
|
||||||
|
container = $.el 'div',
|
||||||
|
id: 'captchaContainerAlt'
|
||||||
|
$.replace old, container
|
||||||
|
Captcha.v1.setupScript()
|
||||||
|
if link = $ '#togglePostFormLink > a, #form-link'
|
||||||
|
$.on link, 'click', -> $.event 'captcha:setup', null, container
|
||||||
|
else
|
||||||
|
$.event 'captcha:setup', null, container
|
||||||
|
|
||||||
v2: ->
|
v2: ->
|
||||||
return unless old = $.id 'captchaContainerAlt'
|
return unless old = $.id 'captchaContainerAlt'
|
||||||
container = $.el 'div',
|
container = $.el 'div',
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
Captcha.v1 =
|
Captcha.v1 =
|
||||||
init: ->
|
init: ->
|
||||||
return if d.cookie.indexOf('pass_enabled=1') >= 0
|
return if d.cookie.indexOf('pass_enabled=1') >= 0
|
||||||
return unless @isEnabled = !!$.id 'g-recaptcha'
|
return unless @isEnabled = !!$ '#g-recaptcha, #captchaContainerAlt'
|
||||||
|
|
||||||
@setupScript()
|
@setupScript()
|
||||||
captchaContainer = $.el 'div',
|
captchaContainer = $.el 'div',
|
||||||
|
|||||||
@ -3,7 +3,7 @@ Captcha.v2 =
|
|||||||
|
|
||||||
init: ->
|
init: ->
|
||||||
return if d.cookie.indexOf('pass_enabled=1') >= 0
|
return if d.cookie.indexOf('pass_enabled=1') >= 0
|
||||||
return unless @isEnabled = !!$.id 'g-recaptcha'
|
return unless @isEnabled = !!$ '#g-recaptcha, #captchaContainerAlt'
|
||||||
|
|
||||||
if @noscript = Conf['Force Noscript Captcha'] or not $.hasClass doc, 'js-enabled'
|
if @noscript = Conf['Force Noscript Captcha'] or not $.hasClass doc, 'js-enabled'
|
||||||
@conn = new Connection null, "#{location.protocol}//www.google.com",
|
@conn = new Connection null, "#{location.protocol}//www.google.com",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user