-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
557 additions
and
1 deletion.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
326 changes: 326 additions & 0 deletions
326
images/windows-98-logo-vector-by-pkmnct-plus-js-logo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* @license konami-js v1.0.1 | ||
* http://mck.me/mit-license | ||
*/ | ||
var Konami = {}; | ||
|
||
(function(Konami, window) { | ||
'use strict'; | ||
|
||
/** | ||
* Creates an event handler responding to the specified sequence. | ||
* @param {...number|function()} arguments | ||
* @return {function(Event)} | ||
*/ | ||
var sequence = Konami.sequence = function() { | ||
var sequence = Array.prototype.slice.call(arguments), | ||
state = 0; | ||
|
||
/** | ||
* Event handler | ||
* @param {Event|number} e | ||
*/ | ||
return function(e) { | ||
// patch legacy IE | ||
e = (e || window.event); | ||
e = (e.keyCode || e.which || e); | ||
|
||
if (e === sequence[state] || e === sequence[(state = 0)]) { | ||
// move next and peek | ||
var action = sequence[++state]; | ||
|
||
// sequence complete when a function is reached | ||
if (typeof action !== 'function') { | ||
return; | ||
} | ||
|
||
// fire action | ||
action(); | ||
|
||
// reset when sequence completed | ||
state = 0; | ||
} | ||
}; | ||
}; | ||
|
||
/** | ||
* Creates an event handler responding to the Konami Code. | ||
* @param {function()} action completed sequence callback | ||
* @return {function(Event)} | ||
*/ | ||
Konami.code = function(action) { | ||
return sequence(38, 38, 40, 40, 37, 39, 37, 39, 66, 65, action); | ||
}; | ||
|
||
})(Konami, window); |
Oops, something went wrong.