Skip to content

Commit

Permalink
templates: fix cloudflare turnstile loading
Browse files Browse the repository at this point in the history
  • Loading branch information
wuhan005 committed Jan 15, 2024
1 parent 9894638 commit 2fcdbe3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion templates/base/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,18 @@
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"/></script>
{{ if .RecaptchaTurnstileStyle }}
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js?compat=recaptcha" async defer></script>
<script>function onSubmit() {}</script>
<script>
document.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll('.g-recaptcha').forEach(item => {
item.disabled = true;
});
});

function onSubmit() {
document.querySelectorAll('.g-recaptcha').forEach(item => {
item.disabled = false;
})
}</script>
{{ else }}
<script src="{{.RecaptchaDomain}}/recaptcha/api.js" async defer></script>
<script>function onSubmit() {document.getElementById('form').submit();}</script>
Expand Down

0 comments on commit 2fcdbe3

Please sign in to comment.