Created
September 28, 2012 17:09
-
-
Save v42/3801026 to your computer and use it in GitHub Desktop.
Triforce Typing Detection in Javascript
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
/* | |
* ▲ | |
* ▲ ▲ | |
* | |
* Newfags can't triforce. | |
* | |
* TODO: detect on mac (white triangles) and test detection on linux | |
*/ | |
var kpr = [], | |
kcw = ['160','160','9650','13','9650','160','9650']; | |
function pushKey(k){ | |
if(kcw[kpr.length] && kcw[kpr.length].toString()==k){ | |
kpr.push(k); | |
if(kpr.length === kcw.length){ | |
alert(' ▲\n▲ ▲\nTriforce111!!11!!ONEONE!1'); | |
} | |
} else { | |
kpr = []; | |
} | |
//console.log(kpr); | |
} | |
window.addEventListener("keypress", function(e){ | |
pushKey(e.keyCode.toString()); | |
}, true); |
Author
v42
commented
Nov 28, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment