Update for report form captcha change. #727
This commit is contained in:
parent
3a93db1879
commit
dded519aa1
@ -487,11 +487,11 @@ Config =
|
|||||||
]
|
]
|
||||||
'Use Recaptcha v1': [
|
'Use Recaptcha v1': [
|
||||||
false
|
false
|
||||||
'Use the old text version of Recaptcha where possible.'
|
'Use the old text version of Recaptcha in the post form.'
|
||||||
]
|
]
|
||||||
'Use Recaptcha v2 in Reports': [
|
'Use Recaptcha v1 in Reports': [
|
||||||
false
|
false
|
||||||
'Use the image selection captcha in the report window.'
|
'Use the text captcha in the report window.'
|
||||||
]
|
]
|
||||||
'Force Noscript Captcha': [
|
'Force Noscript Captcha': [
|
||||||
false
|
false
|
||||||
|
|||||||
@ -345,6 +345,9 @@ Settings =
|
|||||||
if data['sauces']?
|
if data['sauces']?
|
||||||
set 'sauces', data['sauces'].replace(/^(#?\s*https:\/\/www\.google\.com\/searchbyimage\?image_url=%(?:IMG|URL))%3Fs\.jpg/mg, '$1')
|
set 'sauces', data['sauces'].replace(/^(#?\s*https:\/\/www\.google\.com\/searchbyimage\?image_url=%(?:IMG|URL))%3Fs\.jpg/mg, '$1')
|
||||||
set 'sauces', data['sauces'].replace(/^#?\s*https:\/\/www\.google\.com\/searchbyimage\?image_url=%(?:IMG|T?URL)(?=$|;)/mg, '$&&safe=off')
|
set 'sauces', data['sauces'].replace(/^#?\s*https:\/\/www\.google\.com\/searchbyimage\?image_url=%(?:IMG|T?URL)(?=$|;)/mg, '$&&safe=off')
|
||||||
|
if compareString < '00001.00011.00022.00002'
|
||||||
|
if not data['Use Recaptcha v1 in Reports']? and data['Use Recaptcha v1'] and not data['Use Recaptcha v2 in Reports']
|
||||||
|
set 'Use Recaptcha v1 in Reports', true
|
||||||
changes
|
changes
|
||||||
loadSettings: (data, cb) ->
|
loadSettings: (data, cb) ->
|
||||||
if data.version.split('.')[0] is '2' # https://github.com/loadletter/4chan-x
|
if data.version.split('.')[0] is '2' # https://github.com/loadletter/4chan-x
|
||||||
|
|||||||
@ -14,17 +14,17 @@ ReportLink =
|
|||||||
unless post.isDead or (post.thread.isDead and not post.thread.isArchived)
|
unless post.isDead or (post.thread.isDead and not post.thread.isArchived)
|
||||||
a.textContent = 'Report'
|
a.textContent = 'Report'
|
||||||
ReportLink.url = "//sys.4chan.org/#{post.board}/imgboard.php?mode=report&no=#{post}"
|
ReportLink.url = "//sys.4chan.org/#{post.board}/imgboard.php?mode=report&no=#{post}"
|
||||||
ReportLink.height = 180
|
ReportLink.dims = 'width=400,height=550'
|
||||||
else if Conf['Archive Report']
|
else if Conf['Archive Report']
|
||||||
a.textContent = 'Report to archive'
|
a.textContent = 'Report to archive'
|
||||||
ReportLink.url = Redirect.to 'report', {boardID: post.board.ID, postID: post.ID}
|
ReportLink.url = Redirect.to 'report', {boardID: post.board.ID, postID: post.ID}
|
||||||
ReportLink.height = 350
|
ReportLink.dims = 'width=700,height=475'
|
||||||
else
|
else
|
||||||
ReportLink.url = ''
|
ReportLink.url = ''
|
||||||
!!ReportLink.url
|
!!ReportLink.url
|
||||||
|
|
||||||
report: ->
|
report: ->
|
||||||
{url, height} = ReportLink
|
{url, dims} = ReportLink
|
||||||
id = Date.now()
|
id = Date.now()
|
||||||
set = "toolbar=0,scrollbars=1,location=0,status=1,menubar=0,resizable=1,width=700,height=#{height}"
|
set = "toolbar=0,scrollbars=1,location=0,status=1,menubar=0,resizable=1,#{dims}"
|
||||||
window.open url, id, set
|
window.open url, id, set
|
||||||
|
|||||||
@ -62,7 +62,7 @@ Report =
|
|||||||
if (message = $ 'h3') and /Report submitted!/.test(message.textContent)
|
if (message = $ 'h3') and /Report submitted!/.test(message.textContent)
|
||||||
if location.hash is '#redirect'
|
if location.hash is '#redirect'
|
||||||
$.globalEval 'self.close = function(){};'
|
$.globalEval 'self.close = function(){};'
|
||||||
window.resizeBy 0, 350 - doc.clientHeight
|
window.resizeTo 700, 475
|
||||||
location.replace url
|
location.replace url
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ Report =
|
|||||||
textContent: 'Report to archive'
|
textContent: 'Report to archive'
|
||||||
$.on link, 'click', (e) ->
|
$.on link, 'click', (e) ->
|
||||||
unless e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0
|
unless e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0
|
||||||
window.resizeBy 0, 350 - doc.clientHeight
|
window.resizeTo 700, 475
|
||||||
$.add d.body, [$.tn(' ['), link, $.tn(']')]
|
$.add d.body, [$.tn(' ['), link, $.tn(']')]
|
||||||
|
|
||||||
if types = $.id('reportTypes')
|
if types = $.id('reportTypes')
|
||||||
|
|||||||
@ -2,13 +2,10 @@ Captcha.replace =
|
|||||||
init: ->
|
init: ->
|
||||||
return unless d.cookie.indexOf('pass_enabled=1') < 0
|
return unless d.cookie.indexOf('pass_enabled=1') < 0
|
||||||
|
|
||||||
if location.hostname is 'sys.4chan.org' and Main.jsEnabled
|
if (
|
||||||
if Conf['Use Recaptcha v2 in Reports']
|
(Conf['Use Recaptcha v1'] and location.hostname is 'boards.4chan.org') or
|
||||||
type = if Conf['Force Noscript Captcha'] then 'noscript' else 'v2'
|
(Conf['Use Recaptcha v1 in Reports'] and location.hostname is 'sys.4chan.org')
|
||||||
$.ready Captcha.replace[type]
|
) and Main.jsEnabled
|
||||||
return
|
|
||||||
|
|
||||||
if Conf['Use Recaptcha v1'] and Main.jsEnabled and location.hostname isnt 'www.4chan.org'
|
|
||||||
$.ready Captcha.replace.v1
|
$.ready Captcha.replace.v1
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -47,22 +44,6 @@ Captcha.replace =
|
|||||||
else
|
else
|
||||||
Captcha.v1.create()
|
Captcha.v1.create()
|
||||||
|
|
||||||
v2: ->
|
|
||||||
return unless (old = $.id 'captchaContainerAlt')
|
|
||||||
container = $.el 'div',
|
|
||||||
className: 'g-recaptcha'
|
|
||||||
$.extend container.dataset,
|
|
||||||
sitekey: '<%= meta.recaptchaKey %>'
|
|
||||||
tabindex: 3
|
|
||||||
$.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
|
|
||||||
$.onExists d.body, 'iframe', Captcha.replace.autocopy
|
|
||||||
|
|
||||||
iframe: (iframe) ->
|
iframe: (iframe) ->
|
||||||
if (lang = Conf['captchaLanguage'].trim())
|
if (lang = Conf['captchaLanguage'].trim())
|
||||||
src = if /[?&]hl=/.test iframe.src
|
src = if /[?&]hl=/.test iframe.src
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user