Skip to content

Instantly share code, notes, and snippets.

@chapel
Created September 10, 2011 05:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chapel/1207977 to your computer and use it in GitHub Desktop.
Save chapel/1207977 to your computer and use it in GitHub Desktop.
/ Fatalities
var fatalities = {
triggers: {
konamiCode: function(scriptPath, scriptFn) {
console.log("Added function");
var konamiKeys = [], konamiCombo = "38,38,40,40,37,39,37,39,66,65";
$(document).keydown(function(e) {
konamiKeys.push(e.keyCode);
if(konamiKeys.toString().indexOf(konamiCombo) >= 0) {
$(document).unbind('keydown', arguments.callee);
$.getScript(scriptPath, function() {
scriptFn();
$(document).keydown(eval(scriptFn));
});
}
});
}
},
outcomes: {
cornify: {
path: "http://www.cornify.com/js/cornify.js",
fn: "cornify_add"
}
}
};
$(function() {
$("button").live("click", function() {
fatalities.triggers.konamiCode(fatalities.outcomes.cornify.path, fatalities.outcomes.cornify.fn);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment