Captcha.language -> Captcha.replace

This commit is contained in:
ccd0 2015-06-22 21:03:30 -07:00
parent bf461e1d6a
commit 5dec400267
4 changed files with 8 additions and 8 deletions

View File

@ -64,7 +64,7 @@ Main =
switch location.hostname
when 'www.4chan.org'
Captcha.language.init()
Captcha.replace.init()
return
when 'a.4cdn.org'
return
@ -307,7 +307,7 @@ Main =
features: [
['Polyfill', Polyfill]
['Captcha Language', Captcha.language]
['Captcha Replacement', Captcha.replace]
['Redirect', Redirect]
['Header', Header]
['Catalog Links', CatalogLinks]

View File

@ -3,7 +3,7 @@ Report =
init: ->
return unless /\bmode=report\b/.test(location.search) and match = location.search.match /\bno=(\d+)/
Captcha.language.init() unless Conf['Use Recaptcha v2 in Reports']
Captcha.replace.init() unless Conf['Use Recaptcha v2 in Reports']
@postID = +match[1]
$.ready @ready

View File

@ -1,15 +1,15 @@
Captcha.language =
Captcha.replace =
init: ->
return unless d.cookie.indexOf('pass_enabled=1') < 0
return if location.hostname is 'boards.4chan.org' and Conf['Hide Original Post Form']
if Conf['captchaLanguage'].trim()
if location.hostname is 'boards.4chan.org'
$.onExists doc, '#captchaFormPart', true, (node) -> $.onExists node, 'iframe', true, Captcha.language.fixIframe
$.onExists doc, '#captchaFormPart', true, (node) -> $.onExists node, 'iframe', true, Captcha.replace.iframe
else
$.onExists doc, 'iframe', true, Captcha.language.fixIframe
$.onExists doc, 'iframe', true, Captcha.replace.iframe
fixIframe: (el) ->
iframe: (el) ->
return unless lang = Conf['captchaLanguage'].trim()
src = if /[?&]hl=/.test el.src
el.src.replace(/([?&]hl=)[^&]*/, '$1' + encodeURIComponent lang)

View File

@ -131,7 +131,7 @@ Captcha.v2 =
return
setupIFrame: (iframe) ->
Captcha.language.fixIframe iframe
Captcha.replace.iframe iframe
$.addClass QR.nodes.el, 'captcha-open'
if QR.nodes.el.getBoundingClientRect().bottom > doc.clientHeight
QR.nodes.el.style.top = null