made changes to timer

This commit is contained in:
Michael Andrew Maurakis 2025-01-20 02:30:36 -06:00
parent bbf662fb6d
commit b8053dc9e8

View file

@ -215,7 +215,9 @@
}
let lastFumbleTime = 0;
const cooldownPeriod = 5000; // 5 seconds cooldown
const cooldownPeriod = 2000; // Reduce to 2 seconds cooldown
const warningThreshold = 3; // Number of quick fumbles before warning
let quickFumbleCount = 0;
let cooldownTimer = null;
const fumble = () => {
@ -223,15 +225,17 @@
const timeSinceLastFumble = currentTime - lastFumbleTime;
if (timeSinceLastFumble < cooldownPeriod) {
quickFumbleCount++;
if (quickFumbleCount >= warningThreshold) {
// Show warning modal
const warningModal = document.getElementById("warningModal");
const cooldownSeconds = document.getElementById("cooldownSeconds");
const closeBtn = document.getElementById("warningCloseBtn");
warningModal.classList.add("show");
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; // 5 second countdown for closing
let remainingTime = 3; // Reduce to 3 second countdown for closing
cooldownSeconds.textContent = remainingTime;
if (cooldownTimer) clearInterval(cooldownTimer);
@ -239,16 +243,19 @@
remainingTime--;
if (remainingTime <= 0) {
cooldownSeconds.textContent = "0";
cooldownSeconds.textContent = '0';
closeBtn.disabled = false;
clearInterval(cooldownTimer);
quickFumbleCount = 0; // Reset counter after warning
} else {
cooldownSeconds.textContent = remainingTime;
}
}, 1000);
return;
}
} else {
quickFumbleCount = 0; // Reset counter if enough time has passed
}
lastFumbleTime = currentTime;
const frame = document.getElementById("contentFrame");