mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-04 11:45:00 +00:00
feat: prevent consecutive flips of the same testimonial card
This commit is contained in:
parent
d973be8fea
commit
589cb2ac79
1 changed files with 13 additions and 2 deletions
|
@ -706,11 +706,22 @@ aider --model gpt-4o --api-key openai=your-key-goes-here</pre>
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
initializeTestimonials();
|
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
|
// Rotate one testimonial at a time, randomly selecting which one to change
|
||||||
setInterval(function() {
|
setInterval(function() {
|
||||||
// Randomly select which testimonial to update
|
// Select a random index that's different from the last flipped one
|
||||||
const randomIndex = Math.floor(Math.random() * displayCount);
|
let randomIndex;
|
||||||
|
do {
|
||||||
|
randomIndex = Math.floor(Math.random() * displayCount);
|
||||||
|
} while (randomIndex === lastFlippedIndex && displayCount > 1);
|
||||||
|
|
||||||
|
// Update the selected testimonial
|
||||||
updateSingleTestimonial(randomIndex);
|
updateSingleTestimonial(randomIndex);
|
||||||
|
|
||||||
|
// Store this index as the last flipped
|
||||||
|
lastFlippedIndex = randomIndex;
|
||||||
}, 3000);
|
}, 3000);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue