-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrecaptcha.html
51 lines (45 loc) · 1.32 KB
/
recaptcha.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html>
<head>
<title>reCAPTCHA Race</title>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
</head>
<body>
<button id="startButton" onclick="startRace()">Start Race</button>
<div id="raceContainer" style="display: none;">
<form id="recaptchaForm" action="?" method="POST">
<div class="g-recaptcha" data-sitekey="6LeGvYcnAAAAANXqQTD6M3XBKSICzB9h8nQNJ1IY"></div>
</form>
<p id="timeDisplay"></p>
</div>
<script>
let startTime;
let endTime;
let captchaCount = 0;
function startRace() {
startTime = new Date();
document.getElementById('startButton').style.display = 'none';
document.getElementById('raceContainer').style.display = 'block';
showNextCaptcha();
}
function showNextCaptcha() {
if (captchaCount < 10) {
captchaCount++;
grecaptcha.reset(); // Reset reCAPTCHA
// Show the current reCAPTCHA
} else {
endRace();
}
}
function endRace() {
endTime = new Date();
const elapsedTime = (endTime - startTime) / 1000;
document.getElementById('timeDisplay').innerHTML = `<b>Time: ${elapsedTime.toFixed(2)} seconds</b>`;
}
// Callback function for reCAPTCHA
function captchaCompleted() {
showNextCaptcha();
}
</script>
</body>
</html>