Skip to content

Commit

Permalink
experiment with lag
Browse files Browse the repository at this point in the history
  • Loading branch information
KhafraDev committed Jan 11, 2025
1 parent 922c430 commit 516b604
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,15 +289,19 @@ async function getCloudSave () {
await importSynergism(save?.save ?? null)
}

const hasCaptcha = new WeakSet<HTMLElement>()

export function renderCaptcha () {
const captchaElements = Array.from<HTMLElement>(document.querySelectorAll('.turnstile'))
const visible = captchaElements.find((el) => el.offsetParent !== null)

if (visible) {
if (visible && !hasCaptcha.has(visible)) {
turnstile.render(visible, {
sitekey: visible.getAttribute('data-sitekey')!,
'error-callback' () {},
retry: 'never'
})

hasCaptcha.add(visible)
}
}

0 comments on commit 516b604

Please sign in to comment.