IMPR: Add turnstile on AJAX

This commit is contained in:
Tony Air 2023-10-31 22:06:31 +02:00
parent 6eb9182448
commit 67eb797e9f
3 changed files with 18 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@a2nt/ss-bootstrap-ui-webpack-boilerplate-react",
"version": "5.0.9",
"version": "5.1.0",
"description": "This UI Kit allows you to build Bootstrap 5 webapp with some extra UI features. It's easy to extend and easy to convert HTML templates to CMS templates.",
"author": "Tony Air <tony@twma.pro>",
"license": "BSD-2-Clause",

View File

@ -49,5 +49,7 @@ export default ((W) => {
}
W.addEventListener(`${Events.LODEDANDREADY}`, loadLazyImages)
W.addEventListener(`${Events.AJAX}`, loadLazyImages)
W.addEventListener(`${Events.AJAX}`, () => {
setTimeout(loadLazyImages, 250)
})
})(window)

14
src/js/ui/turnstile.js Normal file
View File

@ -0,0 +1,14 @@
import Events from '../_events'
const NAME = 'uiTurnstile'
const init = () => {
if (typeof window.turnstile === undefined) {
return
}
console.log(`${NAME}: init`)
window.turnstile.render('.cf-turnstile')
}
window.addEventListener(`${Events.LODEDANDREADY}`, init)
window.addEventListener(`${Events.AJAX}`, init)