Count the Shuffle Button Clicks - People's Choice Award - Gemini API Developer Competition

So as we know the People’s Choice Award is going on. There are more than 3000 projects on the votes page so we have to shuffle every time to see the 3 projects. So in-case if you want to count how many times you have shuffle the projects and watched the projects. then I have this code. I am personally using it and it’s helping me to know how many projects I have seen so far each shuffle show us 3 projects so we shuffled 100 times then it means we have seen almost 300 projects. I know there could be some projects which were shown multiple times but you get the idea of it.

so copy below code and paste it in your console. before pasting write ‘allow pasting’ so goolge chrome’s page inspector allow you to paste the code.

here’s the code:
// Finding the button with the class ‘gemini-spin-button’
const spinButton = document.querySelector(‘.gemini-spin-button’);

// Finding the span inside the button
const spanElement = spinButton.querySelector(‘span’);

// Initializing a counter
let count = 0;

// Adding an event listener for the ‘click’ event
spinButton.addEventListener(‘click’, function() {
count += 1;
console.log('Clicked Count: ', count);

// Changing the text of the span
spanElement.innerText = Clicked: ${count};
});

I know it’s a basic code but it’s helping me in watching projects and counting. So I thought I should share it with you guys too! :heart:

Remember to not refresh the page :joy:

here’s how it will show the button now each time you shuffle the projects: