From 589cb2ac797badb455b77c4aafc3eeb9e86e0557 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Wed, 19 Mar 2025 10:14:59 -0700 Subject: [PATCH] feat: prevent consecutive flips of the same testimonial card --- aider/website/home.html | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/aider/website/home.html b/aider/website/home.html index c80b65b9b..a0c1b0730 100644 --- a/aider/website/home.html +++ b/aider/website/home.html @@ -706,11 +706,22 @@ aider --model gpt-4o --api-key openai=your-key-goes-here document.addEventListener('DOMContentLoaded', function() { initializeTestimonials(); + // Track the last flipped card index to avoid repeats + let lastFlippedIndex = -1; + // Rotate one testimonial at a time, randomly selecting which one to change setInterval(function() { - // Randomly select which testimonial to update - const randomIndex = Math.floor(Math.random() * displayCount); + // Select a random index that's different from the last flipped one + let randomIndex; + do { + randomIndex = Math.floor(Math.random() * displayCount); + } while (randomIndex === lastFlippedIndex && displayCount > 1); + + // Update the selected testimonial updateSingleTestimonial(randomIndex); + + // Store this index as the last flipped + lastFlippedIndex = randomIndex; }, 3000); });