From 0553d6340e81c0c25a63d2102d5a1bc7b8cceff0 Mon Sep 17 00:00:00 2001 From: techcow2 <108380065+techcow2@users.noreply.github.com> Date: Mon, 16 Sep 2024 00:44:00 -0400 Subject: [PATCH] Update script.js --- script.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/script.js b/script.js index 69859fe..0271709 100644 --- a/script.js +++ b/script.js @@ -1,5 +1,5 @@ document.addEventListener('DOMContentLoaded', () => { - // Welcome modal functionality + const welcomeModal = document.getElementById('welcomeModal'); const acceptButton = document.getElementById('acceptButton'); @@ -57,10 +57,10 @@ document.addEventListener('DOMContentLoaded', () => { let currentRating = 0; - // Hide rating system on page load + ratingSystem.classList.add('hidden'); - // Toggle instructions visibility + toggleInstructions.addEventListener('click', () => { instructions.classList.toggle('hidden'); instructions.classList.toggle('show'); @@ -70,10 +70,10 @@ document.addEventListener('DOMContentLoaded', () => { : 'How to Use'; }); - // Rate limiting variables + let tokenBucket = 10; const maxTokens = 10; - const refillRate = 1; // 1 token per 6 seconds (10 per minute) + const refillRate = 1; let lastRefillTimestamp = Date.now(); function refillTokenBucket() { @@ -104,7 +104,7 @@ document.addEventListener('DOMContentLoaded', () => { return; } - // Check for minimum word count + const wordCount = summary.split(/\s+/).length; if (wordCount < 10) { showError('Please enter at least 10 words in your issue description.'); @@ -201,7 +201,7 @@ document.addEventListener('DOMContentLoaded', () => { ratingMessage.textContent = ''; }); - // Handle star rating selection + stars.forEach(star => { star.addEventListener('click', () => { const rating = parseInt(star.getAttribute('data-rating')); @@ -377,21 +377,21 @@ Your detailed explanation here. Include reasoning for the assigned impact, urgen result.classList.remove('hidden'); ratingSystem.classList.remove('hidden'); - // Show or hide the "Write E-mail" button based on impact, urgency, and priority + const isHighestPriority = impact.startsWith('1-High') && urgency.startsWith('1-High') && priority.startsWith('1-Critical'); writeEmailButton.classList.toggle('hidden', !isHighestPriority); - // Show the Reset button + resetButton.classList.remove('hidden'); - // Add fade-in animation to results + result.style.opacity = '0'; result.style.display = 'block'; - await new Promise(resolve => setTimeout(resolve, 10)); // Small delay for the display change to take effect + await new Promise(resolve => setTimeout(resolve, 10)); result.style.transition = 'opacity 0.5s ease-in-out'; result.style.opacity = '1'; - // Smooth scroll to results + result.scrollIntoView({ behavior: 'smooth', block: 'start' }); }