Skip to content

Instantly share code, notes, and snippets.

@didicodethat
Last active January 29, 2018 16:15
Show Gist options
  • Save didicodethat/129cb1fd1b760c6ca69f4a45d0a0e843 to your computer and use it in GitHub Desktop.
Save didicodethat/129cb1fd1b760c6ca69f4a45d0a0e843 to your computer and use it in GitHub Desktop.
Simple plugin to bind a keyboard key as a cookie click

Description

This is a simple plugin to bind a keyboard key as a cookie click. By default it is set to the Numpad0 key on the keyboard. Created this because i don't like the noise of the mouse clicking during work hours ;).

Instalation

Add this code as a bookmark. Activated by clicking on it at the cookie clicker page.

javascript:(function(){document.addEventListener('keyup', function(e) { if(e.code === 'Numpad0') Game.ClickCookie();})})();

Changing the key

If you want to change the key that triggers the cookie click edit the if(e.code === 'Numpad0') and set the key that you want to bind inside the quotes ''.

The code to the keys on the keyboard can be found here: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode

Observations.

The cookie particles of the click only appears when the mouse is on the cookie area, but the cookies are being generated even without the particle effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment