6 ms·
Just like few others here, I wanted keyboard shortcuts so I just hacked it quickly. Will break if DOM classes change, but author should implement something bett
by selectnull 4y ago
Just like few others here, I wanted keyboard shortcuts so I just hacked it quickly. Will break if DOM classes change, but author should implement something better.
Cool game.
```
const rotate = (direction) => {
const directions = {counterclockwise: 0, clockwise: 1};
const buttons = Array.from(document.querySelector('.mt-16.flex.items-center.justify-between.w-72.h-12.px-2').querySelectorAll('div')).filter(el => el.className === '');
buttons[directions[direction]].click();
}
document.addEventListener('keydown', (ev) => {
switch (ev.key) {
case 'ArrowLeft':
rotate('counterclockwise');
break;
case 'ArrowRight':
rotate('clockwise');
break;
}
});
```