Skip to content

Instantly share code, notes, and snippets.

@phxgg
Last active January 16, 2025 00:24
Show Gist options
  • Select an option

  • Save phxgg/a81e166d181cb3993f985a3c005b6b73 to your computer and use it in GitHub Desktop.

Select an option

Save phxgg/a81e166d181cb3993f985a3c005b6b73 to your computer and use it in GitHub Desktop.
// paste this in the console before starting EZ Clap
const gameArea = document.getElementById('game-area');
function waitForClassRemoval(element, className, callback) {
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.attributeName === 'class') {
if (element.classList.contains(className)) {
console.log(`Class ${className} added. Waiting for removal...`);
} else {
console.log(`Class ${className} removed. Performing click...`);
callback();
}
}
});
});
observer.observe(element, { attributes: true });
}
waitForClassRemoval(gameArea, 'waiting', () => {
gameArea.click();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment