main.js: do not initialize captchas if there is no hook

This commit is contained in:
Zankaria 2024-08-23 14:36:12 +02:00
parent 111fa78921
commit 3994afd10d

View file

@ -349,10 +349,12 @@ function isDynamicCaptchaEnabled() {
function initCaptcha() { function initCaptcha() {
if (isDynamicCaptchaEnabled()) { if (isDynamicCaptchaEnabled()) {
let captcha_hook = document.getElementById('captcha'); let captcha_hook = document.getElementById('captcha');
if (captcha_hook) {
captcha_hook.style = ""; captcha_hook.style = "";
initCaptchaImpl(); initCaptchaImpl();
} }
} }
}
{% endif %} // End if dynamic captcha {% endif %} // End if dynamic captcha
{% else %} // Else if any captcha {% else %} // Else if any captcha
// No-op for `init()`. // No-op for `init()`.