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 switch location.hostname
when 'www.4chan.org' when 'www.4chan.org'
Captcha.language.fixPage() Captcha.language.init()
return return
when 'a.4cdn.org' when 'a.4cdn.org'
return return

View File

@ -3,7 +3,7 @@ Report =
init: -> init: ->
return unless /\bmode=report\b/.test(location.search) and match = location.search.match /\bno=(\d+)/ 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] @postID = +match[1]
$.ready @ready $.ready @ready

View File

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