aboutsummaryrefslogtreecommitdiffstats
path: root/src/scripts/autofill-captcha.ts
blob: 8caac1c23d0cc717e8462a2de1f4f9892da08ef9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
setInterval(() => {
	let captchas = Array.from(document.querySelectorAll("#txtCaptcha")) as HTMLInputElement[];

	for (const captcha of captchas) {
		const captchaInput = captcha.parentElement!.querySelector("#txtInput") as HTMLInputElement | null;
		if (captchaInput) {
			captchaInput.value = captcha.value.replaceAll(" ", "");
			captchaInput.style.display = "none";
			captcha.style.display = "none";
		}
	}

	captchas = Array.from(document.querySelectorAll("#captchaText")) as HTMLInputElement[];
	for (const captcha of captchas) {
		const captchaParentElement = captcha.parentElement!;
		if (captchaParentElement.id === "drawTextSpan") {
			const captchaInput = captchaParentElement.parentElement!.querySelector("#drawText1") as HTMLInputElement | null;
			if (captchaInput) {
				captchaInput.value = captcha.value.replaceAll(" ", "");
				captchaParentElement.parentElement!.style.display = "none";
			}
		}
	}
}, 5000);