From aa18595adf5781332753898c352c636283153bad Mon Sep 17 00:00:00 2001 From: Zankaria Date: Wed, 12 Feb 2025 21:32:14 +0100 Subject: [PATCH] main.js: do not initialize captcha if not required by the mode --- templates/main.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/templates/main.js b/templates/main.js index c4c71bc3..c4025646 100755 --- a/templates/main.js +++ b/templates/main.js @@ -251,7 +251,9 @@ var postCaptchaId = null; {% if config.captcha.mode == 'hcaptcha' %} // If hcaptcha function onCaptchaLoadHcaptcha() { - if (captcha_renderer === null && (active_page === 'index' || active_page === 'catalog' || active_page === 'thread')) { + if ((captchaMode === 'static' || (captchaMode === 'dynamic' && isDynamicCaptchaEnabled())) + && captcha_renderer === null + && (active_page === 'index' || active_page === 'catalog' || active_page === 'thread')) { let renderer = { /** * @returns {object} Opaque widget id. @@ -296,7 +298,9 @@ window.onCaptchaLoadTurnstile_post_thread = function() { // Should be called by the captcha API when it's ready. Ugly I know... D: function onCaptchaLoadTurnstile(action) { - if (captcha_renderer === null && (active_page === 'index' || active_page === 'catalog' || active_page === 'thread')) { + if ((captchaMode === 'static' || (captchaMode === 'dynamic' && isDynamicCaptchaEnabled())) + && captcha_renderer === null + && (active_page === 'index' || active_page === 'catalog' || active_page === 'thread')) { let renderer = { /** * @returns {object} Opaque widget id.