diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 22027b52d..cc80cfe2c 100755 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -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] diff --git a/src/Miscellaneous/Report.coffee b/src/Miscellaneous/Report.coffee index ae6f96c6f..2326bb3c4 100755 --- a/src/Miscellaneous/Report.coffee +++ b/src/Miscellaneous/Report.coffee @@ -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 diff --git a/src/Posting/Captcha.language.coffee b/src/Posting/Captcha.replace.coffee similarity index 78% rename from src/Posting/Captcha.language.coffee rename to src/Posting/Captcha.replace.coffee index 92711d38a..110fc0e01 100644 --- a/src/Posting/Captcha.language.coffee +++ b/src/Posting/Captcha.replace.coffee @@ -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) diff --git a/src/Posting/Captcha.v2.coffee b/src/Posting/Captcha.v2.coffee index c3a67e675..8d1674c98 100644 --- a/src/Posting/Captcha.v2.coffee +++ b/src/Posting/Captcha.v2.coffee @@ -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