mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-11 15:04:02 +09:00
1 parent
1f615a406f
commit
f24f3e1eda
2 files changed
+14
-1
No files matched your search
@@ -1,6 +1,19 @@
|
||||
import {isDarkTheme} from '../utils.ts';
|
||||
import {registerGlobalInitFunc} from '../modules/observer.ts';
|
||||
|
||||
export async function initCaptcha() {
|
||||
registerGlobalInitFunc('initImageCaptcha', (el: HTMLElement) => {
|
||||
const a = el.querySelector('a')!;
|
||||
a.removeAttribute('href'); // remove generated href="javascript:"
|
||||
const img = el.querySelector('img')!;
|
||||
img.removeAttribute('onclick'); // remove generated onclick="...." and use our own event listener
|
||||
img.addEventListener('click', () => {
|
||||
const url = new URL(img.src);
|
||||
url.searchParams.set('reload', String(Date.now()));
|
||||
img.src = url.href;
|
||||
});
|
||||
});
|
||||
|
||||
const captchaEl = document.querySelector('#captcha');
|
||||
if (!captchaEl) return;
|
||||
|
||||
|
||||
Reference in new issue
Block a user