-
×
-
⚠️ Slow Down!
-
Clicking too quickly may get you flagged as spam by Wiby.me.
-
Please wait a moment between fumbles.
-
- You can close this warning in: 5s
-
-
@@ -218,57 +214,43 @@
}
let lastFumbleTime = 0;
- const warningThreshold = 3; // Trigger warning after 3 rapid fumbles
- const rapidPeriod = 5000; // 5 second window for counting rapid fumbles
- const resetPeriod = 3000; // Reset counter if no rapid fumbles in 3 seconds
- let fumbleTimes = []; // Track timestamps of recent fumbles
- let cooldownTimer = null;
+ const minInterval = 2000; // Minimum 2 seconds between fumbles
+ const maxPerMinute = 20; // Maximum 20 fumbles per minute
+ let recentFumbles = []; // Track fumble timestamps for rate limiting
const fumble = () => {
const currentTime = Date.now();
+ const timeSinceLastFumble = currentTime - lastFumbleTime;
- // Add current fumble time and remove old ones (older than 5 seconds)
- fumbleTimes.push(currentTime);
- fumbleTimes = fumbleTimes.filter(time => currentTime - time < rapidPeriod);
-
- // If we have 3 or more fumbles within 5 seconds, show warning
- if (fumbleTimes.length >= warningThreshold) {
- // Show warning modal
- const warningModal = document.getElementById('warningModal');
- const cooldownSeconds = document.getElementById('cooldownSeconds');
- const closeBtn = document.getElementById('warningCloseBtn');
- warningModal.classList.add('show');
- closeBtn.disabled = true;
-
- // Update countdown timer
- let remainingTime = 5;
- cooldownSeconds.textContent = remainingTime;
-
- if (cooldownTimer) clearInterval(cooldownTimer);
- cooldownTimer = setInterval(() => {
- remainingTime--;
-
- if (remainingTime <= 0) {
- cooldownSeconds.textContent = '0';
- closeBtn.disabled = false;
- clearInterval(cooldownTimer);
- fumbleTimes = []; // Reset fumble history
- } else {
- cooldownSeconds.textContent = remainingTime;
- }
- }, 1000);
+ // Prevent rapid clicks (2 second minimum interval)
+ if (timeSinceLastFumble < minInterval) {
return;
}
- // If there are 2 fumbles, check if they're more than 3 seconds apart
- if (fumbleTimes.length >= 2) {
- const lastTwoInterval = fumbleTimes[fumbleTimes.length - 1] - fumbleTimes[fumbleTimes.length - 2];
- if (lastTwoInterval > resetPeriod) {
- fumbleTimes = [currentTime]; // Reset to just the current fumble
- }
+ // Clean up old fumbles (older than 1 minute)
+ recentFumbles = recentFumbles.filter(time =>
+ currentTime - time < 60000
+ );
+
+ // Check rate limit (20 per minute)
+ if (recentFumbles.length >= maxPerMinute) {
+ const warningModal = document.getElementById('warningModal');
+ const cooldownSeconds = document.getElementById('cooldownSeconds');
+ warningModal.classList.add('show');
+
+ // Calculate remaining cooldown time
+ const oldestFumble = recentFumbles[0];
+ const cooldownRemaining = Math.ceil((60000 - (currentTime - oldestFumble)) / 1000);
+ cooldownSeconds.textContent = cooldownRemaining;
+
+ return;
}
+ // Record this fumble
lastFumbleTime = currentTime;
+ recentFumbles.push(currentTime);
+
+ // Perform the fumble
const frame = document.getElementById("contentFrame");
frame.src = "https://wiby.me/surprise/";