{* $Id$ *} {if empty($user) || $user eq 'anonymous' || !empty($showantibot)} {if $showmandatory eq 'y'} {$inputclass = 'col-sm-11 col-md-5'} {* leave room for the * *} {else} {$inputclass = 'col-md-6'} {/if} {$captchaclass = 'col-sm-3 mb-1'} {if $form === 'register'} {$labelclass = 'col-md-4 col-sm-3'} {$inputclass = 'col-md-4 col-sm-6'} {$captchaclass = 'col-md-5 col-sm-6 offset-md-4 offset-sm-3'} {/if}
{if $captchalib->type eq 'recaptcha' || $captchalib->type eq 'recaptcha20'}
{$captchalib->render()}
{elseif $captchalib->type eq 'questions'}
{if $showmandatory eq 'y'}
*
{else}
{/if}
{else} {* Default captcha *}
{if $captchalib->type eq 'default'} {tr}Anti-Bot verification code image{/tr} {else} {* dumb captcha *} {$captchalib->render()} {/if}
{if $captchalib->type eq 'default'}
{button _id='captchaRegenerate' _class='' href='#antibot' _text="{tr}Try another code{/tr}" _icon_name="refresh" _onclick="generateCaptcha();return false;"}
{/if}
{if $showmandatory eq 'y'}
*
{/if}
{/if}
{jq} function antibotVerification(element, rule) { if (!jqueryTiki.validate) return; var form = $(".antibot").parents('form'); if (!form.data("validator")) { form.validate({}); } element.rules( "add", rule); } {/jq} {if $captchalib->type eq 'recaptcha'} {jq} var existCondition = setInterval(function() { if ($('#recaptcha_response_field').length) { clearInterval(existCondition); antibotVerification($("#recaptcha_response_field"), {required: true}); } }, 100); // wait for captcha to load {/jq} {elseif $captchalib->type eq 'recaptcha20'} {jq} var existCondition = setInterval(function() { if ($('#g-recaptcha-response').length) { clearInterval(existCondition); antibotVerification($("#g-recaptcha-response"), {required: true}); } }, 100); // wait for captcha to load {/jq} {else} {jq} antibotVerification($("#antibotcode"), { required: true, remote: { url: "validate-ajax.php", type: "post", data: { validator: "captcha", parameter: function() { return $("#captchaId").val(); }, input: function() { return $("#antibotcode").val(); } } } }); {/jq} {/if} {/if}