Skip to content

Commit

Permalink
Update script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
techcow2 authored Sep 16, 2024
1 parent 8f5613d commit 0553d63
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
document.addEventListener('DOMContentLoaded', () => {
// Welcome modal functionality

const welcomeModal = document.getElementById('welcomeModal');
const acceptButton = document.getElementById('acceptButton');

Expand Down Expand Up @@ -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');
Expand All @@ -70,10 +70,10 @@ document.addEventListener('DOMContentLoaded', () => {
: '<i class="fas fa-info-circle mr-2"></i>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() {
Expand Down Expand Up @@ -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.');
Expand Down Expand Up @@ -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'));
Expand Down Expand Up @@ -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' });
}

Expand Down

0 comments on commit 0553d63

Please sign in to comment.