User Code List
ASP.NET ---New Snippet C# ---New Snippet JavaScript ---jQuery ------Konami Code ---Konami Code ---Read URL GET Variables PHP ---New Snippet CSS ---CSS2 ---CSS3 ------Border Image ------Border Radius ------Box Shadow ------Font Face ------RGBA ------Text Shadow
|
| |
|
| |
Konami Code |
| |
/** * Konami Code widget, modified from work done by John Resig. */ Core.Controller.KonamiCode = (function() { // Constants var _YU = YAHOO.util, _CE = _YU.CustomEvent, _YE = _YU.Event; // Local namespace var _F = function() {}, _keyPressed = [], _konamiCode = '38,38,40,40,37,39,37,39,66,65,13', _that = null; // Event namespace var _E = { onKey: function(e) { var keyCode = _YE.getCharCode(e); _keyPressed.push(keyCode); if(0 < = _keyPressed.toString().indexOf(_konamiCode)) { _keyPressed = []; _that.onCodeEntered.fire(); } } }; // Public namespace _F.prototype = { /** * The event to fire after the Konami code is successfully entered. * @event onCodeEntered */ onCodeEntered: new _CE('KonamiCode.CodeEntered', null, false, _CE.FLAT) }; _YE.on(document, 'keydown', _E.onKey); _that = new _F(); return _that; })(); Core.Controller.KonamiCode.onCodeEntered.subscribe(function() { alert('Guten Tag!'); }); |
| |
Sub-Article List
|
|