Merge Captcha.language.fixPage into init.

This commit is contained in:
ccd0 2015-06-22 20:54:17 -07:00
parent c54cf1fe0e
commit bf461e1d6a
3 changed files with 9 additions and 8 deletions

View File

@ -64,7 +64,7 @@ Main =
switch location.hostname
when 'www.4chan.org'
Captcha.language.fixPage()
Captcha.language.init()
return
when 'a.4cdn.org'
return

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.fixPage() unless Conf['Use Recaptcha v2 in Reports']
Captcha.language.init() unless Conf['Use Recaptcha v2 in Reports']
@postID = +match[1]
$.ready @ready

View File

@ -1,12 +1,13 @@
Captcha.language =
init: ->
return unless Conf['captchaLanguage'].trim() and d.cookie.indexOf('pass_enabled=1') < 0 and !Conf['Hide Original Post Form']
$.onExists doc, '#captchaFormPart', true, (node) ->
$.onExists node, 'iframe', true, Captcha.language.fixIframe
return unless d.cookie.indexOf('pass_enabled=1') < 0
return if location.hostname is 'boards.4chan.org' and Conf['Hide Original Post Form']
fixPage: ->
return unless Conf['captchaLanguage'].trim() and d.cookie.indexOf('pass_enabled=1') < 0
$.onExists doc, 'iframe', true, Captcha.language.fixIframe
if Conf['captchaLanguage'].trim()
if location.hostname is 'boards.4chan.org'
$.onExists doc, '#captchaFormPart', true, (node) -> $.onExists node, 'iframe', true, Captcha.language.fixIframe
else
$.onExists doc, 'iframe', true, Captcha.language.fixIframe
fixIframe: (el) ->
return unless lang = Conf['captchaLanguage'].trim()