kollapsminoriteten/wp-content/themes/blocksy/static/js/frontend/integration/turnstile.js

35 lines
695 B
JavaScript
Raw Normal View History

2025-08-27 08:44:30 +02:00
export const mount = () => {
if (!window.turnstile) {
return
}
2025-12-12 13:14:39 +01:00
if (window.WPDEF) {
const widgets = document.querySelectorAll('div[id^="wpdef_turnstile_"]')
if (widgets.length) {
widgets.forEach((widget) => {
turnstile.render(`#${widget.id}`, {
sitekey: WPDEF.options.sitekey,
theme: WPDEF.options.theme,
size: WPDEF.options.size,
language: WPDEF.options.lang,
'response-field-name': 'wpdef-turnstile-response'
})
})
return
}
}
2025-08-27 08:44:30 +02:00
const forms = document.querySelectorAll('.ct-popup .cf-turnstile')
if (!forms.length) {
return
}
forms.forEach((form) => {
turnstile.remove(form)
turnstile.render(form)
turnstile.reset(form)
})
}