main.js: do not initialize captcha if not required by the mode

This commit is contained in:
Zankaria 2025-02-12 21:32:14 +01:00
parent 6df32997bf
commit aa18595adf

View file

@ -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.