Update for report form captcha change. #727
This commit is contained in:
parent
3a93db1879
commit
dded519aa1
@ -487,11 +487,11 @@ Config =
|
||||
]
|
||||
'Use Recaptcha v1': [
|
||||
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
|
||||
'Use the image selection captcha in the report window.'
|
||||
'Use the text captcha in the report window.'
|
||||
]
|
||||
'Force Noscript Captcha': [
|
||||
false
|
||||
|
||||
@ -345,6 +345,9 @@ Settings =
|
||||
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|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
|
||||
loadSettings: (data, cb) ->
|
||||
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)
|
||||
a.textContent = 'Report'
|
||||
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']
|
||||
a.textContent = 'Report to archive'
|
||||
ReportLink.url = Redirect.to 'report', {boardID: post.board.ID, postID: post.ID}
|
||||
ReportLink.height = 350
|
||||
ReportLink.dims = 'width=700,height=475'
|
||||
else
|
||||
ReportLink.url = ''
|
||||
!!ReportLink.url
|
||||
|
||||
report: ->
|
||||
{url, height} = ReportLink
|
||||
{url, dims} = ReportLink
|
||||
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
|
||||
|
||||
@ -62,7 +62,7 @@ Report =
|
||||
if (message = $ 'h3') and /Report submitted!/.test(message.textContent)
|
||||
if location.hash is '#redirect'
|
||||
$.globalEval 'self.close = function(){};'
|
||||
window.resizeBy 0, 350 - doc.clientHeight
|
||||
window.resizeTo 700, 475
|
||||
location.replace url
|
||||
return
|
||||
|
||||
@ -71,7 +71,7 @@ Report =
|
||||
textContent: 'Report to archive'
|
||||
$.on link, 'click', (e) ->
|
||||
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(']')]
|
||||
|
||||
if types = $.id('reportTypes')
|
||||
|
||||
@ -2,13 +2,10 @@ Captcha.replace =
|
||||
init: ->
|
||||
return unless d.cookie.indexOf('pass_enabled=1') < 0
|
||||
|
||||
if location.hostname is 'sys.4chan.org' and Main.jsEnabled
|
||||
if Conf['Use Recaptcha v2 in Reports']
|
||||
type = if Conf['Force Noscript Captcha'] then 'noscript' else 'v2'
|
||||
$.ready Captcha.replace[type]
|
||||
return
|
||||
|
||||
if Conf['Use Recaptcha v1'] and Main.jsEnabled and location.hostname isnt 'www.4chan.org'
|
||||
if (
|
||||
(Conf['Use Recaptcha v1'] and location.hostname is 'boards.4chan.org') or
|
||||
(Conf['Use Recaptcha v1 in Reports'] and location.hostname is 'sys.4chan.org')
|
||||
) and Main.jsEnabled
|
||||
$.ready Captcha.replace.v1
|
||||
return
|
||||
|
||||
@ -47,22 +44,6 @@ Captcha.replace =
|
||||
else
|
||||
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) ->
|
||||
if (lang = Conf['captchaLanguage'].trim())
|
||||
src = if /[?&]hl=/.test iframe.src
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user