Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2015
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. function konamiCode () {
  2. var keys = [];
  3. var valid = _.map("38384040373937396665".match(/.{1,2}/g), _.parseInt);
  4. document.onkeydown = function (key) {
  5. if (key > 10) {
  6. document.onkeydown = null;
  7. return;
  8. }
  9.  
  10. keys.push(key.which);
  11.  
  12. if (keys.length == 10 && JSON.stringify(keys) === JSON.stringify(valid)) {
  13. // Code Success, do something...
  14. }
  15. };
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement