Parenthesize assignments in if conditions.
This commit is contained in:
parent
210b6bd201
commit
720998721b
@ -32,7 +32,7 @@ Captcha.replace =
|
|||||||
v1: ->
|
v1: ->
|
||||||
return unless $.id 'g-recaptcha'
|
return unless $.id 'g-recaptcha'
|
||||||
Captcha.v1.replace()
|
Captcha.v1.replace()
|
||||||
if link = $.id 'form-link'
|
if (link = $.id 'form-link')
|
||||||
$.on link, 'click', -> Captcha.v1.create()
|
$.on link, 'click', -> Captcha.v1.create()
|
||||||
else if location.hostname is 'boards.4chan.org'
|
else if location.hostname is 'boards.4chan.org'
|
||||||
form = $.id 'postForm'
|
form = $.id 'postForm'
|
||||||
@ -41,7 +41,7 @@ Captcha.replace =
|
|||||||
Captcha.v1.create()
|
Captcha.v1.create()
|
||||||
|
|
||||||
v2: ->
|
v2: ->
|
||||||
return unless old = $.id 'captchaContainerAlt'
|
return unless (old = $.id 'captchaContainerAlt')
|
||||||
container = $.el 'div',
|
container = $.el 'div',
|
||||||
className: 'g-recaptcha'
|
className: 'g-recaptcha'
|
||||||
$.extend container.dataset,
|
$.extend container.dataset,
|
||||||
@ -49,14 +49,14 @@ Captcha.replace =
|
|||||||
tabindex: 3
|
tabindex: 3
|
||||||
$.replace old, container
|
$.replace old, container
|
||||||
url = 'https://www.google.com/recaptcha/api.js'
|
url = 'https://www.google.com/recaptcha/api.js'
|
||||||
if lang = Conf['captchaLanguage'].trim()
|
if (lang = Conf['captchaLanguage'].trim())
|
||||||
url += "?hl=#{encodeURIComponent lang}"
|
url += "?hl=#{encodeURIComponent lang}"
|
||||||
script = $.el 'script',
|
script = $.el 'script',
|
||||||
src: url
|
src: url
|
||||||
$.add d.head, script
|
$.add d.head, script
|
||||||
|
|
||||||
iframe: (el) ->
|
iframe: (el) ->
|
||||||
return unless lang = Conf['captchaLanguage'].trim()
|
return unless (lang = Conf['captchaLanguage'].trim())
|
||||||
src = if /[?&]hl=/.test el.src
|
src = if /[?&]hl=/.test el.src
|
||||||
el.src.replace(/([?&]hl=)[^&]*/, '$1' + encodeURIComponent lang)
|
el.src.replace(/([?&]hl=)[^&]*/, '$1' + encodeURIComponent lang)
|
||||||
else
|
else
|
||||||
|
|||||||
@ -3,9 +3,9 @@ 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 = !!$ '#g-recaptcha, #captchaContainerAlt'
|
return unless (@isEnabled = !!$ '#g-recaptcha, #captchaContainerAlt')
|
||||||
|
|
||||||
if @noscript = Conf['Force Noscript Captcha'] or not Main.jsEnabled
|
if (@noscript = Conf['Force Noscript Captcha'] or not Main.jsEnabled)
|
||||||
@conn = new Connection null, "#{location.protocol}//www.google.com",
|
@conn = new Connection null, "#{location.protocol}//www.google.com",
|
||||||
token: (token) => @save true, token
|
token: (token) => @save true, token
|
||||||
$.addClass QR.nodes.el, 'noscript-captcha'
|
$.addClass QR.nodes.el, 'noscript-captcha'
|
||||||
@ -38,7 +38,7 @@ Captcha.v2 =
|
|||||||
childList: true
|
childList: true
|
||||||
|
|
||||||
initFrame: ->
|
initFrame: ->
|
||||||
if token = $('.fbc-verification-token > textarea')?.value
|
if (token = $('.fbc-verification-token > textarea')?.value)
|
||||||
conn = new Connection window.parent, "#{location.protocol}//boards.4chan.org"
|
conn = new Connection window.parent, "#{location.protocol}//boards.4chan.org"
|
||||||
conn.send {token}
|
conn.send {token}
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ Captcha.v2 =
|
|||||||
|
|
||||||
noscriptURL: ->
|
noscriptURL: ->
|
||||||
url = '//www.google.com/recaptcha/api/fallback?k=<%= meta.recaptchaKey %>'
|
url = '//www.google.com/recaptcha/api/fallback?k=<%= meta.recaptchaKey %>'
|
||||||
if lang = Conf['captchaLanguage'].trim()
|
if (lang = Conf['captchaLanguage'].trim())
|
||||||
url += "&hl=#{encodeURIComponent lang}"
|
url += "&hl=#{encodeURIComponent lang}"
|
||||||
url
|
url
|
||||||
|
|
||||||
@ -131,8 +131,8 @@ Captcha.v2 =
|
|||||||
afterSetup: (mutations) ->
|
afterSetup: (mutations) ->
|
||||||
for mutation in mutations
|
for mutation in mutations
|
||||||
for node in mutation.addedNodes
|
for node in mutation.addedNodes
|
||||||
@setupIFrame iframe if iframe = $.x './descendant-or-self::iframe', node
|
@setupIFrame iframe if (iframe = $.x './descendant-or-self::iframe', node)
|
||||||
@setupTextArea textarea if textarea = $.x './descendant-or-self::textarea', node
|
@setupTextArea textarea if (textarea = $.x './descendant-or-self::textarea', node)
|
||||||
return
|
return
|
||||||
|
|
||||||
setupIFrame: (iframe) ->
|
setupIFrame: (iframe) ->
|
||||||
@ -171,7 +171,7 @@ Captcha.v2 =
|
|||||||
|
|
||||||
getOne: ->
|
getOne: ->
|
||||||
@clear()
|
@clear()
|
||||||
if captcha = @captchas.shift()
|
if (captcha = @captchas.shift())
|
||||||
$.set 'captchas', @captchas
|
$.set 'captchas', @captchas
|
||||||
@count()
|
@count()
|
||||||
captcha
|
captcha
|
||||||
@ -240,7 +240,7 @@ Captcha.v2 =
|
|||||||
new MutationObserver(@fixBubble.bind(@, node)).observe node,
|
new MutationObserver(@fixBubble.bind(@, node)).observe node,
|
||||||
attributes: true
|
attributes: true
|
||||||
# Prevent Recaptcha from keeping focus when popup dismissed.
|
# Prevent Recaptcha from keeping focus when popup dismissed.
|
||||||
if overlay = $ 'div[style*="position: fixed;"]', node
|
if (overlay = $ 'div[style*="position: fixed;"]', node)
|
||||||
$.on overlay, 'click', -> $('#qr iframe')?.blur()
|
$.on overlay, 'click', -> $('#qr iframe')?.blur()
|
||||||
|
|
||||||
fixBubble: (node) ->
|
fixBubble: (node) ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user