Created
March 25, 2014 19:43
-
-
Save anonymous/9769692 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var keyMap = []; | |
onkeydown = onkeyup = function(e) { | |
e = e || event; | |
keyMap[e.keyCode] = e.type == 'keydown'; | |
if ((keyMap[91] || keyMap[17]) && keyMap[90] && keyMap[16]) { | |
console.log('redo'); | |
keyMap = []; | |
return false; | |
} | |
if ((keyMap[91] || keyMap[17]) && keyMap[90]) { | |
console.log('undo'); | |
keyMap = []; | |
return false; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment